- One call per answer. Send the product and what the shopper told you; get the size back.
- The API tells you what to ask. Missing answers come back as localized questions, so your bot never guesses which information Kleep needs.
- Ready-to-say results. Every recommendation includes a one- or two-sentence
summaryin the shopper’s language, plus structured fields if you want to phrase it yourself. - Profiles follow the shopper. A shopper who already used Kleep on the retailer’s website gets their size without any question, and a profile created in chat is reused on the website.
The Partner API is in early access. Contact support@kleep.ai to get a sandbox API key and a test retailer.
What shoppers can ask
Every endpoint, with request and response schemas and a live playground, is in the Partner API reference in the sidebar.
Concepts
Authentication
Send your API key as a bearer token and the retailer inKleep-Retailer:
Enable a retailer
A retailer turns on your platform once, from the Kleep dashboard (Settings → Integrations) or by asking its Kleep representative. Until then, calls for that retailer return403 retailer_not_enabled. Store the retailer’s public_id in your per-retailer settings: the retailer finds it in the same dashboard screen.
Quickstart: one size in one call
1
Send the product and what you know
2
Ask what's missing
Kleep answers Ask them in one message, in your bot’s own voice: “To find your size, could you tell me your height, weight and age?”
422 with the questions to ask, already localized:3
Send the answers, get the size
Call again with the answers in Say the
measurements:summary, or build your own sentence from size, fit and alternatives.4
Keep the profile
Store
profile_id with the conversation, or with the shopper’s record if you know who they are. Next time, send "shopper": { "profile_id": "prf_3Nf8sLw1Qz" } and skip the questions, for any product of that retailer.Design the conversation
When to offer size help
CallGET /products/{product_id}/sizing as soon as the conversation is about a product. Offer size help only when supported is true. When it is false, answer from the product page’s size chart or hand over to a human.
What Kleep asks
You don’t need to hard-code questions:missing_inputs tells you what is missing. To script them yourself, GET /questions?category=clothing returns the full list in order. For clothing:
Body-shape answers improve accuracy. Ask them only if the shopper is happy to answer more: a skipped answer counts as
medium. Lingerie also needs bra.band and bra.cup; missing_inputs asks for them when the product requires it.
Shoppers Kleep already knows
At the start of a conversation with an identified shopper, look them up withGET /profiles?customer_id=… (the retailer’s customer ID) or GET /profiles?email=…. A 200 means the shopper already has a Kleep profile, for example from the retailer’s website: send its profile_id and answer without a single question. A 404 profile_not_found means you ask the questions as usual.
When you know the shopper’s customer_id, send it in shopper.customer_id on recommendations too. The profile created in chat then follows the shopper on the retailer’s website.
Corrections and forgetting
- “Actually I’m 170 cm”:
PATCH /profiles/{profile_id}with the new value, then ask for the recommendation again. - “Forget my measurements”:
DELETE /profiles/{profile_id}erases them.
Phrase the answer
- Lead with the size: “I’d recommend an M.”
- Add one fit detail in plain words, from
fit: “It should feel slightly snug at the hips.” - Offer the alternative only when the shopper hesitates between sizes or mentions how they like the fit.
- If
size.availableisfalse, say so and offer the alternative if it’s available, or a back-in-stock alert if the retailer has one. - Never invent or adjust a size the API didn’t return. If the call fails, say you can’t check the size right now and point to the size chart.
Answer “does it run small?”
GET /products/{product_id}/sizing returns product_fit without any shopper data:
tendency is one of runs_very_small, runs_small, true_to_size, runs_large, runs_very_large. product_fit is null when Kleep doesn’t have enough data on the product: don’t make a claim then. If the shopper wants a size for themselves, move to POST /recommendations.
Use it from an AI agent
Expose two tools to your model. Your backend implements each one with a single API call, adds the API key andKleep-Retailer, and stores profile_id.
Tool definitions
Reference implementation (Node 18+)
kleep_recommend_size right away, gets the questions back, asks them, and calls again with the answers. Your code never decides what to ask.
Measure the impact
Report what happens after a recommendation withPOST /events. The retailer then sees the conversations’ effect on sales and returns in the Kleep dashboard, next to its website:
Always include the
recommendation_id. Sending conversation_id on recommendations lets Kleep match later orders even when you can’t send order_placed yourself.
Errors and limits
Errors share one format. Branch onerror.code, never on message:
Use an 8-second timeout per call. Each API key gets a rate limit per retailer that comfortably covers live conversations; contact Kleep before running batch jobs.
POST /profiles accepts an Idempotency-Key header so retries never create duplicates.
Privacy
Height, weight and age are personal data. Kleep processes them for the retailer, as its data processor, only to compute sizes for that retailer, and stores them in the EU.- Say why you ask before asking: “to find your size in this store”.
- Let the shopper decline: answer with
product_fitand the size chart instead. - Keep the
profile_id, not the raw answers. You don’t need to store measurements on your side. - Honour “forget me” with
DELETE /profiles/{profile_id}.
Sandbox
Your sandbox key (kp_test_…) works with a test retailer that Kleep shares with you, with a sample catalog of products and a few known shoppers for GET /profiles. Responses have the same shape as production. Use it in your automated tests: sandbox calls never affect retailer data or dashboards.
