Record reactions

post/v1/shoppers/me/signals

Records what the shopper did, and learns from it in the same call: the next feed, ranking or search already knows. Send reactions as they happen, up to 50 at a time.

Kinds and weights

kind weight needs
purchase 5 itemId
like 3 itemId
cart_add 3 itemId
look_like 3 itemIds, the pieces of a look (up to 8)
said 2 text, something they said about their taste ("minimal earthy workwear")
look_more 2 itemId
click 1 itemId
cart_remove −1 itemId
dislike −3 itemId
look_dislike −3 itemIds

A look is learnt as an outfit, and each of its pieces at 0.4 of the look's weight. Reactions fade with a 60-day half-life. A signal of an unknown kind, or without what its kind needs, is skipped.

Taking one back

{ "kind": "undo", "undoes": "like", "itemId": "…" } deletes the latest such reaction and relearns the taste without it, so a mistaken like stops pulling. Undos in a call run before its other signals, so "like, then not for me" in one call ends as not for me.

Without a token, a profile is made for the first reaction and its token is returned. Send reactions one call at a time until you hold it: three quick likes sent at once on a new shopper make three profiles.

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
array<ShopperSignal>required

The reactions, oldest first. Only the first 50 are read.

maxItems: 50
kindstringrequired

What happened. See the table above.

One ofpurchaselikecart_addlook_likesaidlook_moreclickcart_removedislikelook_dislikeundo
itemIdstring

The product, for a product reaction (and for undoing one).

itemIdsarray<string>

The pieces of a look, for look_like and look_dislike (and for undoing one). Up to 8 are read.

textstring

For said, their words. Up to 280 characters are kept.

occasionstring

What it was for ("work", "wedding"), when you know. Up to 40 characters.

undoesstring

For undo, the kind taken back (like, dislike, look_like, …).

Response

200Recorded and learnt.
recordedintegerrequired

Reactions recorded.

undoneinteger

Reactions taken back. Present when the call held undos.

tokenstring

Only when no token was sent and this call made the profile. Keep it.

Errors

25

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.

404
No such profile.

The profile was deleted while the reactions were being learnt.

422
Nothing to record.

No signal had a known kind with what it needs, or none could be recorded.

curl -X POST "https://stylor.ai/api/v1/shoppers/me/signals" \
  -H "Authorization: Bearer $STYLOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "signals": [
    {
      "kind": "like",
      "itemId": "701e5cee-41da-4e91-a688-69e8c8dd5fe3"
    },
    {
      "kind": "click",
      "itemId": "a342cbe3-965b-4055-8ac3-20f63103cade"
    },
    {
      "kind": "look_dislike",
      "itemIds": [
        "6a6dca06-2e8c-4cb8-b178-4c680c72c385",
        "35a725c8-23fb-4009-a52a-2a778d2e504a"
      ]
    }
  ]
}'
Response · 200
{
  "recorded": 3
}