API Documentation
Complete reference for integrating TryOnCloud virtual try-on into your applications
Getting Started
Quick start guide and authentication
API Reference
Endpoints, parameters, and responses
Code Examples
Sample implementations in various languages
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: tryoncloud_live_abc123def456...Base URL
https://www.tryoncloud.com/apiRate Limits
Rate limits are based on your subscription plan. Free plan: 20 generations/month, Starter: 200/month, Pro: 1,000/month, Enterprise: custom limits.
Usage is tracked atomically to prevent quota overruns. When you reach your limit, requests will return a 429 status code.
API Reference
/api/tryonGenerate a virtual try-on image by compositing a person photo with a product image.
Headers
| Name | Type | Description |
|---|---|---|
| x-api-key | string | Your TryOnCloud API key (required) |
| Content-Type | string | multipart/form-data |
Parameters
| Name | Type | Description |
|---|---|---|
| person | file | Photo of the person (JPEG, PNG, WebP, max 10MB) |
| product | string | URL of the product image from registered domain |
Response (200 OK)
{
"success": true,
"result": "https://tryoncloud.com/results/abc123.jpg",
"remainingGenerations": 18
}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 APIconst 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': 'tryoncloud_live_abc123...'
},
body: formData
})
const result = await response.json()
console.log(result.result) // Try-on image URLPython
Requestsimport requests
headers = {
'x-api-key': 'tryoncloud_live_abc123...'
}
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 URLPHP
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: tryoncloud_live_abc123...'
],
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)
Shellcurl -X POST https://www.tryoncloud.com/api/tryon \ -H "x-api-key: tryoncloud_live_abc123..." \ -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?
Our support team is here to help you integrate TryOnCloud successfully