Create Customer

🔒

Requires write_customer access scope.

Create 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

📘

Public Request Parameters

Body Parameters

Field Type Required Example Description
contact_typestringYesemailShould be phone or email. If phone, the phone parameter is required; otherwise, email is required.
emailstringConditionaltest@shoplazza.comEmail address, required when contact_type is email.
phonestringConditional+Phone number with area code, required when contact_type is phone.
first_namestringNoRanCustomer's first name.
last_namestringNoZhaoCustomer's last name.
accepts_marketingbooleanNotrueWhether to subscribe to marketing email campaigns. Defaults to true.
accepts_sms_marketingbooleanNotrueWhether to subscribe to SMS marketing campaigns. Defaults to true.
passwordstringNo123456Customer's password.
password_confirmationstringNo123456Confirmation of the password.
tagsstringNoNew Customer,Repeat CustomerComma-separated tags assigned to the customer.
registered_atstringNo2024-03-11T03:32:00ZThe registered_at field records the creation time in UTC (0 timezone), formatted as ISO-8601.
addressesarray of objectsNo[ ... ]A list of address objects under the customer object.
addresses
.first_name
stringYesTestFirst name of the consignee.
addresses
.last_name
stringYesTestLast name of the consignee.
addresses
.email
stringNotest@shoplazza.comEmail address for the address.
addresses
.address1
stringNo6Primary street address.
addresses
.address2
stringNo1111Secondary street address (e.g., apartment, suite).
addresses
.area
stringNoBay AreaArea or region of the address.
addresses
.city
stringNocityCity.
addresses
.province
stringNoGuangdongProvince or state.
addresses
.province_code
stringNoGDProvince code.
addresses
.country
stringYesAland IslandsCountry name.
addresses
.country_code
stringYesAXISO country code.
addresses
.company
stringNoABC LimitedCompany name.
addresses
.phone
stringNo+86 1231231234Phone number associated with the address.
addresses
.phone_area_code
stringNo+86Area code for the phone number.
addresses
.zip
stringNo515300Postal or ZIP code.
addresses
.gender
stringNomaleGender, e.g., male or female.
addresses
.default
booleanNotrueIndicates if this is the default address. Defaults to true.

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Successful Response

Field Type Example Description
customerobjectCustomer object containing customer details.
customer
.id
string2dd957e3-2051-4cdf-8584-9c0046b4d1aeUnique identifier for the customer.
customer
.first_name
stringRyanCustomer's first name.
customer
.last_name
stringZhangCustomer's last name.
customer
.name
stringRyan ZhangFull name of the customer.
customer
.email
stringtest@shoplazza.comCustomer's email address.
customer
.phone
string+86 1231231234Customer's phone number.
customer
.phone_area_code
stringnullArea code of the phone number.
customer
.contact_type
stringemailContact type, either email or phone.
customer
.accepts_marketing
booleantrueIndicates if the customer is subscribed to marketing emails.
customer
.source
stringnullSource of the customer data.
customer
.free_tax
booleanfalseIndicates if the customer is exempt from taxes.
customer
.registered
booleanfalseIndicates if the customer is registered.
customer
.orders_count
integer0Number of orders placed by the customer.
customer
.last_order_at
stringnullTimestamp of the customer's last order.
customer
.total_spent
string"0.00"Total amount spent by the customer.
customer
.tags
stringNew CustomerComma-separated tags associated with the customer.
customer
.created_at
string2024-04-17T11:10:33ZTimestamp when the customer was created, in ISO8601 format.
customer
.updated_at
string2024-04-17T11:10:33ZTimestamp when the customer was last updated, in ISO8601 format.
customer
.subscribed_flag
integer5Customer's marketing subscription status flag.
customer
.sms_subscribed_flag
integer5Customer's SMS subscription status flag.
customer
.accepts_sms_marketing
booleantrueIndicates if the customer is subscribed to SMS marketing campaigns.
customer
.default_address
objectSee Address Object fields below.Default address object for the customer.
customer
.default_address
.id
string9ffa8dc0-25b8-4424-832e-bab46fcfeb20Unique identifier for the address.
customer
.default_address
.customer_id
string2dd957e3-2051-4cdf-8584-9c0046b4d1aID of the customer this address belongs to.
customer
.default_address
.first_name
stringTestFirst name of the consignee.
customer
.default_address
.last_name
stringTestLast name of the consignee.
customer
.default_address
.company
string""Company name.
customer
.default_address
.city
stringshenzhenCity of the address.
customer
.default_address
.province
string""Province or state of the address.
customer
.default_address
.country
stringAland IslandsCountry name of the address.
customer
.default_address
.zip
string515300Postal or ZIP code.
customer
.default_address
.province_code
string""Province code.
customer
.default_address
.country_code
stringAXISO country code.
customer
.default_address
.gender
string""Gender of the consignee.
customer
.default_address
.phone
string+86 1231231234Phone number associated with the address.
customer
.default_address
.phone_area_code
stringnullArea code of the phone number.
customer
.default_address
.area
string""Area or region of the address.
customer
.default_address
.email
stringtest@shoplazza.comEmail associated with the address.
customer
.default_address
.name
stringTest TestFull name of the consignee.
customer
.default_address
.address1
string6 三聖街Primary street address.
customer
.default_address
.address2
string1111Secondary street address.
customer
.default_address
.country_name
stringAland IslandsFull name of the country.
customer
.default_address
.default
booleantrueIndicates if this is the default address.
customer
.addresses
array of objectsSee Address Object fields below for full details.List of all customer addresses.
customer
.addresses
.id
string9ffa8dc0-25b8-4424-832e-bab46fcfeb20Unique identifier for the address.
customer
.addresses
.customer_id
string2dd957e3-2051-4cdf-8584-9c0046b4d1aeID of the customer this address belongs to.
customer
.addresses
.first_name
stringTestFirst name of the consignee.
customer
.addresses
.last_name
stringTestLast name of the consignee.
customer
.addresses
.company
string""Company name.
customer
.addresses
.city
string深圳City of the address.
customer
.addresses
.province
string""Province or state of the address.
customer
.addresses
.country
stringAland IslandsCountry name of the address.
customer
.addresses
.zip
string515300Postal or ZIP code.
customer
.addresses
.province_code
string""Province code.
customer
.addresses
.country_code
stringAXISO country code.
customer
.addresses
.gender
string""Gender of the consignee.
customer
.addresses
.phone
string+86 1231231234Phone number associated with the address.
customer
.addresses
.area
string""Area or region of the address.
customer
.addresses
.email
stringtest@shoplazza.comEmail associated with the address.
customer
.addresses
.address1
string6 三聖街Primary street address.
customer
.addresses
.address2
string1111Secondary street address.
customer
.addresses
.country_name
stringAland IslandsFull name of the country.
customer
.addresses
.default
booleantrueIndicates 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
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
422Email or Phone is already takenProvided existed phone number or email.
Password is too short (minimum is 6 characters)Provides password's length is less than 6
Password confirmation must be equal to passwordConfirmation Password is not equal to Password.
Phone is invalidPhone number is not invalid
Country can't be blankempty Country.
Country code can't be blankempty Country code.

API Structure Overview

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