Skip to main content

POST /tryon-api

Generate a virtual try-on by combining a shopper photo with a product image. The call is synchronous: the response arrives when the image is generated, which can take over a minute. Set your HTTP client timeout to at least 150 seconds (see Limits and quotas).

Endpoint

Request body

Image formats

Both userPhoto and productImage accept a public http(s) URL or a Base64 string. Each image must be at least 1 KB once decoded; smaller files are rejected with a 400. URLs must be publicly reachable: Wearo fetches them with a 30 second timeout. URL (recommended for server-to-server):
Base64 with data URI prefix:
Base64 raw (without prefix):

Wedding-dress mode (train rendering)

The try-on engine normally drops the train of long / wedding gowns. Set productType: "wedding-dress" to render the full gown including the train spread on the floor. Example request
Only productType: "wedding-dress" is specific to bridal mode — every other field is identical to a standard try-on.

Train evaluation and refunds

After generation, the engine scores how well the train (the gown’s trailing fabric) was rendered. The verdict is returned in the bridal object:
  • bridal.applied: true → the train was rendered satisfactorily. 2 credits are consumed.
  • bridal.applied: false → the train was not rendered (low trainScore). No credit is consumed — both credits are refunded and the result is still delivered without regeneration.
This mode consumes 2 credits (a standard try-on consumes 1). If your balance holds only 1 credit, the request fails with 402 and nothing is charged.
  • If the train verdict is unsatisfactory (bridal.applied: false) → both credits are refunded (no credit consumed).
  • If the generation fails outright → both credits are refunded.
  • If the bridal pre-processing crashes → the request fails with 503 bridal_preprocessing_failed and both credits are refunded. There is no fallback to a standard try-on.

Best results

  • Both the customer and the gown photos should be full-length, front-facing, standing.
  • A cropped, angled, or partial customer photo noticeably degrades the result.

Success response — 200 OK

Train not rendered (verdict fail)

When bridal.applied is false, the train was not rendered. Both credits are refunded and the result is still delivered — there is no regeneration.
trainScore is null when the scoring step is unavailable. The result is still delivered (bridal.applied: true), with the 2 credits consumed, because the verdict could not be evaluated.

Error responses

Errors are JSON objects with an error message, and for some cases an errorCode or code. Credits consumed by a request that then fails are refunded automatically. If the wedding-dress pre-processing crashes, the request returns:
HTTP 503 — generation is cancelled and fully refunded.
A 404 from Cloudflare ({"error":"requested path is invalid"}, with a CF-RAY header) means the request URL is wrong — not a Wearo error. Double-check the path is /functions/v1/tryon-api and that your key is sent as the X-API-Key header, never as a query parameter.
Full error reference →

Code examples

See Code examples → for curl, Node, Python, PHP, and Ruby.