Skip to content

Get field value history

client.Contact.FieldHistory(ctx, fieldKey, params) (*ContactFieldHistoryResponse, error)
GET/v1/contacts/{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: contacts:read

Rate limit category: Read

ParametersExpand Collapse
fieldKey string

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

params ContactFieldHistoryParams
ID param.Field[string]

Path param: Unique identifier of the record.

After param.Field[string]Optional

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

Limit param.Field[int64]Optional

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

minimum1
maximum9007199254740991
ReturnsExpand Collapse
type ContactFieldHistoryResponse struct{…}
Data []ContactFieldHistoryResponseData

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 bool

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 ContactFieldHistoryResponseDataValueUnion

The field value, or null if unset.

One of the following:
string
float64
bool
type ContactFieldHistoryResponseDataValueArray []string
type ContactFieldHistoryResponseDataValueAddress struct{…}
City stringOptional

City name.

Country stringOptional

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

Latitude float64Optional

Latitude coordinate.

Longitude float64Optional

Longitude coordinate.

PostalCode stringOptional

Postal or ZIP code.

State stringOptional

State or province.

Street stringOptional

Street address line 1.

Street2 stringOptional

Street address line 2.

type ContactFieldHistoryResponseDataValueFullName struct{…}
FirstName stringOptional

The contact’s first name.

LastName stringOptional

The contact’s last name.

ValueType string

The data type of the field.

One of the following:
const ContactFieldHistoryResponseDataValueTypeAddress ContactFieldHistoryResponseDataValueType = "ADDRESS"
const ContactFieldHistoryResponseDataValueTypeCheckbox ContactFieldHistoryResponseDataValueType = "CHECKBOX"
const ContactFieldHistoryResponseDataValueTypeCurrency ContactFieldHistoryResponseDataValueType = "CURRENCY"
const ContactFieldHistoryResponseDataValueTypeDatetime ContactFieldHistoryResponseDataValueType = "DATETIME"
const ContactFieldHistoryResponseDataValueTypeEmail ContactFieldHistoryResponseDataValueType = "EMAIL"
const ContactFieldHistoryResponseDataValueTypeFullName ContactFieldHistoryResponseDataValueType = "FULL_NAME"
const ContactFieldHistoryResponseDataValueTypeMarkdown ContactFieldHistoryResponseDataValueType = "MARKDOWN"
const ContactFieldHistoryResponseDataValueTypeMultiSelect ContactFieldHistoryResponseDataValueType = "MULTI_SELECT"
const ContactFieldHistoryResponseDataValueTypeNumber ContactFieldHistoryResponseDataValueType = "NUMBER"
const ContactFieldHistoryResponseDataValueTypeSingleSelect ContactFieldHistoryResponseDataValueType = "SINGLE_SELECT"
const ContactFieldHistoryResponseDataValueTypeSocialHandle ContactFieldHistoryResponseDataValueType = "SOCIAL_HANDLE"
const ContactFieldHistoryResponseDataValueTypeTelephone ContactFieldHistoryResponseDataValueType = "TELEPHONE"
const ContactFieldHistoryResponseDataValueTypeText ContactFieldHistoryResponseDataValueType = "TEXT"
const ContactFieldHistoryResponseDataValueTypeURL ContactFieldHistoryResponseDataValueType = "URL"
const ContactFieldHistoryResponseDataValueTypeHTML ContactFieldHistoryResponseDataValueType = "HTML"
HasMore bool

Whether more history exists beyond this page.

NextCursor string

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

Get field value history

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"),
  )
  contactFieldHistoryResponse, err := client.Contact.FieldHistory(
    context.TODO(),
    "fieldKey",
    githubcomlightfldlightfieldgo.ContactFieldHistoryParams{
      ID: "id",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", contactFieldHistoryResponse.Data)
}
{
  "data": [
    {
      "displayValue": "displayValue",
      "isCreate": true,
      "recordedAt": "recordedAt",
      "value": "string",
      "valueType": "ADDRESS"
    }
  ],
  "hasMore": true,
  "nextCursor": "nextCursor"
}
Returns Examples
{
  "data": [
    {
      "displayValue": "displayValue",
      "isCreate": true,
      "recordedAt": "recordedAt",
      "value": "string",
      "valueType": "ADDRESS"
    }
  ],
  "hasMore": true,
  "nextCursor": "nextCursor"
}