Capability · Apparel
Virtuel try-on API til tøj
I én sætning
Phottas virtuelle try-on API tager et flat-lay tøjbillede og et mannequin-ID og returnerer et 2K- eller 4K-foto på en model. POST jobbet, poll hvert 3.–5. sekund, download, når status er completed.
- Typisk tid: 1–1.5 min
- Credits: 5 credits ved 2K · 6 credits ved 4K
- Behandling: async, polling
- Grænser: 600 requests/min
- Autentifikation: Bearer key
Hvert tal på denne side stammer fra Photta API-dokumentationen · tjekket
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": "tshirt",
"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')const res = await fetch("https://api.photta.app/api/v1/tryon/apparel", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PHOTTA_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"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": "tshirt",
"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."
}),
});
const { data } = await res.json(); // data.id, data.statusimport os, requests
res = requests.post(
"https://api.photta.app/api/v1/tryon/apparel",
headers={"Authorization": f"Bearer {os.environ['PHOTTA_API_KEY']}"},
json={
"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": "tshirt",
"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."
},
)
data = res.json()["data"] # data["id"], data["status"]
Kort fortalt
Kort fortalt
- Endpoint
- POST /api/v1/tryon/apparel
- Autentifikation
- Bearer API-nøgle
- Behandling
- Asynkron — poll status-endpointet
- Typisk tid
- 1–1.5 min
- Credits
- 5 credits ved 2K · 6 credits ved 4K
- Billedformater
- 3:4 · 1:1 · 4:3 · 2:3 · 3:2 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9
- Inputgrænser
- Op til 10 MB pr. billede; JPEG, PNG, WebP
- Idempotent
- Ja
Request og response
Request
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": "tshirt",
"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')const res = await fetch("https://api.photta.app/api/v1/tryon/apparel", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PHOTTA_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"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": "tshirt",
"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."
}),
});
const { data } = await res.json(); // data.id, data.statusimport os, requests
res = requests.post(
"https://api.photta.app/api/v1/tryon/apparel",
headers={"Authorization": f"Bearer {os.environ['PHOTTA_API_KEY']}"},
json={
"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": "tshirt",
"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."
},
)
data = res.json()["data"] # data["id"], data["status"]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"
}{
"data": {
"id": "try_abc123",
"status": "completed",
"product_type": "top",
"mannequin_id": "mnk_f3a9b1",
"resolution": "2K",
"aspect_ratio": "3:4",
"output_url": "https://cdn.photta.app/generated/try_abc123.jpg",
"thumbnail_url": "https://cdn.photta.app/generated/try_abc123-thumb.jpg",
"credits_used": 5,
"created_at": "2026-04-10T12:00:00Z",
"completed_at": "2026-04-10T12:01:15Z",
"duration_ms": 75000
},
"request_id": "req_abc001"
}Request-parametre
product_typeType: stringPåkrævet
Type of garment.
Værdier:topbottomtop_and_bottomone_pieceproduct_imagesType: array[string]Påkrævet
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_imageType: 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_imageType: string
Front image of the top garment. Required when product_type is "top_and_bottom".
top_back_imageType: string
Optional back image of the top garment. Sending one asks for a back shot, exactly as product_back_image does.
bottom_imageType: string
Front image of the bottom garment. Required when product_type is "top_and_bottom".
bottom_back_imageType: string
Optional back image of the bottom garment. Sending one asks for a back shot, exactly as product_back_image does.
mannequin_idType: stringPåkrævet
ID of the mannequin to wear the garment, from GET /api/v1/mannequins: one of Photta's, or one of your workspace's own while it is active. Another account's model, or one that was removed, is a 404; a jewellery or eyewear model is a 400.
background_colorType: 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.
Værdier:whitelight_graygraycharcoalblackbeigecreamsandpose_idType: string
RETIRED 2026-08-10 — accepted and ignored. Poses were removed from apparel try-on; every generation is now a straight, relaxed, camera-facing shot (full length; a `top` is framed three-quarter). Sending it returns Deprecation and Sunset headers. Deleted 2027-02-10 — stop sending it.
backgroundType: 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_backgroundType: 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
resolutionType: string
Output resolution.
= 2K
Værdier:2K4Kaspect_ratioType: string
Output aspect ratio.
= 3:4
Værdier:3:41:14:32:33:24:55:49:1616:921:9body_sizeType: string
Build of the model. The letter sizes map onto builds: XS → petite, S → slim, M → regular, L → curvy, XL and XXL → plus size. The build names (`petite`, `slim`, `regular`, `athletic`, `curvy`, `plus_size`) are accepted too. An unknown value adds no build to the prompt. A child model is always drawn with a child's build, whatever is sent.
= M
Værdier:XSSMLXLXXLpetiteslimregularathleticcurvyplus_sizeexpressionType: string
Facial expression. `happy` and `smiling` are both a soft smile. An unknown value adds no expression to the prompt.
= neutral
Værdier:neutralsoft_smileconfidentseriousrelaxedhappysmilingfootwear_urlType: string
URL or base64 of a custom footwear image. It is worn when the feet are in frame (full-length shots; a `top` is framed three-quarter).
user_instructionType: 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_categoryType: string
The kind of garment, as a category key (e.g. "tshirt", "jeans", "blazer", "mididress"; lower-case, no separators). It names the garment in the prompt's length sentence; an unknown key reads as "garment". Used for product_type "top", "bottom", and "one_piece". REQUIRED when `mannequin_id` is a child model: without it the request is a 400 (`param: "product_category"`), and swimwear or underwear on a child model is a 400 `content_policy_violation`, both before anything is charged.
top_categoryType: string
Silhouette anchor for the top half. Only valid when product_type is "top_and_bottom".
bottom_categoryType: string
Silhouette anchor for the bottom half. Only valid when product_type is "top_and_bottom".
lengthType: 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}.
fitType: 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_lengthType: 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_fitType: 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_lengthType: 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_fitType: 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.
Fejl
- 400
invalid_request_error - The request is malformed or contains invalid parameters.
- 401
authentication_error - The API key is missing, invalid, or expired.
- 402
insufficient_credits_error - Your account does not have enough credits, or (background removal) a free account has used its three cut-outs. Branch on the code.
- 404
not_found_error - The requested resource does not exist.
- 409
conflict_error - The request conflicts with current state — e.g. your concurrent-batch cap is reached.
- 429
rate_limit_error - Too many requests. Slow down and retry.Retry-After: 30
- 500
api_error - An internal server error occurred (500), or a check your request needs could not run right now (503, e.g. moderation_unavailable or background_removal_unavailable). Retry later with backoff.
Grænser
- 600 anmodninger i minuttet pr. konto (Fast vindue; grænsen er den samme på alle planer)
- En 429 indeholder Retry-After: 30 sekunder
- Op til 10 MB pr. billede
- Formater: JPEG, PNG, WebP
- Samtidige batches pr. plan: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
- Kun polling — API'et sender ingen webhooks.
Fem trin, ét produktfoto
Vælg en mannequin, indsend jobbet, poll indtil det er færdigt, download resultatet.
Trin 1
Generér en API-nøgle
Opret en konto på ai.photta.app, åbn fanen Developers, klik på Generate API key. Live-nøgler starter med `photta_live_`. Gem nøglen i `PHOTTA_API_KEY` — commit den aldrig.
Trin 2
Vælg en mannequin
GET `/api/v1/mannequins` for at se tilgængelige modeller og hente det ID, du ønsker. Poseringer blev udfaset den 2026-08-10: hvert billede er i helfigur, lige på og vendt mod kameraet, så der er intet andet at vælge.
Trin 3
POST try-on-jobbet
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 et generations-ID.
Trin 4
Poll indtil jobbet er færdigt
GET `/api/v1/tryon/apparel/:id` hvert 3. sekund. Når `data.status` skifter til `completed`, indeholder payloaden `output_url` og `thumbnail_url`. Sæt en øvre grænse, så et fastlåst job ikke blokerer dit request.
Trin 5
Download og gem
Hent bytes fra `output_url` og gem dem i din egen object storage. CDN-URL'en er stabil, men dit produkt bør ikke afhænge af den til rendering.
Samme endpoint i Node.js, Python og cURL
Node.js
Virtuel try-on API i Node.js
Kald Phottas virtuel try-on API fra en Node.js-backend med indbygget fetch. Ingen SDK påkrævet: gem din nøgle, indsend jobbet, foretag polling for resultatet.
LæsPython
Virtuel try-on API i Python
Kald Phottas virtuel try-on API i Python med requests-biblioteket. Tredive-linjers wrapper, async-venlig via httpx, fungerer i Django, FastAPI og Celery.
LæscURL
Virtuel try-on API med cURL
Kald Phottas virtuel try-on API direkte fra kommandolinjen med cURL. Indsend, poll, download — hvert kodestykke fungerer sammen med jq til scriptede pipelines.
Læs
Spørgsmål udviklere stiller, før de deployer try-on til tøj
Hvad er Phottas virtuelle try-on-API?
Et REST-endpoint, der tager et flat-lay-produktbillede og et mannequin-ID og returnerer et fotorealistisk billede på en model. Samme pipeline som Phottas forbruger-app. Fire produkttyper understøttes: top, underdel, top+underdel, heldragt.
Hvad koster det pr. kald?
5 credits for et 2K-resultat, 6 credits for 4K. Credits følger med dit abonnement og kan tankes op. Mislykkede generationer koster ikke credits — de refunderes.
Hvor lang tid tager en generering?
Typisk færdiggørelsestid er 1,5 til 4 minutter, målt end-to-end. POST returnerer et generations-ID på under et sekund; GPU-arbejdet foregår i baggrunden, mens du poller.
Hvilke produkttyper understøttes?
Fire: `top`, `bottom`, `top_and_bottom`, `one_piece`. Hver type forventer en specifik struktur for `product_images` — for eksempel kræver `top_and_bottom` både `top_image`- og `bottom_image`-URL'er.
Kan jeg bruge min egen mannequin?
Ja. Upload et mannequin-foto med `POST /api/v1/mannequins`, eller generér en ny AI-mannequin med `POST /api/v1/mannequins/generate`. Det returnerede ID kan indsættes direkte i try-on-requestet.
Hvordan poller jeg efter resultatet?
GET `/api/v1/tryon/apparel/:id` hvert 3. til 5. sekund, indtil `data.status` er `completed` eller `failed`. Sæt en øvre grænse for antal forsøg — 120 × 3s dækker det dokumenterede tidsvindue med god margin.
Relaterede funktioner
Funktioner
Try-on-API til smykker til halskæder, ringe, armbånd og øreringe
Placér halskæder, ringe, armbånd og øreringe på AI-modeller via REST. 5 credits ved 2K, indbyggede close-up-mannequiner, refleksionsbevidst rendering fra Photta-dokumentationen.
Se endpointetFunktioner
Ghost mannequin API til hollow-man-produktfotos
AI ghost mannequin-endpoint. Fjern mannequinen fra et tøjbillede og bevar indvendige detaljer. 3D eller flat-lay, batchbehandling, 4 credits ved 2K.
Se endpointetByg
Byg en virtuel try-on-funktion til din app
End-to-end opskrift på levering af en virtuel try-on-funktion med Photta API: upload, indsend, poll fra en worker, render resultatet. TypeScript + server-only-mønstre.
Se endpointetByg
Tilføj virtuel try-on til en iOS- eller Android-app
Sådan tilføjer du AI virtuel try-on til en indbygget iOS- eller Android-app ved hjælp af Photta API'et: læg aldrig nøglen i appen, proxy gennem din backend, spejl jobstatus.
Se endpointetSammenlign
Photta vs FASHN — AI-mode-API, side om side
Photta og FASHN sammenlignet: endpoints, kreditpriser, abonnementstyper, concurrency limits. Hentet direkte fra hver virksomheds egen prisside den 2026-04-19. Ingen opdigtede tal.
Se endpointetSammenlign
Photta vs Fitroom — vælg det rette match til fashion-API'er
Photta og Fitroom sammenlignet på endpoints, credit-omkostning pr. kald, prismodel og integrationsflade. Hentet fra hver side den 2026-04-19. Ingen opdigtede tal.
Se endpointetHurtig start
Første Photta-billede på under fem minutter.
Opret en konto, generer en API-nøgle, kør dit første cURL-kald, foretag polling indtil det er fuldført, gem resultatet. Fem trin, dokumenteret fra start til slut.
Se endpointetReference
Photta API-fejl
Den komplette liste over Photta API-fejltyper med deres statuskoder, strukturen på fejlsvaret, og hvilke fejl det kan betale sig at prøve igen.
Se endpointetReference
Photta API rate limits
Photta API-rate limit, dets vindue, Retry-After-headeren, polling-intervallet og lofterne for samtidighed pr. abonnement, alt sammen aflæst fra API-dokumentationen.
Se endpointet
Hvert tal på denne side stammer fra Photta API-dokumentationen · tjekket
Prøv API'et på fem minutter
Generér en Photta API-nøgle, indsæt cURL-kodestykket ovenfor, og du har dit første billede på en model, før kaffen er færdigbrygget.
- 1–1.5 min
- 5 credits ved 2K · 6 credits ved 4K
- async, polling
- 600 requests/min
- Bearer key