- Widget (Recommended) - Drop-in JavaScript solution for any website
- Direct API - Server-to-server integration for custom implementations
Table of Contents
Quick Start (Widget)
The Wearo Widget is the fastest way to add virtual try-on to your store. It automatically injects a “Try it on” button on your product images.Installation
Add the following script to your HTML, preferably before the closing</body> tag:
Complete Example
Configuration Options
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | Yes | - | Your Wearo API key (starts with tryonai_) |
productSelector | string | No | img[data-product-image], img.product-image, .product-image img, .product__image img, .product__media img | CSS selector to find product images |
triggerSelector | string | No | - | Custom CSS selector for button container placement |
triggerText | string | No | Auto-detected | Button label text. Auto-detects browser language: “Try it on you” (EN) or “Essayer sur moi” (FR) |
brandColor | string | No | #000000 | Your brand color in hex format (#RRGGBB) |
productId | string | No | - | Product identifier for analytics tracking |
variantId | string | No | - | Variant identifier (useful for Shopify integrations) |
Brand Color Customization
ThebrandColor parameter lets you match the widget to your brand identity:
- Accepts 6-digit hex colors only (e.g.,
#FF5733,#1A1A1A) - Automatically generates hover state (+8% lightness) and active state (-8% lightness)
- If not specified, defaults to an elegant dark theme (
#1a1a1a)
Platform-Specific Selectors
Shopify:Direct API Reference
For headless implementations or server-to-server integrations, use the Direct API.Endpoint
Authentication
All requests must include your API key in theX-API-Key header:
Headers
| Header | Required | Description |
|---|---|---|
X-API-Key | Yes | Your Wearo API key |
Content-Type | Yes | Must be application/json |
Origin | Conditional | Required if domain whitelist is configured for your API key |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
userPhoto | string | Yes | Customer photo - accepts URL or Base64 (see formats below) |
productImageUrl | string | Yes | Public URL of the clothing/product image |
clothingType | string | No | Clothing category (e.g., “T-shirt”, “Dress”, “Jacket”) |
userPhoto Formats
TheuserPhoto field accepts multiple formats:
URL (Recommended for server-to-server):
Success Response
HTTP 200 OK| Field | Type | Description |
|---|---|---|
success | boolean | Always true for successful requests |
tryOnId | string | Unique identifier for this try-on generation |
resultUrl | string | Public URL of the generated try-on image (permanent, no expiration) |
creditsRemaining | number | Your remaining credit balance after this request |
cURL Example
JavaScript/Node.js Example
Python Example
Billing & Credits
How Credits Work
- 1 successful generation = 1 credit
- Credits are consumed only when a try-on image is successfully generated
- Results are permanently stored and accessible via the
resultUrl
Automatic Refund Protection
Our billing system includes automatic refund protection:If a generation fails due to a technical error, your credit is automatically refunded.This covers:
- AI generation failures
- Image upload errors
- Network timeouts
- Server errors
Account Status
| Status | Plan Credits | PAYG Credits | Action Required |
|---|---|---|---|
| Active | Available | Available | None |
| Past Due | Frozen | Available | Update payment method |
| No Credits | Depleted | Depleted | Purchase credits |
Troubleshooting
Error Response Format
All error responses follow this format:Error Codes Reference
| HTTP Status | Error Message | Cause | Solution |
|---|---|---|---|
| 400 | userPhoto (base64 or URL) and productImageUrl are required | Missing required fields | Ensure both userPhoto and productImageUrl are provided |
| 400 | Failed to fetch user photo from URL | Invalid or inaccessible userPhoto URL | Verify the URL is publicly accessible and returns an image |
| 400 | Failed to fetch product image from URL | Invalid or inaccessible productImageUrl | Verify the URL is publicly accessible and returns an image |
| 401 | API key is required. Provide it in the X-API-Key header. | Missing API key header | Add X-API-Key header to your request |
| 401 | Invalid API key | API key not found | Check your API key for typos |
| 402 | Insufficient credits. Please purchase more credits. | No credits remaining | Purchase more credits in your dashboard |
| 402 | Payment past due... | Subscription payment failed | Update your payment method |
| 403 | API key is inactive | API key was deactivated | Contact support or create a new key |
| 403 | Domain not authorized for this API key | Request origin not in whitelist | Add your domain to the API key’s allowed domains list |
| 403 | Origin header required when domain restrictions are active | Missing Origin header | Add Origin header with your domain |
| 500 | AI generation failed | AI model error | Retry the request; contact support if persistent |
| 500 | Failed to save result | Storage error | Retry the request; contact support if persistent |
| 500 | Server configuration error | Internal server issue | Contact support |
Common Issues
Widget button not appearing
-
Check the product selector: Open browser DevTools and verify your image matches the selector
- Image too small: The widget doesn’t inject on images smaller than 150px wide (to avoid cluttering thumbnails)
-
Check console for errors: Look for
[TryOnWidget]messages in the browser console
API returns 403 “Domain not authorized”
If you’ve configured domain restrictions on your API key:- Ensure the
Originheader matches a whitelisted domain - Subdomains are automatically allowed (e.g., if
example.comis whitelisted,shop.example.comworks) - For server-to-server calls without a browser, consider removing domain restrictions or adding your server’s domain
Image quality issues
- Use high-resolution photos (minimum 500x500px recommended)
- Ensure good lighting in customer photos
- Use product images with clean backgrounds
Support
- Email: [email protected]
- Documentation: https://docs.wearo.io
- Dashboard: https://wearo.io/dashboard
Last updated: February 2026