Capability · Apparel

Virtuell try-on API for klær

I én setning

Phottas virtuelle try-on API tar et flat-lay-bilde av klær og en mannequin-ID, og returnerer et bilde på modell i 2K eller 4K. POST jobben, poll hvert 3.–5. sekund, og last ned når status er completed.

  • Typisk tidsbruk: 1.5–4 min
  • Credits: 5 credits ved 2K · 6 credits ved 4K
  • Prosessering: asynkron, polling
  • Grenser: 600 forespørsler/min
  • Autentisering: Bearer-nøkkel

Hvert tall på denne siden er hentet fra dokumentasjonen for Photta-API-et · verifisert

POST/api/v1/tryon/apparel
RESPONSE=$(curl -s -X POST https://api.photta.app/api/v1/tryon/apparel \
  -H "Authorization: Bearer $PHOTTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "product_type": "top",
  "product_images": [
    "https://cdn.yourstore.com/products/shirt-front.jpg"
  ],
  "product_back_image": "https://cdn.yourstore.com/products/shirt-back.jpg",
  "product_category": "t_shirt",
  "mannequin_id": "mnk_f3a9b1",
  "background_color": "#F5F0E8",
  "resolution": "2K",
  "aspect_ratio": "3:4",
  "body_size": "M",
  "expression": "neutral",
  "user_instruction": "Keep the collar pattern crisp and centered."
}')
ID=$(echo "$RESPONSE" | jq -r '.data.id')
A garment rendered on an AI model by the apparel try-on API
Eksempel på respons

Kort oppsummert

Kort oppsummert

Endepunkt
POST /api/v1/tryon/apparel
Autentisering
Bearer API-nøkkel
Prosessering
Asynkron – poll status-endepunktet
Typisk tidsbruk
1.5–4 min
Credits
5 credits ved 2K · 6 credits ved 4K
Bildeformater
3:4 · 1:1 · 4:3 · 2:3 · 3:2 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9
Inndatagrenser
Opptil 10 MB per bilde; JPEG, PNG, WebP
Idempotent
Nei

Forespørsel og respons

Forespørsel

RESPONSE=$(curl -s -X POST https://api.photta.app/api/v1/tryon/apparel \
  -H "Authorization: Bearer $PHOTTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "product_type": "top",
  "product_images": [
    "https://cdn.yourstore.com/products/shirt-front.jpg"
  ],
  "product_back_image": "https://cdn.yourstore.com/products/shirt-back.jpg",
  "product_category": "t_shirt",
  "mannequin_id": "mnk_f3a9b1",
  "background_color": "#F5F0E8",
  "resolution": "2K",
  "aspect_ratio": "3:4",
  "body_size": "M",
  "expression": "neutral",
  "user_instruction": "Keep the collar pattern crisp and centered."
}')
ID=$(echo "$RESPONSE" | jq -r '.data.id')

202 Accepted / completed

{
  "data": {
    "id": "try_abc123",
    "status": "processing",
    "product_type": "top",
    "mannequin_id": "mnk_f3a9b1",
    "background_color": "#F5F0E8",
    "lock_background": false,
    "resolution": "2K",
    "aspect_ratio": "3:4",
    "credits_used": 5,
    "created_at": "2026-04-10T12:00:00Z"
  },
  "request_id": "req_xyz789"
}

Forespørselsparametere

product_type

Type: stringPåkrevd

Type of garment.

Verdier: topbottomtop_and_bottomone_piece
product_images

Type: array[string]Påkrevd

Array of image URLs or base64 data URIs. The first entry is the FRONT image and is required. Not used when product_type is "top_and_bottom".

product_back_image

Type: string

Optional URL or base64 data URI for the BACK of the garment. Sending one IS the request for a back shot: the model is photographed from behind and this image is the reference. Omit it and you get the front. There is deliberately no separate "view" field — two fields that can contradict each other. Not used when product_type is "top_and_bottom".

top_image

Type: string

Front image of the top garment. Required when product_type is "top_and_bottom".

top_back_image

Type: string

Optional back image of the top garment. Sending one asks for a back shot, exactly as product_back_image does.

bottom_image

Type: string

Front image of the bottom garment. Required when product_type is "top_and_bottom".

bottom_back_image

Type: string

Optional back image of the bottom garment. Sending one asks for a back shot, exactly as product_back_image does.

mannequin_id

Type: stringPåkrevd

ID of the mannequin to wear the garment. Use GET /api/v1/mannequins to list available options.

background_color

Type: string

The backdrop, as a colour. One of white, light_gray, gray, charcoal, black, beige, cream, sand — or any hex value (#F5F0E8, F5F0E8, #fff). It travels to the engine as TEXT; nothing is uploaded, and the same value reproduces exactly on every run. Omit it for the engine's clean studio default. An unrecognised value returns 400 rather than quietly falling back. Echoed back on the response.

Verdier: whitelight_graygraycharcoalblackbeigecreamsand
pose_id

Type: string

RETIRED 2026-08-10 — accepted and ignored. Poses were removed from apparel try-on; every generation is now a straight, relaxed, camera-facing full-body shot (the old FullBody stance). Sending it returns Deprecation and Sunset headers. Deleted 2027-02-10 — stop sending it.

background

Type: string

RETIRED 2026-08-11 — accepted and ignored, never downloaded. Backdrop photographs were removed: recreating a room competed with the garment for the engine's attention. Use background_color instead. Sending it returns Deprecation and Sunset headers. Deleted 2027-02-10.

lock_background

Type: boolean

RETIRED 2026-08-11 — accepted and ignored, and always false on responses. It never worked as previously documented: the prompt engine has always discarded the flag, so the "faithful reproduction" this page used to promise was never delivered. background_color is the first backdrop control that actually holds still. Deleted 2027-02-10.

= false

resolution

Type: string

Output resolution.

= 2K

Verdier: 2K4K
aspect_ratio

Type: string

Output aspect ratio.

= 3:4

Verdier: 3:41:14:32:33:24:55:49:1616:921:9
body_size

Type: string

Body size of the mannequin.

= M

Verdier: XSSMLXLXXL
expression

Type: string

Facial expression.

= neutral

Verdier: neutralhappyserioussmiling
footwear_url

Type: string

URL or base64 of a custom footwear image. Every generation is a full-body shot, so supplied footwear is staged and worn.

user_instruction

Type: string

Free-form refinement, e.g. "preserve the seam pattern across the shoulder", "keep the collar contrast strong". Capped at 500 characters server-side; longer strings are silently truncated. Useful for brand-specific details that need an extra nudge.

product_category

Type: string

Optional silhouette anchor for the garment (e.g. "t_shirt", "jeans", "blazer", "midi_dress"). Helps disambiguate the structure of the garment when the silhouette is ambiguous from the photo alone. Used for product_type "top", "bottom", and "one_piece".

top_category

Type: string

Silhouette anchor for the top half. Only valid when product_type is "top_and_bottom".

bottom_category

Type: string

Silhouette anchor for the bottom half. Only valid when product_type is "top_and_bottom".

length

Type: string

Garment length key for product_type "top", "bottom", or "one_piece". List available values with GET /api/v1/garment-attributes?type=length&garment_type={product_type}.

fit

Type: string

Garment fit key for product_type "top", "bottom", or "one_piece". List available values with GET /api/v1/garment-attributes?type=fit&garment_type={product_type}.

top_length

Type: string

Top length key. Only valid when product_type is "top_and_bottom". List with GET /api/v1/garment-attributes?type=length&garment_type=top.

top_fit

Type: string

Top fit key. Only valid when product_type is "top_and_bottom". List with GET /api/v1/garment-attributes?type=fit&garment_type=top.

bottom_length

Type: string

Bottom length key. Only valid when product_type is "top_and_bottom". List with GET /api/v1/garment-attributes?type=length&garment_type=bottom.

bottom_fit

Type: string

Bottom fit key. Only valid when product_type is "top_and_bottom". List with GET /api/v1/garment-attributes?type=fit&garment_type=bottom.

Feil

400invalid_request_error
The request is malformed or contains invalid parameters.
401authentication_error
The API key is missing, invalid, or expired.
402insufficient_credits_error
Your account does not have enough credits.
404not_found_error
The requested resource does not exist.
409conflict_error
The request conflicts with current state — e.g. your concurrent-batch cap is reached.
429rate_limit_error
Too many requests. Slow down and retry.Retry-After: 30
500api_error
An internal server error occurred (500), or a check your request needs could not run right now (503, e.g. moderation_unavailable). Retry later with backoff.

Grenser

  • 600 forespørsler per minutt per konto (Fast tidsvindu; grensen er lik for alle abonnementer)
  • En 429 inneholder Retry-After: 30 sekunder
  • Opptil 10 MB per bilde
  • Formater: JPEG, PNG, WebP
  • Samtidige batcher per abonnement: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
  • Kun polling – API-et sender ikke webhooks.

Fem steg, ett produktbilde

Velg en utstillingsdukke, send inn jobben, gjør polling til den er ferdig, last ned resultatet.

  1. Trinn 1

    Generer en API-nøkkel

    Registrer deg på ai.photta.app, åpne Developers-fanen, klikk på Generate API key. Live-nøkler starter med `photta_live_`. Legg nøkkelen i `PHOTTA_API_KEY` — commit den aldri.

  2. Trinn 2

    Velg en utstillingsdukke

    GET `/api/v1/mannequins` for å liste opp tilgjengelige modeller og ta ID-en du ønsker. Positurer ble faset ut 2026-08-10: hvert bilde er helfigur rett forfra mot kameraet, så det er ingenting annet å velge.

  3. Trinn 3

    POST try-on-jobben

    Send en POST til `/api/v1/tryon/apparel` med `product_type`, `product_images`, `mannequin_id` samt valgfri `resolution` og `aspect_ratio`. API-et returnerer 202 Accepted med en generasjons-ID.

  4. Trinn 4

    Gjør polling til jobben er fullført

    GET `/api/v1/tryon/apparel/:id` hvert 3. sekund. Når `data.status` endres til `completed`, inneholder payloaden `output_url` og `thumbnail_url`. Sett en øvre grense slik at en jobb som henger seg opp ikke låser forespørselen din.

  5. Trinn 5

    Last ned og lagre persistent

    Hent bytene fra `output_url` og lagre dem i din egen objektlagring. CDN-URL-en er stabil, men produktet ditt bør ikke være avhengig av den for rendering.

Spørsmål utviklere stiller før de lanserer try-on for klær

Hva er Phottas API for virtuell try-on?

Et REST-endpoint som tar et flat-lay-produktbilde og en utstillingsdukke-ID, og returnerer et fotorealistisk bilde på modell. Samme pipeline som Phottas forbrukerapp. Fire produkttyper støttes: top, bottom, top+bottom, one-piece.

Hvor mye koster det per kall?

5 credits for et 2K-resultat, 6 credits for 4K. Credits følger med abonnementet ditt og kan fylles på. Mislykkede genereringer koster ikke credits — de refunderes.

Hvor lang tid tar en generering?

Typisk fullføringstid er 1.5 til 4 minutter, målt ende-til-ende. POST-kallet returnerer en generasjons-ID på under ett sekund; GPU-arbeidet skjer i bakgrunnen mens du gjør polling.

Hvilke produkttyper støttes?

Fire: `top`, `bottom`, `top_and_bottom`, `one_piece`. Hver av dem forventer ulik struktur på `product_images` — for eksempel krever `top_and_bottom` URL-er for både `top_image` og `bottom_image`.

Kan jeg bruke min egen utstillingsdukke?

Ja. Last opp et bilde av en utstillingsdukke med `POST /api/v1/mannequins` eller generer en ny AI-mannekeng med `POST /api/v1/mannequins/generate`. Den returnerte ID-en brukes direkte i try-on-forespørselen.

Hvordan poller jeg etter resultatet?

GET `/api/v1/tryon/apparel/:id` hvert 3. til 5. sekund frem til `data.status` er `completed` eller `failed`. Sett en øvre grense for antall forsøk — 120 × 3s dekker det dokumenterte tidsvinduet med god margin.

Relaterte funksjoner

Hvert tall på denne siden er hentet fra dokumentasjonen for Photta-API-et · verifisert

Prøv API-et på fem minutter

Generer en Photta API-nøkkel, lim inn cURL-kodesnutten ovenfor, og du har ditt første bilde på modell før kaffen er ferdig traktet.

  • 1.5–4 min
  • 5 credits ved 2K · 6 credits ved 4K
  • asynkron, polling
  • 600 forespørsler/min
  • Bearer-nøkkel