Update Customer

Update the details of an existing customer using its unique identifier.

🔒

Requires write_customer access scope.

Update Customer API allows developers 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

📘

Path Parameters

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

Body Parameters

ParameterTypeRequiredExampleDescription
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.tagsarray of stringNo["New Customer"]Comma-separated tags assigned to the customer.

Response Explanation

Public Response Parameters

📘

Successful Response

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

Error Response

FieldTypeExampleDescription
codestringInvalidParameterError http message
messagestring``Error message

API Structure Overview

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