Virtual TryOn API Documentation

Complete reference for integrating TryOnCloud virtual TryOn into your applications. New to the platform? Start with the setup tutorial or browse the FAQ.

Getting Started

Authentication

All API requests must include your API key in the x-api-key header. You can generate an API key from your dashboard after creating an account.

Header Format:

x-api-key: YOUR_API_KEY

Base URL

https://www.tryoncloud.com/api

Rate Limits

Usage limits vary by plan. See our Pricing page for current plan details.

Usage is tracked atomically to prevent quota overruns. When you reach your limit, requests will return a 429 status code.

API Reference

POST/api/tryon

Generate a virtual TryOn image by compositing a person photo with a product image.

Headers

NameTypeDescription
x-api-keystringYour TryOnCloud API key (required)
Content-Typestringmultipart/form-data

Parameters

NameTypeDescription
personfilePhoto of the person (JPEG, PNG, WebP, max 10MB)
productstringURL of the product image from registered domain

Response (200 OK)

{
  "success": true,
  "result": "https://tryoncloud.com/results/abc123.jpg"
}

Error Responses

401 Unauthorized

{
  "error": "Invalid or missing API key"
}

429 Too Many Requests

{
  "error": "Generation limit exceeded",
  "resetDate": "2026-03-01T00:00:00Z"
}

403 Forbidden

{
  "error": "Product URL domain not registered"
}

Code Examples

JavaScript / Node.js

Fetch API
const formData = new FormData()
formData.append('person', personFileBlob)
formData.append('product', 'https://mystore.com/product.jpg')

const response = await fetch('https://www.tryoncloud.com/api/tryon', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY'
  },
  body: formData
})

const result = await response.json()
console.log(result.result) // Try-on image URL

Python

Requests
import requests

headers = {
    'x-api-key': 'YOUR_API_KEY'
}

files = {
    'person': open('person.jpg', 'rb')
}

data = {
    'product': 'https://mystore.com/product.jpg'
}

response = requests.post(
    'https://www.tryoncloud.com/api/tryon',
    headers=headers,
    files=files,
    data=data
)

result = response.json()
print(result['result'])  # Try-on image URL

PHP

cURL
<?php
$curl = curl_init();

$file = new CURLFile('person.jpg', 'image/jpeg', 'person');

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://www.tryoncloud.com/api/tryon',
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'x-api-key: YOUR_API_KEY'
    ],
    CURLOPT_POSTFIELDS => [
        'person' => $file,
        'product' => 'https://mystore.com/product.jpg'
    ],
    CURLOPT_RETURNTRANSFER => true
]);

$response = curl_exec($curl);
$result = json_decode($response, true);

echo $result['result']; // Try-on image URL
curl_close($curl);
?>

cURL (Command Line)

Shell
curl -X POST https://www.tryoncloud.com/api/tryon \
  -H "x-api-key: YOUR_API_KEY" \
  -F "person=@person.jpg" \
  -F "product=https://mystore.com/product.jpg"

Best Practices

Secure Your API Keys

  • • Never expose API keys in client-side code
  • • Store keys in environment variables
  • • Rotate keys periodically
  • • Use different keys for dev/production

Domain Registration

  • • Register all domains serving product images
  • • Include both www and non-www versions
  • • Update domains when migrating stores
  • • Verify domain ownership via dashboard

Image Quality

  • • Use high-resolution images (min 512x512px)
  • • Ensure good lighting and contrast
  • • Avoid heavily compressed images
  • • Test with various product types

Error Handling

  • • Always check response status codes
  • • Handle quota exceeded gracefully
  • • Display user-friendly error messages
  • • Implement retry logic with backoff

Need Help Integrating Virtual TryOn?

Our support team is here to help. View the setup tutorial for a step-by-step walkthrough, or check pricing for your usage tier.