API Reference
Complete reference for the Fitting Widget API
API Reference
window.fitting('init', options)
Initializes the widget. Call this once, before any other methods.
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your widget API key |
window.fitting('init', {
apiKey: 'pk_live_xxx',
});
window.fitting('create', options)
Opens the virtual try-on experience.
| Parameter | Type | Required | Description |
|---|---|---|---|
targetElementId | string | Yes | ID of the container element where the widget renders |
tryonItems | TryonItem[] | Yes | Array of items available for try-on |
model | 'balanced' | 'quality' | 'speed' | No | Rendering model (default: 'balanced') |
TryonItem
| Field | Type | Description |
|---|---|---|
productName | string | Display name of the garment |
url | string | Full URL to the garment image |
window.fitting('create', {
targetElementId: 'widget-container',
model: 'balanced',
tryonItems: [
{
productName: 'Denim Jacket',
url: 'https://example.com/jacket.png',
},
],
});