commercetools icon

commercetools

Interact with the commercetools API. Operations are auto-generated from the official Postman collection.

Actions671

Customer → Update Customer by Key

AI-generated

Summary

Update an existing customer resource by its unique customer key by specifying the version for concurrency control and providing one or more update actions either as a JSON array or through a UI-friendly fixed collection of available customer update actions.

Inputs

  • Customer Key (required) — The unique key identifying the customer to update.
  • Version (required) — The current version of the customer resource, required for optimistic concurrency control.
  • Actions (JSON) — A raw JSON array representing the update actions to apply; if provided and non-empty, this overrides UI-specified actions.
  • Actions (UI) — A collection of predefined update actions selectable and configurable via the UI, such as changing email, adding addresses, setting custom fields, etc. These actions are used if 'Actions (JSON)' is empty.

Output shape

a single JSON object representing the updated customer resource as returned from the commercetools API

The operation requires valid OAuth2 credentials for the commercetools API with the correct project key and region. The update applies changes atomically to the customer identified by the given key and version, preventing conflicts. Errors throw exceptions unless 'Continue On Fail' is enabled, where they are returned as error objects per item.

Examples

Example 1: Update a customer by key to change their email address and add a billing address ID using UI actions.

Set the 'Customer Key' to the key of the target customer, set 'Version' to their current version number, and select 'ChangeEmail' and 'AddBillingAddressId' actions in the UI, filling required fields.

Example 2: Update a customer by key using raw JSON actions.

Set the 'Customer Key' and 'Version', then input a JSON array of actions in 'Actions (JSON)', which overrides UI actions. For example, to set first name and set custom type fields.

Links

Discussion