Rank products for the shopper

post/v1/shoppers/me/rank

Puts any list of your products in the shopper's order: your list's own order, moved by their taste as far as the profile has learnt it (a profile with a dozen reactions moves it most). Use it on a category page or your own search results. Up to 500 ids are read; without a token, or with nothing learnt, the order is yours unchanged.

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
itemIdsarray<string>required

Your products, in your order. Duplicates are read once; only the first 500 are ranked.

Response

200The same products, in the shopper's order.
array<object>required
itemIdstringrequired

The product.

scorenumberrequired

How well it fits their taste, about −1 to 1. 0 when nothing is learnt.

reasonstringnullablerequired

Why it moved, when it moved for a reason worth saying ("Fits your black, relaxed tees."). Null otherwise.

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.

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 cannot be opened with this key.

422
itemIds must be a non-empty array.

itemIds is missing, not an array, or empty.

curl -X POST "https://stylor.ai/api/v1/shoppers/me/rank" \
  -H "Authorization: Bearer $STYLOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "itemIds": [
    "701e5cee-41da-4e91-a688-69e8c8dd5fe3",
    "a342cbe3-965b-4055-8ac3-20f63103cade",
    "35a725c8-23fb-4009-a52a-2a778d2e504a"
  ]
}'
Response · 200
{
  "items": [
    {
      "itemId": "35a725c8-23fb-4009-a52a-2a778d2e504a",
      "score": 0.38,
      "reason": "Fits your dark, slim, jeans."
    },
    {
      "itemId": "701e5cee-41da-4e91-a688-69e8c8dd5fe3",
      "score": 0.05,
      "reason": null
    },
    {
      "itemId": "a342cbe3-965b-4055-8ac3-20f63103cade",
      "score": -0.12,
      "reason": null
    }
  ]
}