API Documentation

Complete reference for StyleSwap's virtual try-on API

Authentication

All API requests require authentication using your API key. Include it in the request header:

Authorization: Bearer sk_your_api_key

Get your API key from the Developer Portal

Base URL

https://api.styleswap.com/v1

API Endpoints

Create Virtual Try-On

Generate a virtual try-on image for a product

POST /try-ons/create

Create a new virtual try-on

Request Body

{
  "userPhotoUrl": "https://...",
  "garmentImageUrl": "https://...",
  "garmentType": "shirt",
  "size": "M"
}

Response

{
  "id": "tryon_123abc",
  "status": "processing",
  "resultUrl": null,
  "createdAt": "2026-02-11T10:30:00Z"
}

Get Try-On Status

Check the status of a virtual try-on request

GET /try-ons/{id}

Retrieve try-on status and result

Response

{
  "id": "tryon_123abc",
  "status": "completed",
  "resultUrl": "https://cdn.styleswap.com/results/...",
  "createdAt": "2026-02-11T10:30:00Z",
  "completedAt": "2026-02-11T10:31:45Z"
}

Pricing & Credits

StyleSwap uses a credit-based billing model. Each virtual try-on costs 1 credit.

Individual Plans (Pay-as-you-go)

10 try-onsR45 (R4.50/try-on)
20 try-onsR80 (R4.00/try-on)
50 try-onsR150 (R3.00/try-on)

Business Plans (Monthly Subscription)

Reduce Returns. Increase Conversions. Let customers try before they buy.

Boutique Starter – R385 / month
  • • 100 Virtual Try-Ons
  • • Widget integration
  • • Social media landing page
  • • Basic dashboard access
  • • Effective rate: R3.85 per simulation
Boutique Growth – R750 / month
  • • 200 Virtual Try-Ons
  • • Widget + API access
  • • Social media landing page
  • • Usage analytics
  • • Effective rate: R3.75 per simulation
Store Pro – R1,350 / month
  • • 500 Virtual Try-Ons
  • • Full API access/widget integration
  • • Branded try-on experience
  • • Conversion tracking
  • • Effective rate: R2.70 per simulation
Store Scale – R2,200 / month
  • • 1,000 Virtual Try-Ons
  • • Advanced analytics
  • • Full API access
  • • Priority support
  • • Branded try-on experience
  • • Lower per-use rate
  • • Effective rate: R2.20 per simulation
Retailer Pro – R6,250 / month
  • • 5,000 Virtual Try-Ons
  • • API + Custom integration
  • • Dedicated onboarding
  • • Performance reporting
  • • White label option
  • • Effective rate: R1.25 per simulation
Enterprise Retail – R18,600 / month
  • • 20,000 Virtual Try-Ons
  • • Full API integration
  • • White-label option
  • • Dedicated support
  • • Custom SLA
  • • Effective rate: R0.93 per simulation
Enterprise Retail Pro – Custom PricingCUSTOM
  • • Full API integration
  • • White-label option
  • • Dedicated account manager
  • • Custom SLA & support
  • • Priority feature requests
  • • Custom integrations available

Contact [email protected] for custom pricing

Additional simulations billed at plan rate.

Seamless integration via widget, API, or social selling landing page.

Purchase Credits via Yoco

Initiate a credit purchase for your account

POST /billing/initiatePurchase

{
  "packageId": "pkg_100_credits",
  "quantity": 1
}

Note: All credits are valid for 30 days from purchase. Credits are non-refundable once purchased. Additional simulations billed at plan rate.

Webhooks

StyleSwap sends webhook events for important actions. Configure your webhook URL in the Developer Portal.

Event Types

  • tryon.completed - Virtual try-on is ready
  • tryon.failed - Try-on generation failed
  • credit.purchased - Credits were purchased
  • credit.expired - Credits have expired

Webhook Payload Example

{
  "event": "tryon.completed",
  "timestamp": "2026-02-11T10:31:45Z",
  "data": {
    "id": "tryon_123abc",
    "resultUrl": "https://cdn.styleswap.com/results/...",
    "processingTime": 105
  }
}

Error Handling

The API returns standard HTTP status codes. Errors include a detailed error message:

400 Bad Request

Invalid request parameters

401 Unauthorized

Invalid or missing API key

429 Too Many Requests

Rate limit exceeded

500 Internal Server Error

Server error - please retry

Ready to Integrate?

Start building with StyleSwap API today. Purchase credits via Yoco to get started.