# Custom Object

## Create a custom object record

`client.customObject.create(stringentitySlug, CustomObjectCreateParamsbody, RequestOptionsoptions?): ObjectCreateResponse`

**post** `/v1/objects/{entitySlug}/values`

Creates a new record for the specified custom object type.

### Parameters

- `entitySlug: string`

  The slug of the custom object type.

- `body: CustomObjectCreateParams`

  - `fields: Record<string, string | number | boolean | 3 more | null>`

    Field names to values for the new record.

    - `string`

    - `number`

    - `boolean`

    - `Array<string>`

    - `Address`

      - `city?: string | null`

        City name.

      - `country?: string | null`

        2-letter ISO 3166-1 alpha-2 country code.

      - `latitude?: number | null`

        Latitude coordinate.

      - `longitude?: number | null`

        Longitude coordinate.

      - `postalCode?: string | null`

        Postal or ZIP code.

      - `state?: string | null`

        State or province.

      - `street?: string | null`

        Street address line 1.

      - `street2?: string | null`

        Street address line 2.

    - `FullName`

      - `firstName?: string | null`

        The contact's first name.

      - `lastName?: string | null`

        The contact's last name.

  - `relationships?: Record<string, string | Array<string>>`

    Relationship names to entity ID(s) to associate.

    - `string`

    - `Array<string>`

### Returns

- `ObjectCreateResponse`

  - `id: string`

    Unique identifier for the entity.

  - `createdAt: string`

    ISO 8601 timestamp of when the entity was created.

  - `fields: Record<string, Fields>`

    Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `httpLink: string | null`

    URL to view the entity in the Lightfield web app, or null.

  - `relationships: Record<string, Relationships>`

    Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

    - `cardinality: string`

      Whether the relationship is `has_one` or `has_many`.

    - `objectType: string`

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

    - `values: Array<string>`

      IDs of the related entities.

  - `updatedAt: string | null`

    ISO 8601 timestamp of when the entity was last updated, or null.

  - `externalId?: string | null`

    External identifier for the entity, or null if unset.

### Example

```typescript
import Lightfield from 'lightfield';

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

const customObject = await client.customObject.create('entitySlug', { fields: { foo: 'string' } });

console.log(customObject.id);
```

#### Response

```json
{
  "id": "id",
  "createdAt": "createdAt",
  "fields": {
    "foo": {
      "value": "string",
      "valueType": "ADDRESS"
    }
  },
  "httpLink": "httpLink",
  "relationships": {
    "foo": {
      "cardinality": "cardinality",
      "objectType": "objectType",
      "values": [
        "string"
      ]
    }
  },
  "updatedAt": "updatedAt",
  "externalId": "externalId"
}
```

## Get a custom object record

`client.customObject.retrieve(stringid, CustomObjectRetrieveParamsparams, RequestOptionsoptions?): ObjectRetrieveResponse`

**get** `/v1/objects/{entitySlug}/values/{id}`

Retrieves a single record by ID for the specified custom object type.

### Parameters

- `id: string`

  The ID of the record to retrieve.

- `params: CustomObjectRetrieveParams`

  - `entitySlug: string`

    The slug of the custom object type.

### Returns

- `ObjectRetrieveResponse`

  - `id: string`

    Unique identifier for the entity.

  - `createdAt: string`

    ISO 8601 timestamp of when the entity was created.

  - `fields: Record<string, Fields>`

    Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `httpLink: string | null`

    URL to view the entity in the Lightfield web app, or null.

  - `relationships: Record<string, Relationships>`

    Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

    - `cardinality: string`

      Whether the relationship is `has_one` or `has_many`.

    - `objectType: string`

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

    - `values: Array<string>`

      IDs of the related entities.

  - `updatedAt: string | null`

    ISO 8601 timestamp of when the entity was last updated, or null.

  - `externalId?: string | null`

    External identifier for the entity, or null if unset.

### Example

```typescript
import Lightfield from 'lightfield';

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

const customObject = await client.customObject.retrieve('id', { entitySlug: 'entitySlug' });

console.log(customObject.id);
```

#### Response

```json
{
  "id": "id",
  "createdAt": "createdAt",
  "fields": {
    "foo": {
      "value": "string",
      "valueType": "ADDRESS"
    }
  },
  "httpLink": "httpLink",
  "relationships": {
    "foo": {
      "cardinality": "cardinality",
      "objectType": "objectType",
      "values": [
        "string"
      ]
    }
  },
  "updatedAt": "updatedAt",
  "externalId": "externalId"
}
```

## Update a custom object record

`client.customObject.update(stringid, CustomObjectUpdateParamsparams, RequestOptionsoptions?): ObjectUpdateResponse`

**post** `/v1/objects/{entitySlug}/values/{id}`

Updates an existing record by ID for the specified custom object type. Only included fields and relationships are modified.

### Parameters

- `id: string`

  The ID of the record to update.

- `params: CustomObjectUpdateParams`

  - `entitySlug: string`

    Path param: The slug of the custom object type.

  - `fields?: Record<string, string | number | boolean | 3 more | null>`

    Body param: Field names to values. Only provided fields are modified.

    - `string`

    - `number`

    - `boolean`

    - `Array<string>`

    - `Address`

      - `city?: string | null`

        City name.

      - `country?: string | null`

        2-letter ISO 3166-1 alpha-2 country code.

      - `latitude?: number | null`

        Latitude coordinate.

      - `longitude?: number | null`

        Longitude coordinate.

      - `postalCode?: string | null`

        Postal or ZIP code.

      - `state?: string | null`

        State or province.

      - `street?: string | null`

        Street address line 1.

      - `street2?: string | null`

        Street address line 2.

    - `FullName`

      - `firstName?: string | null`

        The contact's first name.

      - `lastName?: string | null`

        The contact's last name.

  - `relationships?: Record<string, Relationships>`

    Body param: Relationship names to operations (`add`, `remove`, or `replace`).

    - `add?: string | Array<string>`

      Entity ID(s) to add to the relationship.

      - `string`

      - `Array<string>`

    - `remove?: string | Array<string>`

      Entity ID(s) to remove from the relationship.

      - `string`

      - `Array<string>`

    - `replace?: string | null`

      The entity ID to set as the relationship replacement, or null to clear supported relationships.

### Returns

- `ObjectUpdateResponse`

  - `id: string`

    Unique identifier for the entity.

  - `createdAt: string`

    ISO 8601 timestamp of when the entity was created.

  - `fields: Record<string, Fields>`

    Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `httpLink: string | null`

    URL to view the entity in the Lightfield web app, or null.

  - `relationships: Record<string, Relationships>`

    Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

    - `cardinality: string`

      Whether the relationship is `has_one` or `has_many`.

    - `objectType: string`

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

    - `values: Array<string>`

      IDs of the related entities.

  - `updatedAt: string | null`

    ISO 8601 timestamp of when the entity was last updated, or null.

  - `externalId?: string | null`

    External identifier for the entity, or null if unset.

### Example

```typescript
import Lightfield from 'lightfield';

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

const customObject = await client.customObject.update('id', { entitySlug: 'entitySlug' });

console.log(customObject.id);
```

#### Response

```json
{
  "id": "id",
  "createdAt": "createdAt",
  "fields": {
    "foo": {
      "value": "string",
      "valueType": "ADDRESS"
    }
  },
  "httpLink": "httpLink",
  "relationships": {
    "foo": {
      "cardinality": "cardinality",
      "objectType": "objectType",
      "values": [
        "string"
      ]
    }
  },
  "updatedAt": "updatedAt",
  "externalId": "externalId"
}
```

## Delete a custom object record

`client.customObject.delete(stringid, CustomObjectDeleteParamsparams, RequestOptionsoptions?): ObjectDeleteResponse`

**delete** `/v1/objects/{entitySlug}/values/{id}`

Moves a custom object record to the trash. The record is soft-deleted and may be restored from the Lightfield UI.

Calling delete on an already-trashed record is a no-op and returns the existing record.

**[Required scope](/using-the-api/scopes/):** `custom_objects:delete`

**[Rate limit category](/using-the-api/rate-limits/):** Write

### Parameters

- `id: string`

  The ID of the record to delete.

- `params: CustomObjectDeleteParams`

  - `entitySlug: string`

    Path param: The slug of the custom object type.

  - `body?: Body`

    Body param

### Returns

- `ObjectDeleteResponse`

  - `id: string`

    Unique identifier for the entity.

  - `createdAt: string`

    ISO 8601 timestamp of when the entity was created.

  - `fields: Record<string, Fields>`

    Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `httpLink: string | null`

    URL to view the entity in the Lightfield web app, or null.

  - `relationships: Record<string, Relationships>`

    Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

    - `cardinality: string`

      Whether the relationship is `has_one` or `has_many`.

    - `objectType: string`

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

    - `values: Array<string>`

      IDs of the related entities.

  - `updatedAt: string | null`

    ISO 8601 timestamp of when the entity was last updated, or null.

  - `externalId?: string | null`

    External identifier for the entity, or null if unset.

### Example

```typescript
import Lightfield from 'lightfield';

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

const customObject = await client.customObject.delete('id', { entitySlug: 'entitySlug' });

console.log(customObject.id);
```

#### Response

```json
{
  "id": "id",
  "createdAt": "createdAt",
  "fields": {
    "foo": {
      "value": "string",
      "valueType": "ADDRESS"
    }
  },
  "httpLink": "httpLink",
  "relationships": {
    "foo": {
      "cardinality": "cardinality",
      "objectType": "objectType",
      "values": [
        "string"
      ]
    }
  },
  "updatedAt": "updatedAt",
  "externalId": "externalId"
}
```

## List custom object records

`client.customObject.list(stringentitySlug, CustomObjectListParamsquery?, RequestOptionsoptions?): ObjectListResponse`

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

Returns a paginated list of records for the specified custom object type. Use `offset` and `limit` to paginate through results, and `$field` query parameters to filter. See <u>[List endpoints](/using-the-api/list-endpoints/)</u> for more information about <u>[pagination](/using-the-api/list-endpoints/#pagination)</u> and <u>[filtering](/using-the-api/list-endpoints/#filtering)</u>.

### Parameters

- `entitySlug: string`

  The slug of the custom object type.

- `query: CustomObjectListParams`

  - `limit?: number`

    Maximum number of records to return. Defaults to 25, maximum 25.

  - `offset?: number`

    Number of records to skip for pagination. Defaults to 0.

### Returns

- `ObjectListResponse`

  - `data: Array<Data>`

    Array of entity objects for the current page.

    - `id: string`

      Unique identifier for the entity.

    - `createdAt: string`

      ISO 8601 timestamp of when the entity was created.

    - `fields: Record<string, Fields>`

      Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

      - `value: string | number | boolean | 3 more | null`

        The field value, or null if unset.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

        - `Address`

          - `city?: string | null`

            City name.

          - `country?: string | null`

            2-letter ISO 3166-1 alpha-2 country code.

          - `latitude?: number | null`

            Latitude coordinate.

          - `longitude?: number | null`

            Longitude coordinate.

          - `postalCode?: string | null`

            Postal or ZIP code.

          - `state?: string | null`

            State or province.

          - `street?: string | null`

            Street address line 1.

          - `street2?: string | null`

            Street address line 2.

        - `FullName`

          - `firstName?: string | null`

            The contact's first name.

          - `lastName?: string | null`

            The contact's last name.

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

        The data type of the field.

        - `"ADDRESS"`

        - `"CHECKBOX"`

        - `"CURRENCY"`

        - `"DATETIME"`

        - `"EMAIL"`

        - `"FULL_NAME"`

        - `"MARKDOWN"`

        - `"MULTI_SELECT"`

        - `"NUMBER"`

        - `"SINGLE_SELECT"`

        - `"SOCIAL_HANDLE"`

        - `"TELEPHONE"`

        - `"TEXT"`

        - `"URL"`

        - `"HTML"`

    - `httpLink: string | null`

      URL to view the entity in the Lightfield web app, or null.

    - `relationships: Record<string, Relationships>`

      Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

      - `cardinality: string`

        Whether the relationship is `has_one` or `has_many`.

      - `objectType: string`

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

      - `values: Array<string>`

        IDs of the related entities.

    - `updatedAt: string | null`

      ISO 8601 timestamp of when the entity was last updated, or null.

    - `externalId?: string | null`

      External identifier for the entity, or null if unset.

  - `object: string`

    The object type, always `"list"`.

  - `totalCount: number`

    Total number of entities matching the query.

### Example

```typescript
import Lightfield from 'lightfield';

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

const customObjects = await client.customObject.list('entitySlug');

console.log(customObjects.data);
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "createdAt": "createdAt",
      "fields": {
        "foo": {
          "value": "string",
          "valueType": "ADDRESS"
        }
      },
      "httpLink": "httpLink",
      "relationships": {
        "foo": {
          "cardinality": "cardinality",
          "objectType": "objectType",
          "values": [
            "string"
          ]
        }
      },
      "updatedAt": "updatedAt",
      "externalId": "externalId"
    }
  ],
  "object": "object",
  "totalCount": 0
}
```

## Get definitions for a custom object type

`client.customObject.definitions(stringentitySlug, RequestOptionsoptions?): ObjectDefinitionsResponse`

**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

- `ObjectDefinitionsResponse`

  - `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`

      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.

        - `"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.

      - `unique?: boolean`

        Whether values for this field must be unique.

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

      Data type of the field.

      - `"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.

    - `cardinality: "HAS_ONE" | "HAS_MANY"`

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

      - `"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.

### Example

```typescript
import Lightfield from 'lightfield';

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

const response = await client.customObject.definitions('entitySlug');

console.log(response.fieldDefinitions);
```

#### Response

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

## List custom object types

`client.customObject.listDefinitions(RequestOptionsoptions?): ObjectListDefinitionsResponse`

**get** `/v1/objects`

Returns all custom object types available to the caller.

### Returns

- `ObjectListDefinitionsResponse`

  - `data: Array<Data>`

    All object types available to the caller.

    - `label: string`

      Human-readable display name.

    - `objectType: string`

      The slug used to reference this object type in the API.

### Example

```typescript
import Lightfield from 'lightfield';

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

const response = await client.customObject.listDefinitions();

console.log(response.data);
```

#### Response

```json
{
  "data": [
    {
      "label": "label",
      "objectType": "objectType"
    }
  ]
}
```

## Get field value history for a custom object record

`client.customObject.fieldHistory(stringfieldKey, CustomObjectFieldHistoryParamsparams, RequestOptionsoptions?): ObjectFieldHistoryResponse`

**get** `/v1/objects/{entitySlug}/values/{id}/fields/{fieldKey}/history`

Returns the value-change history for a single field on a record, newest first. Consecutive identical values are collapsed. History is cursor-paginated: pass `nextCursor` from the previous response as `after` to page through older values. Only attribute-backed fields (custom attributes and attribute-backed system fields) have history — column-backed system fields return an error.

**[Required scope](/using-the-api/scopes/):** `custom_objects:read`

**[Rate limit category](/using-the-api/rate-limits/):** Read

### Parameters

- `fieldKey: string`

  Field key whose value history to return. System fields use a `$` prefix (e.g. `$status`); custom attributes use their bare slug.

- `params: CustomObjectFieldHistoryParams`

  - `entitySlug: string`

    Path param: The slug of the custom object type.

  - `id: string`

    Path param: Unique identifier of the record.

  - `after?: string`

    Query param: Cursor from a previous response’s `nextCursor` to fetch the next page.

  - `limit?: number`

    Query param: Maximum number of history entries to return. Defaults to 20, maximum 100.

### Returns

- `ObjectFieldHistoryResponse`

  - `data: Array<Data>`

    Recorded values for the field, newest first.

    - `displayValue: string`

      Human-readable rendering of the value (e.g. a select option label), suitable for display.

    - `isCreate: boolean`

      True for the record’s original value. Only set when the full history fits in the response (never on a truncated/paginated page).

    - `recordedAt: string`

      ISO 8601 timestamp of when this value was recorded.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `hasMore: boolean`

    Whether more history exists beyond this page.

  - `nextCursor: string | null`

    Cursor to pass as `after` to fetch the next page, or null when there are no more entries.

### Example

```typescript
import Lightfield from 'lightfield';

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

const response = await client.customObject.fieldHistory('fieldKey', {
  entitySlug: 'entitySlug',
  id: 'id',
});

console.log(response.data);
```

#### Response

```json
{
  "data": [
    {
      "displayValue": "displayValue",
      "isCreate": true,
      "recordedAt": "recordedAt",
      "value": "string",
      "valueType": "ADDRESS"
    }
  ],
  "hasMore": true,
  "nextCursor": "nextCursor"
}
```

## Domain Types

### Custom Object Create Response

- `CustomObjectCreateResponse`

  - `id: string`

    Unique identifier for the entity.

  - `createdAt: string`

    ISO 8601 timestamp of when the entity was created.

  - `fields: Record<string, Fields>`

    Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `httpLink: string | null`

    URL to view the entity in the Lightfield web app, or null.

  - `relationships: Record<string, Relationships>`

    Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

    - `cardinality: string`

      Whether the relationship is `has_one` or `has_many`.

    - `objectType: string`

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

    - `values: Array<string>`

      IDs of the related entities.

  - `updatedAt: string | null`

    ISO 8601 timestamp of when the entity was last updated, or null.

  - `externalId?: string | null`

    External identifier for the entity, or null if unset.

### Custom Object Definitions Response

- `CustomObjectDefinitionsResponse`

  - `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`

      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.

        - `"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.

      - `unique?: boolean`

        Whether values for this field must be unique.

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

      Data type of the field.

      - `"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.

    - `cardinality: "HAS_ONE" | "HAS_MANY"`

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

      - `"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.

### Custom Object Delete Response

- `CustomObjectDeleteResponse`

  - `id: string`

    Unique identifier for the entity.

  - `createdAt: string`

    ISO 8601 timestamp of when the entity was created.

  - `fields: Record<string, Fields>`

    Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `httpLink: string | null`

    URL to view the entity in the Lightfield web app, or null.

  - `relationships: Record<string, Relationships>`

    Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

    - `cardinality: string`

      Whether the relationship is `has_one` or `has_many`.

    - `objectType: string`

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

    - `values: Array<string>`

      IDs of the related entities.

  - `updatedAt: string | null`

    ISO 8601 timestamp of when the entity was last updated, or null.

  - `externalId?: string | null`

    External identifier for the entity, or null if unset.

### Custom Object Field History Response

- `CustomObjectFieldHistoryResponse`

  - `data: Array<Data>`

    Recorded values for the field, newest first.

    - `displayValue: string`

      Human-readable rendering of the value (e.g. a select option label), suitable for display.

    - `isCreate: boolean`

      True for the record’s original value. Only set when the full history fits in the response (never on a truncated/paginated page).

    - `recordedAt: string`

      ISO 8601 timestamp of when this value was recorded.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `hasMore: boolean`

    Whether more history exists beyond this page.

  - `nextCursor: string | null`

    Cursor to pass as `after` to fetch the next page, or null when there are no more entries.

### Custom Object List Definitions Response

- `CustomObjectListDefinitionsResponse`

  - `data: Array<Data>`

    All object types available to the caller.

    - `label: string`

      Human-readable display name.

    - `objectType: string`

      The slug used to reference this object type in the API.

### Custom Object List Response

- `CustomObjectListResponse`

  - `data: Array<Data>`

    Array of entity objects for the current page.

    - `id: string`

      Unique identifier for the entity.

    - `createdAt: string`

      ISO 8601 timestamp of when the entity was created.

    - `fields: Record<string, Fields>`

      Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

      - `value: string | number | boolean | 3 more | null`

        The field value, or null if unset.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

        - `Address`

          - `city?: string | null`

            City name.

          - `country?: string | null`

            2-letter ISO 3166-1 alpha-2 country code.

          - `latitude?: number | null`

            Latitude coordinate.

          - `longitude?: number | null`

            Longitude coordinate.

          - `postalCode?: string | null`

            Postal or ZIP code.

          - `state?: string | null`

            State or province.

          - `street?: string | null`

            Street address line 1.

          - `street2?: string | null`

            Street address line 2.

        - `FullName`

          - `firstName?: string | null`

            The contact's first name.

          - `lastName?: string | null`

            The contact's last name.

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

        The data type of the field.

        - `"ADDRESS"`

        - `"CHECKBOX"`

        - `"CURRENCY"`

        - `"DATETIME"`

        - `"EMAIL"`

        - `"FULL_NAME"`

        - `"MARKDOWN"`

        - `"MULTI_SELECT"`

        - `"NUMBER"`

        - `"SINGLE_SELECT"`

        - `"SOCIAL_HANDLE"`

        - `"TELEPHONE"`

        - `"TEXT"`

        - `"URL"`

        - `"HTML"`

    - `httpLink: string | null`

      URL to view the entity in the Lightfield web app, or null.

    - `relationships: Record<string, Relationships>`

      Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

      - `cardinality: string`

        Whether the relationship is `has_one` or `has_many`.

      - `objectType: string`

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

      - `values: Array<string>`

        IDs of the related entities.

    - `updatedAt: string | null`

      ISO 8601 timestamp of when the entity was last updated, or null.

    - `externalId?: string | null`

      External identifier for the entity, or null if unset.

  - `object: string`

    The object type, always `"list"`.

  - `totalCount: number`

    Total number of entities matching the query.

### Custom Object Retrieve Response

- `CustomObjectRetrieveResponse`

  - `id: string`

    Unique identifier for the entity.

  - `createdAt: string`

    ISO 8601 timestamp of when the entity was created.

  - `fields: Record<string, Fields>`

    Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `httpLink: string | null`

    URL to view the entity in the Lightfield web app, or null.

  - `relationships: Record<string, Relationships>`

    Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

    - `cardinality: string`

      Whether the relationship is `has_one` or `has_many`.

    - `objectType: string`

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

    - `values: Array<string>`

      IDs of the related entities.

  - `updatedAt: string | null`

    ISO 8601 timestamp of when the entity was last updated, or null.

  - `externalId?: string | null`

    External identifier for the entity, or null if unset.

### Custom Object Update Response

- `CustomObjectUpdateResponse`

  - `id: string`

    Unique identifier for the entity.

  - `createdAt: string`

    ISO 8601 timestamp of when the entity was created.

  - `fields: Record<string, Fields>`

    Map of field names to their typed values. System fields are prefixed with `$` (e.g. `$name`, `$email`); custom attributes use their bare slug.

    - `value: string | number | boolean | 3 more | null`

      The field value, or null if unset.

      - `string`

      - `number`

      - `boolean`

      - `Array<string>`

      - `Address`

        - `city?: string | null`

          City name.

        - `country?: string | null`

          2-letter ISO 3166-1 alpha-2 country code.

        - `latitude?: number | null`

          Latitude coordinate.

        - `longitude?: number | null`

          Longitude coordinate.

        - `postalCode?: string | null`

          Postal or ZIP code.

        - `state?: string | null`

          State or province.

        - `street?: string | null`

          Street address line 1.

        - `street2?: string | null`

          Street address line 2.

      - `FullName`

        - `firstName?: string | null`

          The contact's first name.

        - `lastName?: string | null`

          The contact's last name.

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

      The data type of the field.

      - `"ADDRESS"`

      - `"CHECKBOX"`

      - `"CURRENCY"`

      - `"DATETIME"`

      - `"EMAIL"`

      - `"FULL_NAME"`

      - `"MARKDOWN"`

      - `"MULTI_SELECT"`

      - `"NUMBER"`

      - `"SINGLE_SELECT"`

      - `"SOCIAL_HANDLE"`

      - `"TELEPHONE"`

      - `"TEXT"`

      - `"URL"`

      - `"HTML"`

  - `httpLink: string | null`

    URL to view the entity in the Lightfield web app, or null.

  - `relationships: Record<string, Relationships>`

    Map of relationship names to their associated entities. System relationships are prefixed with `$` (e.g. `$owner`, `$contact`).

    - `cardinality: string`

      Whether the relationship is `has_one` or `has_many`.

    - `objectType: string`

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

    - `values: Array<string>`

      IDs of the related entities.

  - `updatedAt: string | null`

    ISO 8601 timestamp of when the entity was last updated, or null.

  - `externalId?: string | null`

    External identifier for the entity, or null if unset.
