Endpoints
Create try-on (sync)
The same as Create try-on, except the server holds the request open until the image is ready — up to about 55 seconds — so most of the time one call is all you need.
POSThttps://fabricvton-api.onrender.com/api/v1/tryons/sync
Request
Headers and body are exactly the same as for Create try-on, including the Idempotency-Key.
Headers
| Header | Type | Description |
|---|---|---|
Authorization | required | Bearer followed by your API key. |
Idempotency-Key | required | 8–128 characters: letters, digits, _ or -. Use a new one for each try-on (a UUID is ideal) and the same one when you retry. A key you've already used gives you back that earlier try-on instead of starting — and charging for — another. |
Content-Type | required | application/json |
Body
Give each image either as a URL or as the id of an image you uploaded — exactly one of the two for the person, and exactly one for the garment. You can mix them: an uploaded shopper photo with a garment URL from your CDN is the most common pairing.
| Field | Type | Description |
|---|---|---|
personImageUrl | string | HTTPS URL of a photo of one adult, ideally full-length and facing the camera. |
personImageId | string | Instead of personImageUrl: an img_… id from POST /images, uploaded by this account in the last 24 hours. |
garmentImageUrl | string | HTTPS URL of the product photo. One garment per image works best. |
garmentImageId | string | Instead of garmentImageUrl: an uploaded image id. |
title | string, optional | The product's name, such as “Linen summer dress”, up to 120 characters. It tells the engine what kind of garment it is placing, which improves the fit and placement. |
consent | boolean, required | Must be true. By sending it you confirm the person in the photo is an adult who agreed to the photo being used for a try-on, and that you have the rights to use both images. |
Rules for image URLs
- HTTPS on the default port.
- The URL returns the image itself with HTTP 200. Redirects are not followed.
- It responds within 12 seconds.
- The file is a JPEG or PNG, no larger than 4 MB.
Signed URLs are fine as long as they're still valid when the request arrives. Uploaded images skip these rules entirely, which is one reason to prefer them for shopper photos.
Set a long enough timeout
Give your HTTP client a timeout of at least 70 seconds. Many clients default to 30 seconds, which would cut the connection while the image is still being made. If your connection drops anyway, nothing is lost: the try-on carries on, and repeating the request with the same Idempotency-Key picks it back up without a second charge.
Example
curl -X POST https://fabricvton-api.onrender.com/api/v1/tryons/sync \
--max-time 75 \
-H "Authorization: Bearer $CLOTHSY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"personImageId": "img_5Hq2mV8xKc3TnR7w",
"garmentImageUrl": "https://your-cdn.example.com/denim-jacket.jpg",
"title": "Cropped denim jacket",
"consent": true
}'Response
When the try-on finishes within the wait, you get 200 with its final state — the same shape as Get try-on:
{
"id": "7f3c2a9e-1d4b-4c1e-9a55-2b8f0c6d4e10",
"status": "success",
"resultUrl": "https://fabricvton-api.onrender.com/i/eyJ..."
}{
"id": "7f3c2a9e-1d4b-4c1e-9a55-2b8f0c6d4e10",
"status": "failed",
"resultUrl": null,
"message": "That try-on did not finish. Your credit has been returned."
}| Field | Type | Description |
|---|---|---|
id | string | The try-on's id. |
status | string | success or failed. |
resultUrl | string | null | On success, the finished image. Public, needs no key, and works for 24 hours. |
message | string | On failure, a short explanation. The credit has already been returned. |
If it isn't finished when the wait runs out, you get 202 instead — exactly what Create try-on returns. Carry on by polling pollUrl every 2–3 seconds.
{
"id": "7f3c2a9e-1d4b-4c1e-9a55-2b8f0c6d4e10",
"status": "pending",
"pollUrl": "/api/v1/tryons/7f3c2a9e-1d4b-4c1e-9a55-2b8f0c6d4e10"
}So always handle both: check the HTTP status, and treat 202 as “poll from here”. The SDK's tryons.run() does this for you.
Errors
The same as Create try-on, with the same rate limit of 12 starts a minute per account.
| Status | Code | When |
|---|---|---|
| 400 | MISSING_IDEMPOTENCY_KEY | The Idempotency-Key header is missing or not 8–128 allowed characters. |
| 400 | INVALID_IMAGE_URL | An image URL isn't HTTPS, uses a non-default port, or points at a private address. |
| 400 | IMAGE_DOWNLOAD_FAILED | An image URL didn't return the image with HTTP 200 within 12 seconds (redirects count as failures). |
| 400 | UNSUPPORTED_IMAGE | An image isn't a JPEG or PNG. |
| 400 | INVALID_IMAGE_ID | An image id is unknown, older than 24 hours, or was uploaded by another account. |
| 401 | INVALID_API_KEY | The key is missing, malformed or revoked. |
| 402 | INSUFFICIENT_CREDITS | The account has no credits left. |
| 403 | CONSENT_REQUIRED | consent wasn't true. |
| 413 | IMAGE_TOO_LARGE | An image is larger than 4 MB. |
| 422 | PERSON_PHOTO_REJECTED | The person photo doesn't clearly show exactly one adult. |
| 422 | IMAGE_REJECTED | An image can't be used for a try-on. |
| 422 | GARMENT_REJECTED | This item isn't available for virtual try-on. |
| 429 | RATE_LIMITED | More than 12 try-ons started in a minute. Wait for the Retry-After header. |
| 500 | INTERNAL_ERROR | Something went wrong on our side. Retry with the same Idempotency-Key. |
| 502 | START_FAILED | The try-on couldn't be started and no credit was used. Retry with the same Idempotency-Key. |
| 503 | UNAVAILABLE | Try-on is briefly unavailable. Retry after a short wait. |

