Email a sign-in code

post/v1/shoppers/auth/code

Emails a six-digit code that saves the shopper's profile to their email, or opens the profile already saved to it. Send the token you hold; without one, an anonymous profile is made for the code and its token is returned, which auth/verify then needs.

The code lasts 10 minutes, and a new one replaces any still waiting. One email can be sent 5 codes an hour, and one profile can ask for 8. The email is sent in the name of your store.

Public keyapi.v1.shoppersDemo key OK

Headers

1
X-Shopper-Tokenstring

The shopper's profile token, from auth/start, auth/verify or any call that made a profile. Optional here.

Request body

application/jsonrequired
emailstring (email)required

The shopper's email. Compared in lower case.

Response

200The code was sent. token is present only when this call made the profile.
sentbooleanrequired

Always true.

emailstringrequired

The email as it was read, in lower case.

tokenstring

Only when no token was sent and a profile was made for the code. Keep it and send it to auth/verify.

Errors

26

Every error is JSON with a single error string unless noted. Match on the status code; the message is for humans.

400
Request body must be valid JSON.

The request body could not be parsed as JSON.

400
Request body must be a JSON object.

The request body parsed to something other than a JSON object.

401
That shopper token is not valid here. Start a profile or sign in again.

X-Shopper-Token was sent but cannot be opened with this key.

403
Shopper profiles are switched off for this organization.

The organization turned shopper profiles off.

422
That does not look like an email address.

email is missing or not an email address.

429
Too many codes asked for. Try again in an hour.

This email has been sent 5 codes, or this profile has asked for 8, in the last hour.

503
Codes cannot be sent yet.

The code email is not set up on the server.

curl -X POST "https://stylor.ai/api/v1/shoppers/auth/code" \
  -H "Authorization: Bearer $STYLOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "[email protected]"
}'
Response · 200
{
  "sent": true,
  "email": "[email protected]"
}