Size recommendations
Submit answers once and return the recommended size, supporting evidence and limitations.
Generate a recommendation
curl --fail-with-body -X POST "$METR_API_URL/v1/stores/$STORE_ID/fit-sessions/$SESSION_ID/recommendations" \
-H "Authorization: Bearer $METR_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"answers": {
"usual_size": "M",
"size_consistency": "consistent",
"preferred_fit": "regular",
"measurements": {
"chest": 98,
"shoulders": 45
}
}
}'Response
{
"id": "rec_example",
"session_id": "fit_example",
"recommended_size": "M",
"probabilities": {
"S": 0.048,
"M": 0.904,
"L": 0.048
},
"variant_ids": [
"var_medium"
],
"confidence": 0.9,
"confidence_meaning": "uncalibrated_evidence_score",
"fit": {
"chest": "within_range",
"shoulders": "within_range"
},
"evidence": {
"chest": {
"source": "measurement",
"chart_min_cm": 98,
"chart_max_cm": 98,
"body_cm": 98.0
},
"shoulders": {
"source": "measurement",
"chart_min_cm": 45,
"chart_max_cm": 45,
"body_cm": 45.0
}
},
"explanation": "M best matches measurement, usual size against this chart.",
"warnings": [
"Confidence is an uncalibrated evidence score, not a probability of fit."
],
"algorithm_version": "metr-fit-2.0.0",
"method": "rules",
"chart_id": "cht_example",
"chart_revision": 1,
"created_at": "2026-10-01T12:00:00Z"
}variant_ids contains currently available variants matching the recommended chart size and session color. Fit is unknown for body areas without a supplied measurement. Body charts describe below_range, within_range or above_range; garment charts describe the estimated ease or length relationship.
What confidence means
probabilities spreads belief over the available sizes. confidence is the chosen size's probability, clamped to 0.15–0.90 (0.60 without a tape measurement or reference brand). It is an uncalibrated evidence score, not the probability a size will fit. method is rules, or rules+jev when Jev chose among the plausible sizes. If Jev is unavailable the rules estimate is returned with a warning. Do not turn confidence into a ‘91% accurate’ claim.
Record the decision
curl --fail-with-body -X POST "$METR_API_URL/v1/stores/$STORE_ID/fit-sessions/$SESSION_ID/complete" \
-H "Authorization: Bearer $METR_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"decision": "accepted",
"chosen_variant_id": "var_medium"
}'- accepted: selected variant has the recommended size.
- overridden: selected variant has a different available size for the same product and session color.
- declined: no chosen_variant_id; the customer did not select a recommendation.
Retries and fallback
Identical recommendation retries return the same persisted response. Changed answers return 409: start another session. Identical completion retries are also safe. Recommendations do not reserve stock. Recheck availability before adding to cart. On no_suitable_size, missing approval, insufficient evidence, timeout or an unavailable service, show the merchant’s size chart and keep checkout available.