Skip to content

Register a customer with email and password

POST
/public/stores/{storeRef}/auth/register
curl --request POST \
--url https://apibase.ecomweb.app/api/v1/public/stores/example/auth/register \
--header 'Content-Type: application/json' \
--header 'x-storefront-api-key: <x-storefront-api-key>' \
--data '{ "email": "shopper@example.com", "password": "s3cret-password", "name": "Nguyễn Văn A", "anonymous_identity_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Creates an account with an email and password and, when the store requires it, emails a verification link. It never signs the shopper in: the answer has no tokens and is the same whether or not the email already had an account, so it cannot be used to find out which emails are registered. Keep verification_binding and send it with the emailed token to the verify-email route. An anonymous session can be upgraded in place with anonymous_identity_id. Rate limited to 5 requests per minute per store and client IP.

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
email
required
string
<= 255 characters

Example

shopper@example.com
password
required
string
>= 8 characters <= 128 characters

Example

s3cret-password
name
string
<= 255 characters

Example

Nguyễn Văn A
anonymous_identity_id

Identity of an anonymous session to upgrade in place, so its cart and orders survive signup. Ignored unless it is anonymous, undeleted, and belongs to this store.

string format: uuid
Media typeapplication/json
object
access_token
required

Always null: registering does not sign the shopper in.

string
nullable
refresh_token
required

Always null: registering does not sign the shopper in.

string
nullable
identity
required

Always null: the response does not reveal whether the account exists.

object
id
required

Identity ID (a UUID). Use it as the shopper’s sign-in ID.

string
email
required

Email address, or null for an anonymous session.

string
nullable
email_verified
required

Whether the shopper has proved they own the email address.

boolean
is_anonymous
required

True for a session issued by the anonymous route, which has no email or password.

boolean
expires_in
required

Seconds an access token issued by this store stays valid.

number
verification_binding
required

A value to keep on the client and send as binding to the verify-email route, which ties the emailed link to the browser that registered. It is never emailed.

string

Example generated

{
"access_token": "example",
"refresh_token": "example",
"identity": {
"id": "example",
"email": "example",
"email_verified": true,
"is_anonymous": true
},
"expires_in": 1,
"verification_binding": "example"
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

Too many requests; wait a little before retrying.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}