Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.wearo.io/llms.txt

Use this file to discover all available pages before exploring further.

Code examples

curl

curl -X POST "https://api.wearo.io/v1/tryon" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: wearo_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Origin: https://mystore.com" \
  -d '{
    "userPhoto": "https://example.com/customer-photo.jpg",
    "productImageUrl": "https://mystore.com/products/blue-shirt.jpg",
    "clothingType": "T-shirt"
  }'

Node.js

const response = await fetch(
  'https://api.wearo.io/v1/tryon',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': 'wearo_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'Origin': 'https://mystore.com'
    },
    body: JSON.stringify({
      userPhoto: 'https://example.com/customer-photo.jpg',
      productImageUrl: 'https://mystore.com/products/blue-shirt.jpg',
      clothingType: 'T-shirt'
    })
  }
);

const data = await response.json();

if (data.success) {
  console.log('Try-on image:', data.resultUrl);
  console.log('Credits remaining:', data.creditsRemaining);
} else {
  console.error('Error:', data.error);
}

Python

import requests

response = requests.post(
    'https://api.wearo.io/v1/tryon',
    headers={
        'Content-Type': 'application/json',
        'X-API-Key': 'wearo_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        'Origin': 'https://mystore.com'
    },
    json={
        'userPhoto': 'https://example.com/customer-photo.jpg',
        'productImageUrl': 'https://mystore.com/products/blue-shirt.jpg',
        'clothingType': 'T-shirt'
    }
)

data = response.json()

if data.get('success'):
    print(f"Try-on image: {data['resultUrl']}")
    print(f"Credits remaining: {data['creditsRemaining']}")
else:
    print(f"Error: {data.get('error')}")

PHP

<?php
$response = file_get_contents('https://api.wearo.io/v1/tryon', false, stream_context_create([
    'http' => [
        'method' => 'POST',
        'header' => implode("\r\n", [
            'Content-Type: application/json',
            'X-API-Key: wearo_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
            'Origin: https://mystore.com'
        ]),
        'content' => json_encode([
            'userPhoto' => 'https://example.com/customer-photo.jpg',
            'productImageUrl' => 'https://mystore.com/products/blue-shirt.jpg',
            'clothingType' => 'T-shirt'
        ])
    ]
]));

$data = json_decode($response, true);

if ($data['success']) {
    echo "Try-on image: " . $data['resultUrl'];
} else {
    echo "Error: " . $data['error'];
}

Ruby

require 'net/http'
require 'json'
require 'uri'

uri = URI('https://api.wearo.io/v1/tryon')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'wearo_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
request['Origin'] = 'https://mystore.com'
request.body = {
  userPhoto: 'https://example.com/customer-photo.jpg',
  productImageUrl: 'https://mystore.com/products/blue-shirt.jpg',
  clothingType: 'T-shirt'
}.to_json

response = http.request(request)
data = JSON.parse(response.body)

if data['success']
  puts "Try-on image: #{data['resultUrl']}"
else
  puts "Error: #{data['error']}"
end