Skip to navigation

Create customer

View as Markdown

Create customer

Creates a new customer record scoped to the authenticated merchant’s store. The storeId is derived from the API key context (not supplied in the body), and a UUID id is generated server-side.

Authentication

  • Send the merchant API key in the x-api-key header (alias x-account-api-key).
  • Requires the scope: Merchant.customer.create.
  • Optionally scope the key to a specific store/account with the x-application-account-id header (alias x-account-id) or the application_account_id / account_id query param.

Body

JSON body (application/json). Only name and email are required. The optional fields accepted by CreateCustomerDto are mobile, addressLine1, addressLine2, city, state, postalCode and country. Unknown properties are stripped by the validation pipe.

Side-effects / validation

  • Email must be unique per store (case-insensitive). If a customer with the same email already exists for the store, the request fails with 400 Bad Request ("A customer with this email already exists for your store.").
  • Returns the full persisted customer record on success.

Notas: storeId and id are set server-side and cannot be supplied by the client. Email uniqueness is enforced per store (case-insensitive) and returns 400 on conflict. Related endpoints: GET /v1/customers, PATCH /v1/customers/:id.

Authentication

x-api-keystring
API Key authentication via header

Headers

x-application-account-idstringOptional

Scope the request to a specific store / account instead of the one resolved from the API key. Aliases: the x-account-id header, or the application_account_id / account_id query parameter.

Request

This endpoint expects an object.
namestringRequired
emailstringRequiredformat: "email"