Developers

Customers

Markdown

Create a customer

Adds a new customer to the store. The email is required.

POST/stores/{storeId}/v1/customers

The new account has no password and is not active. It becomes a real account when the owner of the email registers on the store and proves the email with a code, so an app can never open another person's orders or points. If the email or phone already belongs to a customer you receive CUSTOMER_EXISTS: find them with List customers. When no name is sent, the part of the email before @ becomes the name.

Headers

Idempotency-Keystringrequired

Request body

emailstring (email)required
Saved in lowercase.
phonestring
A valid phone in any form. It comes back in E.164 format.
namestring
first_namestring
last_namestring

Response

dataobjectrequired
idstringrequired
namestringrequired
first_namestring
last_namestring
phonestring | nullrequired
Phone number in E.164 format, such as +966512345678, or null if it is not a valid number.
emailstring | null (email)required
orders_countintegerrequired
Delivered orders that were not refunded.
total_spentstringrequired
The total of those orders in SAR.
last_order_atstring | null (date-time)
created_atstring (date-time)required
executionobject
Who executed the request: the app, version, installation and store. Field names here are camelCase.
appIdstring (uuid)
versionIdstring (uuid)
installationIdstring (uuid)
storeIdstring (uuid)
requestIdstring (uuid)
generationinteger
routeEpochinteger
appAuthEpochinteger
grantRevisioninteger
metaobjectrequired
request_idstring (uuid)
The request ID; include it in any support request.

Errors

HTTPCodeMeaning
400IDEMPOTENCY_KEY_REQUIREDNo Idempotency-Key header.
409CUSTOMER_EXISTSA customer already has this email or phone.
422INVALID_EMAILThe email is missing or not valid.
422INVALID_PHONEThe phone is not valid.
422INVALID_TEXTA name is empty or too long.
422UNKNOWN_FIELDUnknown field.
403SCOPE_REQUIREDThe token does not carry the required scope.
503APPS_SCOPE_RUNTIME_NOT_READYThe resource is not enabled on this merchant's store yet.

Shared codes are listed in Errors.

    ↑↓ moveEnter openEsc close