Skip to content

Update a contact

client.Contact.Update(ctx, id, body) (*ContactUpdateResponse, error)
POST/v1/contacts/{id}

Updates an existing contact by ID. Only included fields and relationships are modified.

Supports idempotency via the Idempotency-Key header.

Required scope: contacts:update

Rate limit category: Write

ParametersExpand Collapse
id string

Unique identifier of the contact to update.

body ContactUpdateParams
Fields param.Field[map[string, ContactUpdateParamsFieldUnion]]Optional

Field values to update — only provided fields are modified; omitted fields are left unchanged. System fields use a $ prefix (e.g. $email); custom attributes use their bare slug. Note: $name is an object { firstName, lastName }, not a plain string. Call the definitions endpoint for available fields and types. See Fields and relationships for value type details.

map[string, ContactUpdateParamsFieldUnion]
One of the following:
string
float64
bool
type ContactUpdateParamsFieldArray []string
type ContactUpdateParamsFieldAddress 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 ContactUpdateParamsFieldFullName struct{…}
FirstName stringOptional

The contact’s first name.

LastName stringOptional

The contact’s last name.

Relationships param.Field[map[string, ContactUpdateParamsRelationship]]Optional

Relationship operations to apply. System relationships use a $ prefix (e.g. $account). Each value is an operation object with add, remove, or replace.

map[string, ContactUpdateParamsRelationship]
Add ContactUpdateParamsRelationshipAddUnionOptional

Entity ID(s) to add to the relationship.

One of the following:
string
type ContactUpdateParamsRelationshipAddArray []string
Remove ContactUpdateParamsRelationshipRemoveUnionOptional

Entity ID(s) to remove from the relationship.

One of the following:
string
type ContactUpdateParamsRelationshipRemoveArray []string
Replace ContactUpdateParamsRelationshipReplaceUnionOptional

Entity ID(s) to set as the entire relationship, replacing all existing associations.

One of the following:
string
type ContactUpdateParamsRelationshipReplaceArray []string
ReturnsExpand Collapse
type ContactUpdateResponse struct{…}
ID string

Unique identifier for the entity.

CreatedAt string

ISO 8601 timestamp of when the entity was created.

Fields map[string, ContactUpdateResponseField]

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

Value ContactUpdateResponseFieldValueUnion

The field value, or null if unset.

One of the following:
string
float64
bool
type ContactUpdateResponseFieldValueArray []string
type ContactUpdateResponseFieldValueAddress 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 ContactUpdateResponseFieldValueFullName 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 ContactUpdateResponseFieldValueTypeAddress ContactUpdateResponseFieldValueType = "ADDRESS"
const ContactUpdateResponseFieldValueTypeCheckbox ContactUpdateResponseFieldValueType = "CHECKBOX"
const ContactUpdateResponseFieldValueTypeCurrency ContactUpdateResponseFieldValueType = "CURRENCY"
const ContactUpdateResponseFieldValueTypeDatetime ContactUpdateResponseFieldValueType = "DATETIME"
const ContactUpdateResponseFieldValueTypeEmail ContactUpdateResponseFieldValueType = "EMAIL"
const ContactUpdateResponseFieldValueTypeFullName ContactUpdateResponseFieldValueType = "FULL_NAME"
const ContactUpdateResponseFieldValueTypeMarkdown ContactUpdateResponseFieldValueType = "MARKDOWN"
const ContactUpdateResponseFieldValueTypeMultiSelect ContactUpdateResponseFieldValueType = "MULTI_SELECT"
const ContactUpdateResponseFieldValueTypeNumber ContactUpdateResponseFieldValueType = "NUMBER"
const ContactUpdateResponseFieldValueTypeSingleSelect ContactUpdateResponseFieldValueType = "SINGLE_SELECT"
const ContactUpdateResponseFieldValueTypeSocialHandle ContactUpdateResponseFieldValueType = "SOCIAL_HANDLE"
const ContactUpdateResponseFieldValueTypeTelephone ContactUpdateResponseFieldValueType = "TELEPHONE"
const ContactUpdateResponseFieldValueTypeText ContactUpdateResponseFieldValueType = "TEXT"
const ContactUpdateResponseFieldValueTypeURL ContactUpdateResponseFieldValueType = "URL"
Relationships map[string, ContactUpdateResponseRelationship]

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 []string

IDs of the related entities.

UpdatedAt string

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

ExternalID stringOptional

External identifier for the entity, or null if unset.

Update a contact

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"),
  )
  contactUpdateResponse, err := client.Contact.Update(
    context.TODO(),
    "id",
    githubcomlightfldlightfieldgo.ContactUpdateParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", contactUpdateResponse.ID)
}
{
  "id": "id",
  "createdAt": "createdAt",
  "fields": {
    "foo": {
      "value": "string",
      "valueType": "ADDRESS"
    }
  },
  "httpLink": "httpLink",
  "relationships": {
    "foo": {
      "cardinality": "cardinality",
      "objectType": "objectType",
      "values": [
        "string"
      ]
    }
  },
  "updatedAt": "updatedAt",
  "externalId": "externalId"
}
Returns Examples
{
  "id": "id",
  "createdAt": "createdAt",
  "fields": {
    "foo": {
      "value": "string",
      "valueType": "ADDRESS"
    }
  },
  "httpLink": "httpLink",
  "relationships": {
    "foo": {
      "cardinality": "cardinality",
      "objectType": "objectType",
      "values": [
        "string"
      ]
    }
  },
  "updatedAt": "updatedAt",
  "externalId": "externalId"
}