Skip to content

Update an account

client.Account.Update(ctx, id, body) (*AccountUpdateResponse, error)
POST/v1/accounts/{id}

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

The $howTheyMakeMoney and $accountStatus fields are read-only and cannot be updated. The $opportunity, $task, and $note relationships are also read-only — manage them via the $account relationship on the opportunity or task, or the $account/$opportunity note relationships instead.

Supports idempotency via the Idempotency-Key header.

Required scope: accounts:update

Rate limit category: Write

ParametersExpand Collapse
id string

Unique identifier of the account to update.

body AccountUpdateParams
Fields param.Field[map[string, AccountUpdateParamsFieldUnion]]Optional

Field values to update — only provided fields are modified; omitted fields are left unchanged. System fields use a $ prefix (e.g. $name); custom attributes use their bare slug. SINGLE_SELECT and MULTI_SELECT fields accept an option ID or label — call the definitions endpoint for available options. See Fields and relationships for value type details.

map[string, AccountUpdateParamsFieldUnion]
One of the following:
string
float64
bool
type AccountUpdateParamsFieldArray []string
type AccountUpdateParamsFieldAddress 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 AccountUpdateParamsFieldFullName struct{…}
FirstName stringOptional

The contact’s first name.

LastName stringOptional

The contact’s last name.

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

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

map[string, AccountUpdateParamsRelationship]
Add AccountUpdateParamsRelationshipAddUnionOptional

Entity ID(s) to add to the relationship.

One of the following:
string
type AccountUpdateParamsRelationshipAddArray []string
Remove AccountUpdateParamsRelationshipRemoveUnionOptional

Entity ID(s) to remove from the relationship.

One of the following:
string
type AccountUpdateParamsRelationshipRemoveArray []string
Replace AccountUpdateParamsRelationshipReplaceUnionOptional

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

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

Unique identifier for the entity.

CreatedAt string

ISO 8601 timestamp of when the entity was created.

Fields map[string, AccountUpdateResponseField]

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

Value AccountUpdateResponseFieldValueUnion

The field value, or null if unset.

One of the following:
string
float64
bool
type AccountUpdateResponseFieldValueArray []string
type AccountUpdateResponseFieldValueAddress 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 AccountUpdateResponseFieldValueFullName 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 AccountUpdateResponseFieldValueTypeAddress AccountUpdateResponseFieldValueType = "ADDRESS"
const AccountUpdateResponseFieldValueTypeCheckbox AccountUpdateResponseFieldValueType = "CHECKBOX"
const AccountUpdateResponseFieldValueTypeCurrency AccountUpdateResponseFieldValueType = "CURRENCY"
const AccountUpdateResponseFieldValueTypeDatetime AccountUpdateResponseFieldValueType = "DATETIME"
const AccountUpdateResponseFieldValueTypeEmail AccountUpdateResponseFieldValueType = "EMAIL"
const AccountUpdateResponseFieldValueTypeFullName AccountUpdateResponseFieldValueType = "FULL_NAME"
const AccountUpdateResponseFieldValueTypeMarkdown AccountUpdateResponseFieldValueType = "MARKDOWN"
const AccountUpdateResponseFieldValueTypeMultiSelect AccountUpdateResponseFieldValueType = "MULTI_SELECT"
const AccountUpdateResponseFieldValueTypeNumber AccountUpdateResponseFieldValueType = "NUMBER"
const AccountUpdateResponseFieldValueTypeSingleSelect AccountUpdateResponseFieldValueType = "SINGLE_SELECT"
const AccountUpdateResponseFieldValueTypeSocialHandle AccountUpdateResponseFieldValueType = "SOCIAL_HANDLE"
const AccountUpdateResponseFieldValueTypeTelephone AccountUpdateResponseFieldValueType = "TELEPHONE"
const AccountUpdateResponseFieldValueTypeText AccountUpdateResponseFieldValueType = "TEXT"
const AccountUpdateResponseFieldValueTypeURL AccountUpdateResponseFieldValueType = "URL"
Relationships map[string, AccountUpdateResponseRelationship]

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 an account

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"),
  )
  accountUpdateResponse, err := client.Account.Update(
    context.TODO(),
    "id",
    githubcomlightfldlightfieldgo.AccountUpdateParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", accountUpdateResponse.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"
}