Create Customer

Create a new customer with the provided details.

🔒

Requires write_customer access scope.

The Create Customer API enables creating a new customer and optionally assign a default address.

This API is especially useful for:

  1. Creating a new customer with contact information.
  2. Associating addresses (billing or shipping) during creation.
  3. Managing marketing subscription preferences.

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

📘

Body Parameters

Field Type Required Example Description
customers.contact_typestringYesemailShould be phone or email. If phone, the phone parameter is required; otherwise, email is required.
customer.emailstringConditional[email protected]Email address, required when contact_type is email.
customer.phonestringConditional+Phone number with area code, required when contact_type is phone.
customer.first_namestringNoRanCustomer's first name.
customer.last_namestringNoZhaoCustomer'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.passwordstringNo123456Customer's password.
customer.password_confirmationstringNo123456Confirmation of the password.
customer.tagsarray of strings.No["New Customer","Repeat Customer"]array of tag strings.
customer.registered_atstringNo2024-03-11T03:32:00ZThe registered_at field records the creation time in UTC (0 timezone), formatted as ISO-8601.
customer.addressesarray of objectsNo[ ... ]A list of address objects under the customer object.
customer.addresses
.first_name
stringYesTestFirst name of the consignee.
customer.addresses
.last_name
stringYesTestLast name of the consignee.
customer.addresses
.email
stringNo[email protected]Email address for the address.
customer.addresses
.address1
stringNo6Primary street address.
customer.addresses
.address2
stringNo1111Secondary street address (e.g., apartment, suite).
customer.addresses
.area
stringNoBay AreaArea or region of the address.
customer.addresses
.city
stringNocityCity.
customer.addresses
.province
stringNoGuangdongProvince or state.
customer.addresses
.province_code
stringNoUS-NMProvince code.
customer.addresses
.country
stringYesAland IslandsCountry name.
customer.addresses
.country_code
stringYesUSISO country code.
customer.addresses
.company
stringNoABC LimitedCompany name.
customer.addresses
.phone
stringNo+86 1231231234Phone number associated with the address.
customer.addresses
.phone_area_code
stringNo+86Area code for the phone number.
customer.addresses
.zip
stringNo515300Postal or ZIP code.
customer.addresses
.gender
stringNomaleGender, e.g., male or female.
customer.addresses
.default
booleanNotrueIndicates if this is the default address. Defaults to true.

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.address1string``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!