Update Account’s Custom Attributes

The UpdateAccountCustomAttributes API in OCS.io facilitates the modification of an account’s custom attributes, allowing for customization to address specific operational needs.

Please note that attributes are not versioned, meaning that when you update account information, the new values take effect immediately. This change does not impact previously processed data.

API Overview

Fields Required for Updating Account’s Custom Attributes

The following table lists and describes the fields required to update an account’s custom attributes through the UpdateAccountCustomAttributes API:

Field Description

account

ID (Ref ID / External ID) of the Account.

customAttributes

New Custom Attribute(s) of the Account.

merge

Indicates whether provided custom attributes shall be merged with already stored.

Detailed API documentation and endpoint specifics are available here.

Request Validations

The following validations are performed when updating an account’s custom attributes:

  • Account must be provided in the request, it must be already created in the system and must not be in Deactivated State.

  • Custom Attributes (even with null value) must be provided in the request.

Update Account’s Custom Attributes Examples

1. Update Account’s Custom Attributes as Replace

Use the following request’s body to update an account’s custom attributes:

{
  "requestId": "{{$guid}}",
  "account": {
    "externalId": "account_external_id"
  },
  "customAttributes": {
    "key1": "Value 1",
    "key2": "Value 2"
  }
}

The outcome of the API call is as follows:

  • The custom attributes of the account with external ID account_external_id are set to key1: Value 1 and key2: Value 2, replacing any existing custom attributes.

2. Update Account’s Custom Attributes with Merge

Use the following request’s body to update an account’s custom attributes and merge with existing ones:

{
  "requestId": "{{$guid}}",
  "account": {
    "externalId": "account_external_id"
  },
  "customAttributes": {
    "key2": "New Value 2",
    "key3": "Value 3"
  },
  "merge": true
}

The outcome of the API call is as follows:

  • The custom attribute key2 of the account with external ID account_external_id is updated to New Value 2.

  • The new custom attribute key3: Value 3 is added to the account’s custom attributes.

  • Any other existing custom attributes remain unchanged.