Try-on Docs

API Reference

Complete reference for the Try-on API

API Reference

window.fitting('init', options)

Initializes the widget. Call this once, before any other methods.

ParameterTypeRequiredDescription
apiKeystringYesYour widget API key
window.fitting('init', {
  apiKey: 'pk_live_xxx',
});

window.fitting('create', options)

Opens the virtual try-on experience.

ParameterTypeRequiredDescription
targetElementIdstringYesID of the container element where the widget renders
tryonItemsTryonItem[]YesArray of items available for try-on
displayMode'inline' | 'modal'NoWidget display mode
model'balanced' | 'quality' | 'performance'NoRendering model (default: 'balanced')
onSuccessfunctionNoCallback fired after successful generation
onClosefunctionNoCallback fired after widget is closed

TryonItem

FieldTypeDescription
productNamestringDisplay name of the garment
urlstringFull URL to the garment image
window.fitting('create', {
  targetElementId: 'widget-container',
  model: 'balanced',
  tryonItems: [
    {
      productName: 'Denim Jacket',
      url: 'https://example.com/jacket.png',
    },
  ],
});