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

Good for scripts, batch jobs and back-office tools. In a storefront, prefer Create try-on and polling: a request that hangs for most of a minute is easy to lose to a proxy or platform timeout, and polling lets you show the shopper progress.

Request

Headers and body are exactly the same as for Create try-on, including the Idempotency-Key.

Headers

HeaderTypeDescription
AuthorizationrequiredBearer followed by your API key.
Idempotency-Keyrequired8–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-Typerequiredapplication/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.

FieldTypeDescription
personImageUrlstringHTTPS URL of a photo of one adult, ideally full-length and facing the camera.
personImageIdstringInstead of personImageUrl: an img_… id from POST /images, uploaded by this account in the last 24 hours.
garmentImageUrlstringHTTPS URL of the product photo. One garment per image works best.
garmentImageIdstringInstead of garmentImageUrl: an uploaded image id.
titlestring, optionalThe 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.
consentboolean, requiredMust 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
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:

200 OK — finished
{
  "id": "7f3c2a9e-1d4b-4c1e-9a55-2b8f0c6d4e10",
  "status": "success",
  "resultUrl": "https://fabricvton-api.onrender.com/i/eyJ..."
}
200 OK — failed
{
  "id": "7f3c2a9e-1d4b-4c1e-9a55-2b8f0c6d4e10",
  "status": "failed",
  "resultUrl": null,
  "message": "That try-on did not finish. Your credit has been returned."
}
FieldTypeDescription
idstringThe try-on's id.
statusstringsuccess or failed.
resultUrlstring | nullOn success, the finished image. Public, needs no key, and works for 24 hours.
messagestringOn 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.

202 Accepted — still working
{
  "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.

StatusCodeWhen
400MISSING_IDEMPOTENCY_KEYThe Idempotency-Key header is missing or not 8–128 allowed characters.
400INVALID_IMAGE_URLAn image URL isn't HTTPS, uses a non-default port, or points at a private address.
400IMAGE_DOWNLOAD_FAILEDAn image URL didn't return the image with HTTP 200 within 12 seconds (redirects count as failures).
400UNSUPPORTED_IMAGEAn image isn't a JPEG or PNG.
400INVALID_IMAGE_IDAn image id is unknown, older than 24 hours, or was uploaded by another account.
401INVALID_API_KEYThe key is missing, malformed or revoked.
402INSUFFICIENT_CREDITSThe account has no credits left.
403CONSENT_REQUIREDconsent wasn't true.
413IMAGE_TOO_LARGEAn image is larger than 4 MB.
422PERSON_PHOTO_REJECTEDThe person photo doesn't clearly show exactly one adult.
422IMAGE_REJECTEDAn image can't be used for a try-on.
422GARMENT_REJECTEDThis item isn't available for virtual try-on.
429RATE_LIMITEDMore than 12 try-ons started in a minute. Wait for the Retry-After header.
500INTERNAL_ERRORSomething went wrong on our side. Retry with the same Idempotency-Key.
502START_FAILEDThe try-on couldn't be started and no credit was used. Retry with the same Idempotency-Key.
503UNAVAILABLETry-on is briefly unavailable. Retry after a short wait.