Start a profile

post/v1/shoppers/auth/start

Makes an anonymous shopper profile and returns its token. Keep the token on the device and send it as X-Shopper-Token on every other shopper call.

An anonymous profile belongs to your organization: its token opens it only with your organization's key. It lasts 180 days from its last use. Confirming an email (auth/code, then auth/verify) saves it to that email, after which it lasts until the shopper deletes it and works with any organization's key.

You rarely need to call this first. Signals, remember, size with save: true and auth/code make a profile themselves when no token is sent, and return its token in the same response. Sent with a valid token, this returns that profile and a renewed token instead of making another.

Every shopper endpoint is metered as api.v1.shoppers. Until your plan carries that resource, calls draw on the chat's allowance (api.v2.agent.chat); the X-RateLimit-Resource header says which was charged.

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.

Response

200The profile and the token to keep.
tokenstringrequired

The token to keep and send as X-Shopper-Token. Renewed on every call that returns it; good for 400 days.

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

23

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.

A body was sent and could not be parsed as JSON. The body is optional.

400
Request body must be a JSON object.

A body was sent and 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 is not a profile token, has expired, names a deleted profile, or is another organization's anonymous profile. Drop it and call again without one.

403
Shopper profiles are switched off for this organization.

The organization turned shopper profiles off in its agent settings. Nothing is made, read or kept.

curl -X POST "https://stylor.ai/api/v1/shoppers/auth/start" \
  -H "Authorization: Bearer $STYLOR_API_KEY"
Response · 200
{
  "token": "eyJ2IjoxLCJ0eXAiOiJwcm9maWxlIiwicCI6IjRmM2Ei…",
  "profile": {
    "saved": false,
    "email": null,
    "styles": [],
    "outfits": [],
    "avoidStyles": [],
    "likes": [],
    "avoids": [],
    "notes": [],
    "sizes": [],
    "body": null,
    "signals": 0
  }
}