anyshop docs homeStatusOpen the dashboard

API reference Customers Create or update a customer record

API referenceCustomers

Create or update a customer record

POST methodhttps://api.anyshop.io/v1/customers

Keeps a customer record by email: a new one, or the one with this email brought up to date. Consent you send is recorded with the source api and the time. Customer records are live mode only, so this needs a live key. Erasing a customer and exporting their data are not in the API: they are in the dashboard, after the owner's fresh two-factor check.

  • Scope customers:write
  • Live keys only
  • Idempotent with Idempotency-Key
  • Works while the store is suspended

Body

application/json1 required, 2 optional
  • emailstring requiredTheir email address. A customer with this email already is updated insteadUp to 254 characters
  • namestring Their name, up to 200 characters; replaces the one keptUp to 200 characters
  • marketing_consentboolean true: they agreed to marketing emails, recorded with the source api and the time. false: they withdrew it, recording when. Left out, consent stays as it is

Headers

  • Idempotency-Keystring Up to 255 characters. A retry with the same key and request gets the first answer, without running twice (24 hours).

Returns

The customer object.

Errors

Status and error.type
  • 400invalid_requestThe request is not valid; error.param names the field
  • 401authenticationNo API key, or it is not valid
  • 403permissionThe key does not have the scope this needs, or the store is suspended (store_suspended)
  • 404not_foundNot found in the key's store and mode
  • 409conflictConflicts with the object's state (type conflict), or an Idempotency-Key reused for another request (type idempotency, code idempotency_key_reused)
  • 429rate_limitedToo many requests; see Retry-After