Skip to content

Get account field definitions

client.account.definitions(RequestOptionsoptions?): AccountDefinitionsResponse { fieldDefinitions, objectType, relationshipDefinitions }
GET/v1/accounts/definitions

Returns the schema for all field and relationship definitions available on accounts, including both system-defined and custom fields. Useful for understanding the shape of account data before creating or updating records. See Fields and relationships for more details.

Required scope: accounts:read

Rate limit category: Read

ReturnsExpand Collapse
AccountDefinitionsResponse { fieldDefinitions, objectType, relationshipDefinitions }
fieldDefinitions: Record<string, FieldDefinitions>

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

description: string | null

Description of the field, or null.

label: string

Human-readable display name of the field.

typeConfiguration: TypeConfiguration { currency, handleService, multipleValues, 3 more }

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

currency?: string

ISO 4217 3-letter currency code.

handleService?: "TWITTER" | "LINKEDIN" | "FACEBOOK" | "INSTAGRAM"

Social platform associated with this handle field.

One of the following:
"TWITTER"
"LINKEDIN"
"FACEBOOK"
"INSTAGRAM"
multipleValues?: boolean

Whether this field accepts multiple values.

options?: Array<Option>

Available options for select fields.

id: string

Unique identifier of the select option.

label: string

Human-readable display name of the option.

description?: string | null

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?: boolean

Whether values for this field must be unique.

valueType: "ADDRESS" | "CHECKBOX" | "CURRENCY" | 12 more

Data type of the field.

One of the following:
"ADDRESS"
"CHECKBOX"
"CURRENCY"
"DATETIME"
"EMAIL"
"FULL_NAME"
"MARKDOWN"
"MULTI_SELECT"
"NUMBER"
"SINGLE_SELECT"
"SOCIAL_HANDLE"
"TELEPHONE"
"TEXT"
"URL"
"HTML"
id?: string

Unique identifier of the field definition.

readOnly?: boolean

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: Record<string, RelationshipDefinitions>

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

cardinality: "HAS_ONE" | "HAS_MANY"

Whether this is a has_one or has_many relationship.

One of the following:
"HAS_ONE"
"HAS_MANY"
description: string | null

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?: Directions { asDestination, asSource }

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: AsDestination { cardinality, label }

The current record is the destination (incoming) endpoint.

cardinality: "HAS_ONE" | "HAS_MANY"

Whether this endpoint direction is HAS_ONE or HAS_MANY.

One of the following:
"HAS_ONE"
"HAS_MANY"
label: string

Human-readable display name for this endpoint direction.

asSource: AsSource { cardinality, label }

The current record is the source (outgoing) endpoint.

cardinality: "HAS_ONE" | "HAS_MANY"

Whether this endpoint direction is HAS_ONE or HAS_MANY.

One of the following:
"HAS_ONE"
"HAS_MANY"
label: string

Human-readable display name for this endpoint direction.

Get account field definitions

import Lightfield from 'lightfield';

const client = new Lightfield({
  apiKey: 'My API Key',
});

const accountDefinitionsResponse = await client.account.definitions();

console.log(accountDefinitionsResponse.fieldDefinitions);
{
  "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"
        }
      }
    }
  }
}
Returns Examples
{
  "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"
        }
      }
    }
  }
}