Sign in with the code

post/v1/shoppers/auth/verify

Checks the code from the email and saves the profile to that email. Keep the token it returns in place of the one you sent: it is the account's, and works with any organization's key from now on.

When the email already has a profile, what was learnt on this one (reactions, notes, sizes, measurements) moves into it, this profile is deleted, and merged is true. Five wrong codes spend the code.

Public keyapi.v1.shoppersDemo key OK

Headers

1
X-Shopper-Tokenstringrequired

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

Request body

application/jsonrequired
emailstring (email)required

The email the code was sent to.

codestringrequired

The six digits from the email. Anything that is not a digit is ignored, so "482 913" is read as 482913.

Response

200Signed in. Keep the new token.
tokenstringrequired

The account's token. Replaces the one you hold.

mergedbooleanrequired

true when the email already had a profile and this one was moved into it.

ShopperProfilerequired

A profile in words. Never the vectors behind it.

savedbooleanrequired

true once the shopper confirmed an email: the profile is theirs, lasts until they delete it, and works at every store that runs Stylor.

emailstringnullablerequired

The confirmed email. Null on an anonymous profile.

array<object>required

Styles learnt from their reactions, strongest first. At most four per slot.

array<object>required

Kinds of whole look they liked, strongest first.

array<object>required

Styles they passed on often enough to say.

likesarray<string>required

Labels they clearly lean toward, read from their reactions, never said by them ("colour: black"). At most 8.

avoidsarray<string>required

Labels they clearly lean away from. At most 8.

array<object>required

What they told you, kept with remember.

array<ShopperKeptSize>required

Sizes they wear, by brand or store.

ShopperBody | nullrequired

Their body measurements in centimetres, and how they like things to fit. Null when none are kept.

signalsintegerrequired

Reactions learnt from.

Errors

29

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
Send the shopper's token in x-shopper-token, or start a profile (auth/start).

No X-Shopper-Token was sent. Send the token the code was asked for with.

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.

401
That code is not right.

The code does not match. The code stays usable until the fifth wrong try.

401
Too many wrong codes. Ask for a new one.

This was the fifth wrong code; the code is spent.

403
Shopper profiles are switched off for this organization.

The organization turned shopper profiles off.

404
No such profile.

The profile was deleted while the code was waiting.

410
That code has expired. Ask for a new one.

No unused code for this profile and email is less than 10 minutes old.

422
Enter the six-digit code from the email.

email is not an email address, or code does not hold exactly six digits.

curl -X POST "https://stylor.ai/api/v1/shoppers/auth/verify" \
  -H "Authorization: Bearer $STYLOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "[email protected]",
  "code": "482913"
}'
Response · 200
{
  "token": "eyJ2IjoxLCJ0eXAiOiJwcm9maWxlIiwicCI6IjkxYzQi…",
  "merged": false,
  "profile": {
    "saved": true,
    "email": "[email protected]",
    "styles": [],
    "outfits": [],
    "avoidStyles": [],
    "likes": [],
    "avoids": [],
    "notes": [],
    "sizes": [],
    "body": null,
    "signals": 3
  }
}