/api/v1/customersAdds a customer to the register, keyed on email. An email that already exists answers 200 with the existing customer instead of creating a second one, so this is safe to call on every sync. Requires the "customers:write" scope. An "Idempotency-Key" header is optional — the endpoint is already idempotent on the email — but is honoured when sent.
Headers#
| Field | Type | Description |
|---|---|---|
Idempotency-Key | string≥ 8 chars · ≤ 200 chars | Optional. A unique key, 8-200 characters. Retrying with the same key replays the first response verbatim instead of acting twice. |
Request body#
| Field | Type | Description |
|---|---|---|
emailrequired | stringemail · ≤ 200 chars | The customer's email. This is the identity: posting an email that already exists returns 200 with the existing customer instead of creating a second one. |
namerequired | string≥ 1 chars · ≤ 200 chars | The customer's name. |
phone | string≤ 200 chars | The customer's phone number. |
email_subscription | booleandefault false | Whether the customer has agreed to marketing email. Defaults to false — consent is something you record, never something we assume. |
Example request#
bash
curl -X POST "https://your-site.awrora.app/api/v1/customers" \
-H "Authorization: Bearer $AWRORA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "anna@example.com",
"name": "string",
"phone": "string",
"email_subscription": false
}'Responses#
200The customer. 201 when it was created, 200 when it already existed. Returned when nothing new was created — the resource already existed, or this is a replay of an earlier request with the same Idempotency-Key.201The customer. 201 when it was created, 200 when it already existed.400Invalid request — codes "validation_failed" or, on an endpoint that requires one, "idempotency_key_required".401Missing, invalid, revoked or expired API key — codes "api_key_missing", "api_key_invalid", "api_key_revoked", "api_key_expired".403The API app is off, the plan does not include the API, or the key lacks the required scope — codes "app_not_enabled", "plan_upgrade_required", "insufficient_scope" (the last carries "required_scope").422The request was understood but cannot be fulfilled as asked — codes "validation_failed" or "idempotency_key_reused" (the same Idempotency-Key was already used with a different body).429Rate limit exceeded — code "rate_limited". See the x-ratelimit-* headers.500Something went wrong on our side — code "internal_error".
Response 200
| Field | Type | Description |
|---|---|---|
idrequired | string | Awrora id (UUID) for the customer record. |
namerequired | string | Customer name. |
emailrequired | string | Customer email. Unique within the organization. |
phonerequired | string | null | Phone number, or null. |
tagsrequired | string[] | Merchant-defined tags. May be empty. |
email_subscriptionrequired | boolean | True when the customer has opted in to marketing email. |
created_atrequired | string | ISO 8601 timestamp with offset. |
200 response
{
"id": "res_8f2k3n",
"name": "string",
"email": "anna@example.com",
"phone": "string",
"tags": [
"string"
],
"email_subscription": true,
"created_at": "string"
}