Create Customer
POST
/v2/customersAuthorization
AuthorizationBearer token · headerrequiredMerchant API key scoped to one merchant and environment. Read operations require api:read, normal write operations require api:write, and broadcast mutations also require explicit broadcasts:write.
Header parameters
idempotency-keystringrequiredRequired for write endpoints that create records and need deterministic retry behavior.
min length 1 · max length 255
x-request-idstringOptional caller-provided request correlation ID.
min length 1
Request body
requiredapplication/jsonnamestringrequiredmin length 1 · max length 160
emailstring<email>requiredmax length 320
mobilestringrequiredmin length 8 · max length 32 · matches ^\+?[1-9]\d{7,14}$
billingAddressobject | anydefault: null
Show propertiesHide properties
Any of:
object
line1stringrequiredmin length 1 · max length 200
line2stringmin length 1 · max length 200
citystringrequiredmin length 1 · max length 120
regionstringrequiredmin length 1 · max length 120
postalCodestringrequiredmin length 1 · max length 20
countryCodestringmin length 2 · max length 2 · default: "SA"
any
anylocalestringdefault: "en"
Allowed:
enarexternalIdstring | anydefault: null
Show propertiesHide properties
Any of:
string
stringany
anymetadataobjectdefault: {}
Responses
200OK
customerobjectrequiredShow propertiesHide properties
idstring<uuid>requiredmerchantIdstring<uuid>requiredenvironmentstringrequiredAllowed:
sandboxproductionnamestring | anyrequiredShow propertiesHide properties
Any of:
string
stringany
anyemailstring<email>requiredmax length 320
mobilestring | anyrequiredShow propertiesHide properties
Any of:
string
stringany
anybillingAddressobject | anyrequiredShow propertiesHide properties
Any of:
object
line1stringrequiredmin length 1 · max length 200
line2stringmin length 1 · max length 200
citystringrequiredmin length 1 · max length 120
regionstringrequiredmin length 1 · max length 120
postalCodestringrequiredmin length 1 · max length 20
countryCodeanydefault: "SA"
any
anylocalestringrequiredAllowed:
enarexternalIdstring | anyrequiredShow propertiesHide properties
Any of:
string
stringany
anyemailTruststringrequiredAllowed:
legacy_merchant_assertedverifiedemailVerifiedAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anystatusstringAllowed:
activedeactivatedrevisionintegerrequiredmin -9007199254740991 · max 9007199254740991
metadataobjectrequiredcreatedAtstring<date-time>requiredupdatedAtstring<date-time>required400Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject401Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject403Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject404Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject409Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject422Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject429Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject500Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobjectRequest
curl -X POST "https://api.cipay.net/v2/customers" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "idempotency-key: string" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"email": "<email>",
"mobile": "string",
"billingAddress": null,
"locale": "en",
"externalId": null,
"metadata": {}
}'const response = await fetch("https://api.cipay.net/v2/customers", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"idempotency-key": "string",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "string",
"email": "<email>",
"mobile": "string",
"billingAddress": null,
"locale": "en",
"externalId": null,
"metadata": {}
})
});Response
{
"customer": {
"id": "<uuid>",
"merchantId": "<uuid>",
"environment": "sandbox",
"name": "string",
"email": "<email>",
"mobile": "string",
"billingAddress": {
"line1": "string",
"line2": "string",
"city": "string",
"region": "string",
"postalCode": "string",
"countryCode": "SA"
},
"locale": "en",
"externalId": "string",
"emailTrust": "legacy_merchant_asserted",
"emailVerifiedAt": "2024-01-01T00:00:00Z",
"status": "active",
"revision": 0,
"metadata": {},
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z"
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}