Update Customer

🔒

Requires write_customer access scope.

Update specific attributes of a customer by their unique ID.

This API is especially useful for:

  1. Modifying customer information like name, marketing subscriptions, or tags.
  2. Managing updates to customer records efficiently.
  3. Personalizing customer data for reporting or segmentation.

Note: The operation is scoped to a specific shop, identified by its unique domain prefix (shopdomain), ensuring all updates are applied to the correct store.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Path Parameters

ParameterTypeRequiredExampleDescription
idstringYes2dd957e3-2051-4cdf-8584-9c0046b4d1aeUnique identifier of the customer.

Body Parameters

FieldTypeRequiredExampleDescription
customerobjectYesThe object containing customer attributes to be updated.
customer.first_namestringNoRyanCustomer's first name.
customer.last_namestringNoZhangCustomer's last name.
customer.accepts_marketingbooleanNotrueWhether to subscribe to marketing email campaigns. Defaults to true.
customer.accepts_sms_marketingbooleanNotrueWhether to subscribe to SMS marketing campaigns. Defaults to true.
customer.tagsstringNoNew Customer, Repeat CustomerComma-separated tags assigned to the customer.

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Successful Response

FieldTypeExampleDescription
customerobjectCustomer object containing customer details.
customer.idstring2dd957e3-2051-4cdf-8584-9c0046b4d1aeUnique identifier for the customer.
customer.first_namestringRyanCustomer's first name.
customer.last_namestringZhangCustomer's last name.
customer.namestringRyan ZhangFull name of the customer.
customer.emailstring[email protected]Customer's email address.
customer.phonestring+8615014471143Customer's phone number.
customer.phone_area_codestringnullArea code of the phone number.
customer.contact_typestringemailContact type, either email or phone.
customer.accepts_marketingbooleantrueIndicates if the customer is subscribed to marketing emails.
customer.sourcestringnullSource of the customer data.
customer.free_taxbooleanfalseIndicates if the customer is exempt from taxes.
customer.registeredbooleanfalseIndicates if the customer is registered.
customer.orders_countinteger0Number of orders placed by the customer.
customer.last_order_atstringnullTimestamp of the customer's last order.
customer.total_spentstring"0.00"Total amount spent by the customer.
customer.tagsstringNew CustomerComma-separated tags associated with the customer.
customer.created_atstring2024-04-17T11:10:33ZTimestamp when the customer was created, in ISO8601 format.
customer.updated_atstring2024-04-17T11:10:33ZTimestamp when the customer was last updated, in ISO8601 format.
customer.subscribed_flaginteger5Customer's marketing subscription status flag.
customer.sms_subscribed_flaginteger5Customer's SMS subscription status flag.
customer.accepts_sms_marketingbooleantrueIndicates if the customer is subscribed to SMS marketing campaigns.
customer.default_addressobjectSee Address Object fields below.Default address object for the customer.
customer.default_address.idstring9ffa8dc0-25b8-4424-832e-bab46fcfeb20Unique identifier for the address.
customer.default_address.customer_idstring2dd957e3-2051-4cdf-8584-9c0046b4d1aeID of the customer this address belongs to.
customer.default_address.first_namestringTestFirst name of the consignee.
customer.default_address.last_namestringTestLast name of the consignee.
customer.default_address.companystring""Company name.
customer.default_address.citystring深圳City of the address.
customer.default_address.provincestring""Province or state of the address.
customer.default_address.countrystringAland IslandsCountry name of the address.
customer.default_address.zipstring515300Postal or ZIP code.
customer.default_address.province_codestring""Province code.
customer.default_address.country_codestringAXISO country code.
customer.default_address.genderstring""Gender of the consignee.
customer.default_address.phonestring+86 150 1447 1143Phone number associated with the address.
customer.default_address.phone_area_codestringnullArea code of the phone number.
customer.default_address.areastring""Area or region of the address.
customer.default_address.emailstring[email protected]Email associated with the address.
customer.default_address.namestringTest TestFull name of the consignee.
customer.default_address.address1string6 三聖街Primary street address.
customer.default_address.address2string1111Secondary street address.
customer.default_address.country_namestringAland IslandsFull name of the country.
customer.default_address.defaultbooleantrueIndicates if this is the default address.
customer.addressesarray of objectsSee Address Object fields below for full details.List of all customer addresses.
customer.addresses.idstring9ffa8dc0-25b8-4424-832e-bab46fcfeb20Unique identifier for the address.
customer.addresses.customer_idstring2dd957e3-2051-4cdf-8584-9c0046b4d1aeID of the customer this address belongs to.
customer.addresses.first_namestringTestFirst name of the consignee.
customer.addresses.last_namestringTestLast name of the consignee.
customer.addresses.companystring""Company name.
customer.addresses.citystring深圳City of the address.
customer.addresses.provincestring""Province or state of the address.
customer.addresses.countrystringAland IslandsCountry name of the address.
customer.addresses.zipstring515300Postal or ZIP code.
customer.addresses.province_codestring""Province code.
customer.addresses.country_codestringAXISO country code.
customer.addresses.genderstring""Gender of the consignee.
customer.addresses.phonestring+86 150 1447 1143Phone number associated with the address.
customer.addresses.areastring""Area or region of the address.
customer.addresses.emailstring[email protected]Email associated with the address.
customer.addresses.address1string6 三聖街Primary street address.
customer.addresses.address2string1111Secondary street address.
customer.addresses.country_namestringAland IslandsFull name of the country.
customer.addresses.defaultbooleantrueIndicates if this is the default address.

Error Response

Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.

FieldTypeExampleDescription
errorsEmail or Phone is already taken["Context"]A list of errors encountered during the request processing.
FieldTypeExampleDescription
errorString "store is not active"Indicates an error encountered during the process

Error Detail

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
invalid customer's id input or empty customer's id
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
404record not foundProvided id is not existed.record not found

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!