Getting started

Quickstart

Your first try-on in five minutes.

1. Get a key

Open the admin platform and copy your secret key (sb_secret_…) from Settings → API key. New accounts start with free credits, enough to run your first generations before paying.

2. Add the product to your catalogue

POST /try-on needs a product that already exists — there is no one-shot product and no inline upsert, so a garment this API has never seen is refused with PRODUCT_NOT_FOUND rather than half-accepted. Add it from the console, or via a store sync, before your first call.

3. Run the try-on

There is no upload step. Send the shopper photo directly as a url or a base64 dataUrl — never both — and reference the product by the externalId you gave it:

bash
curl -X POST "https://www.genfashion.app/api/tryon/v1/try-on" \
  -H "x-api-key: sk_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "person": { "url": "https://example.com/shopper.jpg" },
    "products": [{ "externalId": "shirt-42" }]
  }'
json
{ "generationId": "gen_b2c1…", "status": "PROCESSING", "pollAfterMs": 5000 }

202 Accepted means screening passed and generation has started. A 4xx here means the request was refused outright — no credit was consumed, and there is nothing to poll for.

4. Poll for the result

bash
curl "https://www.genfashion.app/api/tryon/v1/generations/b2c1…" \
  -H "x-api-key: sk_your_secret_key"

Poll every pollAfterMs (5s) until status is COMPLETED or FAILED. A generation takes ~45–56s — that is measured, not a placeholder, and there is no faster path today. On success the response carries resultImageUrl, a signed link valid for 15 minutes.

Next steps

  • Once a product exists, every later call needs only its externalId — about 50 bytes on the wire.
  • Prefer webhooks over polling in production — configure one under Settings → Webhooks. See Errors for the codes to branch on.
  • Try the whole flow with no code in the Playground.
  • Full parameter and response reference: Try-On API.