Documentation
Virtual try-on API
Show your customers wearing your clothes, shoes and jewellery on their own photo, on your website or in your app. Use the REST API from any language, or add a no-code button to your shop.
How it works
- 1. Your server sends TryOnU a photo of your customer and a photo of your product.
- 2. TryOnU dresses the customer in the product with AI. It takes about 20–60 seconds.
- 3. You get back a picture of your customer wearing it, to show on your site or app.
Each try-on uses 1 credit. A failed try-on gives the credit back. Credits never expire.
Add a "Try it on" button to your shop
No coding. Shoppers press the button, add a photo and see themselves in your product. It uses a website key (tou_pk_…) that works only on your website.
- 1In this portal, open API keys and create a Website key with your shop's address (for example
yourshop.com). Buy credits: 1 credit = 1 try-on. - 2Paste the code below into your product page (on Wix: Add → Embed code → Custom code). Leave
data-tryonu-garmentempty to use the page's main picture.
<script src="https://tryonu.app/widget.js" data-key="tou_pk_YOUR_WEBSITE_KEY" defer></script>
<button data-tryonu-garment="https://your-shop.com/product-photo.jpg" data-tryonu-name="Product name"></button>Code for your platform (server API)
# 1. Start a try-on (photos as files)
curl -X POST https://api.tryonu.app/api/v1/public/tryons \
-H "Authorization: Bearer $TRYONU_API_KEY" \
-F person_image=@customer.jpg \
-F garment_image=@dress.jpg \
-F reference=order-123
# ...or as public links (JSON)
curl -X POST https://api.tryonu.app/api/v1/public/tryons \
-H "Authorization: Bearer $TRYONU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"person_image_url": "https://your-site.com/customer.jpg",
"garment_image_url": "https://your-site.com/dress.jpg"}'
# 2. Ask until "status" is "completed" (about 20-60 seconds)
curl https://api.tryonu.app/api/v1/public/tryons/TRYON_ID -H "Authorization: Bearer $TRYONU_API_KEY"
# Credits left
curl https://api.tryonu.app/api/v1/public/credits -H "Authorization: Bearer $TRYONU_API_KEY"Keep your secret key (tou_sk_…) on your server. Never put it in a web page or an app.
Reference
Base address: https://api.tryonu.app/api/v1/public
Key: header Authorization: Bearer tou_sk_… (or X-API-Key: tou_sk_…)
POST /tryons— start a try-on. Filesperson_image+garment_image, or JSONperson_image_url+garment_image_url. Optional:garment_name,reference.GET /tryons/{id}— the try-on's status and result.GET /credits— credits left.- Website widget (browser, website key in
X-TryOnU-Key, only from the key's domains):POST /widget/tryonsandGET /widget/tryons/{id}. Each visitor can make a few try-ons an hour.
Best photos: the customer standing, facing the camera, well lit; the product alone on a plain background. JPEG or PNG, up to 15 MB.
What a try-on returns
- id
- The try-on's id. Use it to ask for the result.
- status
- queued → processing → completed, or failed.
- result_image_url
- The finished picture, once completed. Download and keep it: the link expires.
- error
- Why it failed (a failed try-on gives the credit back).
- reference
- Your own reference, returned as you sent it.
- credits_used
- 1 per try-on, 0 if it failed.
- credits_left
- Your balance, on the reply to a new try-on.
Errors
- 400
- A photo is missing, isn't an image, or its link isn't a public web address.
- 401
- No API key, a wrong key, or a revoked key.
- 402
- No credits left. Buy a pack in the developer portal.
- 403
- The developer account is suspended, or (website key) the page isn't on one of the key's domains.
- 404
- No try-on with that id on your account.
- 429
- Too many requests, or TryOnU's daily capacity is reached. Nothing was charged; try again later.