Size products for the shopper
/v1/shoppers/me/sizeThe size to buy in each product, from the sizes the shopper wears at other brands ("30 in Levi's jeans", "M at Uniqlo"), their body measurements, or both. It is the same sizing the Stylor chat agent uses, so an app and the chat give the same answer.
How a size is worked out
- Each size worn elsewhere is read against that brand's published size chart (Stylor holds about 90 brands') as a range of each body measurement: who that size is made for. Several sizes narrow it; sizes that disagree widen it and lower the confidence.
- Body measurements, when sent or kept, replace what the sizes suggest for those measurements.
- The result is laid on the product's own store's size guide, read
from the store's pages, by what decides that garment (the chest for
a top, the waist and hips for a bottom). A waist worn as a number
sizes a pant sold by the waist directly. Between two sizes, the
shopper's
fitdecides, then how the product runs and its cut.
A size the shopper wears at the product's own store is their size there, with nothing to convert. A store with no size guide we can read gets the label they wear, as a hedged guess.
What is read
What you send is laid over what the profile keeps, yours winning: a
size for the same brand and kind replaces the kept one, and each
measurement sent replaces the kept one. Send no token to size from the
request alone. With save: true what you sent is kept on the profile
(as remember would); without a
token a profile is made for it and its token returned.
Each product is sized under its store's own rules: a brand the store chose to leave out is not read, and a store that turned sizes from other brands off is sized from measurements only.
Reading the answer
confidence is certain when the sizes agree or the measurements
decide it: say the size plainly. hedged names its one reason in
basis (between sizes, their sizes disagree, one weak source, no
chart): say it as a best guess. Between two sizes, options holds
both, each with what it gives. inStock is whether the recommended
size is in stock now.
When there is nothing to size from (no sizes or measurements sent or
kept), each result's size is null and needs says what to ask
for: sizes and measurements, or only measurements when the
product's store does not size from other brands.
Headers
1The shopper's profile token, from auth/start, auth/verify or any call that made a profile. Optional here.
Request body
application/jsonrequiredThe products to size, as full itemIds. Duplicates are sized once; ids not in your active catalogue are listed in unknown.
Sizes they wear at other brands (or at the product's own store). Laid over the profile's, one per brand and kind.
The brand as they said it. Spelling is forgiven ("levis", "Levi's 501", "h&m").
What the size is for. Null or omitted when they did not say.
topsjeanstrousersdressesouterwearsuitsnullThe size as they said it ("M", "30", "32x32", "US 6", "UK 10", "40R").
How that size fits them. Null or omitted for "it fits".
tightrightloosenullBody measurements, laid over the profile's one by one. Same keys and ranges as remember's body, without fit.
Bust or chest.
Natural waist.
Hips at the widest.
Inside leg.
Height. Kept with save; sizes nothing.
The unit of the measurements. Required with any measurement.
cminHow they like things to fit. Decides between two sizes. Else the profile's.
fittedregularrelaxedWhose brand charts to read the sizes on. Else each product's own department.
womensmensThe shopper's two-letter country, so inStock is their market's stock.
Keep the sizes, measurements and fit sent on the profile. Without a token, a profile is made and its token returned.
Response
One per product found, in the order asked.
The product.
The product's name.
The size to buy, as the product labels it. Null when it could not be sized.
The other size worth considering, on a hedged answer only, and only one in stock.
Between two sizes, both, the recommended first, each with what it gives.
certain: say it plainly. hedged: a best guess, for the reason in basis.
certainhedgednullWhy it is this sure, in a few words (agree, one source, measured, between sizes, one weak source, conflict, no store chart, their size with us).
One line of why, in the second person, in the store's voice ("Your 30 waist at Levi's: our 30 is your size.").
Whether the recommended size is in stock now. Null with no size.
Present and true when their measurements are past the largest size this is made in.
Present when the sizes given do not say what this garment's chart needs ("jeans or trousers").
Ids that are not products in your active catalogue. Present only when there are some.
Sizes that could not be read (a brand we hold no chart for, a size not on its chart). Present only when there are some.
The size as read ("30 at Levi's").
Why it was not read.
Present when there was nothing to size any product from. What to ask the shopper for.
sizesmeasurementsPresent when save was sent. true when something was kept.
Only when save made a profile. Keep it.
Errors
39Every error is JSON with a single error string unless noted. Match on the status code; the message is for humans.
Request body must be valid JSON.The request body could not be parsed as JSON.
Request body must be a JSON object.The request body is empty, or parsed to something other than a JSON object.
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. Leave it out to size from the request alone.
No active datasets found for this organization. Activate one via the dashboard (Dataset → Settings) or through the REST API before proceeding.None of your datasets is active.
itemIds must be a non-empty array.itemIds is missing, not an array, or empty.
itemIds can hold at most 24 ids.itemIds holds more than 24 ids.
Each itemId must be a non-empty string.An entry of itemIds is not a string, is blank, or is longer than 100 characters.
sizes must be an array.sizes was sent (non-null) but is not an array.
sizes can hold at most 8 sizes.sizes holds more than 8 entries.
sizes[<i>] must be an object.An entry of sizes is not an object.
sizes[<i>].brand must be a brand name of 1–60 characters.An entry's brand is missing, blank or too long.
sizes[<i>].label must be a size of 1–20 characters, as the brand writes it.An entry's label is missing, blank or too long.
sizes[<i>].kind must be one of tops, jeans, trousers, dresses, outerwear, suits.An entry's kind is another value.
sizes[<i>].fit must be tight, right or loose.An entry's fit is another value. A profile's small and large are also read, as tight and loose.
measurements.<key> must be between <low>–<high> cm.A measurement is outside what a person can have (in inches when unit is in). measurements is checked as remember's body is, with measurements. in each message, and takes no fit.
fit must be one of fitted, regular, relaxed.fit is another value.
department must be womens or mens.department is another value.
country must be a two-letter ISO 3166 country code, such as 'US'.country was sent (non-null) but is not two letters.
save must be a boolean.save was sent but is not true or false.
Validation failed.More than one field is invalid. details lists each, by path; nothing is sized or kept.
{
"error": "Validation failed.",
"details": [
{
"path": "itemIds",
"message": "itemIds must be a non-empty array."
},
{
"path": "sizes[0].kind",
"message": "sizes[0].kind must be one of tops, jeans, trousers, dresses, outerwear, suits."
}
]
}curl -X POST "https://stylor.ai/api/v1/shoppers/me/size" \
-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"
],
"sizes": [
{
"brand": "Levi'\''s",
"kind": "jeans",
"label": "30"
}
]
}'{
"results": [
{
"itemId": "701e5cee-41da-4e91-a688-69e8c8dd5fe3",
"name": "Straight-Leg Jean — Washed Blue",
"size": "30",
"runnerUp": null,
"confidence": "certain",
"basis": "one source",
"reason": "Your 30 waist at Levi's: our 30 is your size.",
"inStock": true
},
{
"itemId": "35a725c8-23fb-4009-a52a-2a778d2e504a",
"name": "SLIM JEAN DENIM",
"size": "30",
"runnerUp": null,
"confidence": "certain",
"basis": "one source",
"reason": "Your 30 waist at Levi's: our 30 is your size.",
"inStock": false
}
]
}