## Get definitions for a custom object type

`client.Object.Definitions(ctx, entitySlug) (*ObjectDefinitionsResponse, error)`

**get** `/v1/objects/{entitySlug}/definitions`

Returns field and relationship definitions for the specified custom object type.

### Parameters

- `entitySlug string`

  The slug of the custom object type.

### Returns

- `type ObjectDefinitionsResponse struct{…}`

  - `FieldDefinitions map[string, ObjectDefinitionsResponseFieldDefinition]`

    Map of field keys to their definitions, including both system and custom fields.

    - `Description string`

      Description of the field, or null.

    - `Label string`

      Human-readable display name of the field.

    - `TypeConfiguration ObjectDefinitionsResponseFieldDefinitionTypeConfiguration`

      Type-specific configuration (e.g. select options, currency code).

      - `Currency string`

        ISO 4217 3-letter currency code.

      - `HandleService string`

        Social platform associated with this handle field.

        - `const ObjectDefinitionsResponseFieldDefinitionTypeConfigurationHandleServiceTwitter ObjectDefinitionsResponseFieldDefinitionTypeConfigurationHandleService = "TWITTER"`

        - `const ObjectDefinitionsResponseFieldDefinitionTypeConfigurationHandleServiceLinkedin ObjectDefinitionsResponseFieldDefinitionTypeConfigurationHandleService = "LINKEDIN"`

        - `const ObjectDefinitionsResponseFieldDefinitionTypeConfigurationHandleServiceFacebook ObjectDefinitionsResponseFieldDefinitionTypeConfigurationHandleService = "FACEBOOK"`

        - `const ObjectDefinitionsResponseFieldDefinitionTypeConfigurationHandleServiceInstagram ObjectDefinitionsResponseFieldDefinitionTypeConfigurationHandleService = "INSTAGRAM"`

      - `MultipleValues bool`

        Whether this field accepts multiple values.

      - `Options []ObjectDefinitionsResponseFieldDefinitionTypeConfigurationOption`

        Available options for select fields.

        - `ID string`

          Unique identifier of the select option.

        - `Label string`

          Human-readable display name of the option.

        - `Description string`

          Description of the option, or null.

        - `ParentID string`

          For a dependent select, the ID of the option in the parent field named by `typeConfiguration.parentFieldKey` that owns this option. Absent for ordinary selects.

      - `ParentFieldKey string`

        For a dependent select, the field key whose selected option determines which of this field's options apply. Absent for ordinary selects.

      - `Unique bool`

        Whether values for this field must be unique.

    - `ValueType string`

      Data type of the field.

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeAddress ObjectDefinitionsResponseFieldDefinitionValueType = "ADDRESS"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeCheckbox ObjectDefinitionsResponseFieldDefinitionValueType = "CHECKBOX"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeCurrency ObjectDefinitionsResponseFieldDefinitionValueType = "CURRENCY"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeDatetime ObjectDefinitionsResponseFieldDefinitionValueType = "DATETIME"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeEmail ObjectDefinitionsResponseFieldDefinitionValueType = "EMAIL"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeFullName ObjectDefinitionsResponseFieldDefinitionValueType = "FULL_NAME"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeMarkdown ObjectDefinitionsResponseFieldDefinitionValueType = "MARKDOWN"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeMultiSelect ObjectDefinitionsResponseFieldDefinitionValueType = "MULTI_SELECT"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeNumber ObjectDefinitionsResponseFieldDefinitionValueType = "NUMBER"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeSingleSelect ObjectDefinitionsResponseFieldDefinitionValueType = "SINGLE_SELECT"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeSocialHandle ObjectDefinitionsResponseFieldDefinitionValueType = "SOCIAL_HANDLE"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeTelephone ObjectDefinitionsResponseFieldDefinitionValueType = "TELEPHONE"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeText ObjectDefinitionsResponseFieldDefinitionValueType = "TEXT"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeURL ObjectDefinitionsResponseFieldDefinitionValueType = "URL"`

      - `const ObjectDefinitionsResponseFieldDefinitionValueTypeHTML ObjectDefinitionsResponseFieldDefinitionValueType = "HTML"`

    - `ID string`

      Unique identifier of the field definition.

    - `ReadOnly bool`

      `true` for fields that are not writable via the API (e.g. AI-generated summaries). `false` or absent for writable fields.

  - `ObjectType string`

    The object type these definitions belong to (e.g. `account`).

  - `RelationshipDefinitions map[string, ObjectDefinitionsResponseRelationshipDefinition]`

    Map of relationship keys to their definitions. Self-referential relationships include optional directional metadata on the bare definition.

    - `Cardinality string`

      Whether this is a `has_one` or `has_many` relationship.

      - `const ObjectDefinitionsResponseRelationshipDefinitionCardinalityHasOne ObjectDefinitionsResponseRelationshipDefinitionCardinality = "HAS_ONE"`

      - `const ObjectDefinitionsResponseRelationshipDefinitionCardinalityHasMany ObjectDefinitionsResponseRelationshipDefinitionCardinality = "HAS_MANY"`

    - `Description string`

      Description of the relationship, or null.

    - `Label string`

      Human-readable display name of the relationship.

    - `ObjectType string`

      The type of the related object (e.g. `account`, `contact`).

    - `ID string`

      Unique identifier of the relationship definition.

    - `Directions ObjectDefinitionsResponseRelationshipDefinitionDirections`

      Directional metadata for a self-referential relationship. List filters use the relationship key with `:asSource` or `:asDestination`; writes continue to use the bare key.

      - `AsDestination ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsDestination`

        The current record is the destination (incoming) endpoint.

        - `Cardinality string`

          Whether this endpoint direction is `HAS_ONE` or `HAS_MANY`.

          - `const ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsDestinationCardinalityHasOne ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsDestinationCardinality = "HAS_ONE"`

          - `const ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsDestinationCardinalityHasMany ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsDestinationCardinality = "HAS_MANY"`

        - `Label string`

          Human-readable display name for this endpoint direction.

      - `AsSource ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsSource`

        The current record is the source (outgoing) endpoint.

        - `Cardinality string`

          Whether this endpoint direction is `HAS_ONE` or `HAS_MANY`.

          - `const ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsSourceCardinalityHasOne ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsSourceCardinality = "HAS_ONE"`

          - `const ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsSourceCardinalityHasMany ObjectDefinitionsResponseRelationshipDefinitionDirectionsAsSourceCardinality = "HAS_MANY"`

        - `Label string`

          Human-readable display name for this endpoint direction.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/Lightfld/lightfield-go"
  "github.com/Lightfld/lightfield-go/option"
)

func main() {
  client := githubcomlightfldlightfieldgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  objectDefinitionsResponse, err := client.Object.Definitions(context.TODO(), "entitySlug")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", objectDefinitionsResponse.FieldDefinitions)
}
```

#### Response

```json
{
  "fieldDefinitions": {
    "foo": {
      "description": "description",
      "label": "label",
      "typeConfiguration": {
        "currency": "currency",
        "handleService": "TWITTER",
        "multipleValues": true,
        "options": [
          {
            "id": "id",
            "label": "label",
            "description": "description",
            "parentId": "parentId"
          }
        ],
        "parentFieldKey": "parentFieldKey",
        "unique": true
      },
      "valueType": "ADDRESS",
      "id": "id",
      "readOnly": true
    }
  },
  "objectType": "objectType",
  "relationshipDefinitions": {
    "foo": {
      "cardinality": "HAS_ONE",
      "description": "description",
      "label": "label",
      "objectType": "objectType",
      "id": "id",
      "directions": {
        "asDestination": {
          "cardinality": "HAS_ONE",
          "label": "label"
        },
        "asSource": {
          "cardinality": "HAS_ONE",
          "label": "label"
        }
      }
    }
  }
}
```
