Funzionalità · Abbigliamento
API di Virtual try-on per abbigliamento
In sintesi
L'API di virtual try-on di Photta riceve l'immagine flat-lay di un capo e un mannequin ID e restituisce una foto con modello in 2K o 4K. Invia il job via POST, esegui il polling ogni 3–5 secondi, scarica il file quando lo status è completed.
- Tempo tipico: 1–1.5 min
- Credits: 5 credits a 2K · 6 credits a 4K
- Elaborazione: asincrono, polling
- Limiti: 600 richieste/min
- Autenticazione: Chiave Bearer
Ogni dato in questa pagina proviene da la documentazione dell'API di Photta · verificato
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"]
Panoramica
Panoramica
- Endpoint
- POST /api/v1/tryon/apparel
- Autenticazione
- API key Bearer
- Elaborazione
- Asincrona — effettua il polling dell'endpoint di stato
- Tempo tipico
- 1–1.5 min
- Credits
- 5 credits a 2K · 6 credits a 4K
- Rapporti d'aspetto
- 3:4 · 1:1 · 4:3 · 2:3 · 3:2 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9
- Limiti di input
- Fino a 10 MB per immagine; JPEG, PNG, WebP
- Idempotente
- Sì
Richiesta e risposta
Richiesta
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 / Completato
{
"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"
}Parametri della richiesta
product_typeTipo: stringObbligatorio
Type of garment.
Valori:topbottomtop_and_bottomone_pieceproduct_imagesTipo: array[string]Obbligatorio
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_imageTipo: 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_imageTipo: string
Front image of the top garment. Required when product_type is "top_and_bottom".
top_back_imageTipo: string
Optional back image of the top garment. Sending one asks for a back shot, exactly as product_back_image does.
bottom_imageTipo: string
Front image of the bottom garment. Required when product_type is "top_and_bottom".
bottom_back_imageTipo: string
Optional back image of the bottom garment. Sending one asks for a back shot, exactly as product_back_image does.
mannequin_idTipo: stringObbligatorio
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_colorTipo: 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.
Valori:whitelight_graygraycharcoalblackbeigecreamsandpose_idTipo: 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.
backgroundTipo: 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_backgroundTipo: 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
resolutionTipo: string
Output resolution.
= 2K
Valori:2K4Kaspect_ratioTipo: string
Output aspect ratio.
= 3:4
Valori:3:41:14:32:33:24:55:49:1616:921:9body_sizeTipo: 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
Valori:XSSMLXLXXLpetiteslimregularathleticcurvyplus_sizeexpressionTipo: string
Facial expression. `happy` and `smiling` are both a soft smile. An unknown value adds no expression to the prompt.
= neutral
Valori:neutralsoft_smileconfidentseriousrelaxedhappysmilingfootwear_urlTipo: 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_instructionTipo: 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_categoryTipo: 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_categoryTipo: string
Silhouette anchor for the top half. Only valid when product_type is "top_and_bottom".
bottom_categoryTipo: string
Silhouette anchor for the bottom half. Only valid when product_type is "top_and_bottom".
lengthTipo: 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}.
fitTipo: 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_lengthTipo: 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_fitTipo: 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_lengthTipo: 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_fitTipo: 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.
Errori
- 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.
Limiti
- 600 richieste al minuto per account (Finestra fissa; il limite è lo stesso per ogni piano)
- Un 429 restituisce Retry-After: 30 secondi
- Fino a 10 MB per immagine
- Formati: JPEG, PNG, WebP
- Batch simultanei per piano: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
- Solo polling — l'API non invia webhook.
Cinque passaggi, una sola foto prodotto
Scegli un manichino, invia il job, fai polling fino al completamento, scarica il risultato.
Passaggio 1
Genera una chiave API
Registrati su ai.photta.app, apri la scheda Developers, fai clic su Generate API key. Le chiavi live iniziano con `photta_live_`. Inserisci la chiave in `PHOTTA_API_KEY` — non committarla mai.
Passaggio 2
Scegli un manichino
GET `/api/v1/mannequins` per elencare i modelli disponibili e ottenere l'ID desiderato. Le pose sono state ritirate il 2026-08-10: ogni scatto è a figura intera, frontale verso la fotocamera, quindi non c'è altro da scegliere.
Passaggio 3
Invia il job di try-on tramite POST
Invia una POST a `/api/v1/tryon/apparel` con `product_type`, `product_images`, `mannequin_id` e i parametri opzionali `resolution` e `aspect_ratio`. L'API restituisce 202 Accepted con un generation ID.
Passaggio 4
Fai polling fino al completamento del job
GET `/api/v1/tryon/apparel/:id` ogni 3 secondi. Quando `data.status` passa a `completed`, il payload include `output_url` e `thumbnail_url`. Imposta un limite massimo per evitare che un job bloccato blocchi la tua richiesta.
Passaggio 5
Scarica e rendi persistente
Esegui il fetch dei byte da `output_url` e salvali nel tuo object storage. L'URL della CDN è stabile, ma il tuo prodotto non dovrebbe dipendere da esso per il rendering.
Lo stesso endpoint in Node.js, Python e cURL
Node.js
API di Virtual try-on in Node.js
Chiama aPI di Virtual try-on di Photta da un backend Node.js con fetch nativo. Nessun SDK richiesto: salva la chiave, invia il job, esegui il polling per il risultato.
LeggiPython
API di Virtual try-on in Python
Chiama la aPI di Virtual try-on di Photta in Python con la libreria requests. Wrapper di trenta righe, compatibile con async tramite httpx, funziona in Django, FastAPI e Celery.
LeggicURL
API di Virtual try-on con cURL
Chiama aPI di Virtual try-on di Photta direttamente dalla shell con cURL. Invia, effettua il polling, scarica — ogni snippet si integra con jq per pipeline basate su script.
Leggi
Domande frequenti degli sviluppatori prima di rilasciare il try-on per abbigliamento
Cos'è l'API di virtual try-on di Photta?
Un endpoint REST che riceve un'immagine del prodotto in flat-lay e un mannequin ID, restituendo un'immagine fotorealistica indossata da un modello. Stessa pipeline dell'app consumer di Photta. Sono supportati quattro tipi di prodotto: top, bottom, top+bottom, one-piece.
Quanto costa per chiamata?
5 credits per un risultato in 2K, 6 credits per 4K. I credits sono inclusi nel tuo abbonamento e possono essere ricaricati. Le generazioni con stato failed non costano credits — vengono rimborsate.
Quanto tempo richiede una generazione?
Il completamento tipico richiede da 1.5 a 4 minuti, misurati end-to-end. La POST restituisce un generation ID in meno di un secondo; il carico di lavoro su GPU avviene in background mentre esegui il polling.
Quali tipi di prodotto sono supportati?
Quattro: `top`, `bottom`, `top_and_bottom`, `one_piece`. Ognuno richiede una struttura specifica per `product_images` — per esempio `top_and_bottom` richiede entrambi gli URL `top_image` e `bottom_image`.
Posso usare il mio manichino?
Sì. Carica la foto di un manichino con `POST /api/v1/mannequins` o genera un nuovo manichino AI con `POST /api/v1/mannequins/generate`. L'ID restituito si inserisce direttamente nella richiesta di try-on.
Come eseguo il polling del risultato?
GET `/api/v1/tryon/apparel/:id` ogni 3-5 secondi finché `data.status` non diventa `completed` o `failed`. Imposta un limite massimo sui tentativi — 120 × 3s copre la finestra temporale documentata con ampio margine.
Funzionalità correlate
Funzionalità
API try-on per gioielli per collane, anelli, bracciali e orecchini
Applica collane, anelli, bracciali e orecchini su modelli AI tramite REST. 5 credits a 2K, manichini in primo piano integrati, rendering con gestione dei riflessi dalla documentazione di Photta.
Vedi l'endpointFunzionalità
API Ghost mannequin per foto prodotto con manichino invisibile
Endpoint AI per ghost mannequin. Rimuovi il manichino dalla foto di un capo e preserva i dettagli interni. 3D o flat-lay, elaborazione in batch, 4 credits a 2K.
Vedi l'endpointSviluppa
Implementa una funzionalità di virtual try-on per la tua applicazione
Ricetta end-to-end per rilasciare una funzionalità di virtual try-on con l'API Photta: upload, invio, polling tramite un worker, rendering del risultato. Pattern TypeScript + server-only.
Vedi l'endpointSviluppa
Aggiungi il try-on virtuale a un'app iOS o Android
Come aggiungere il try-on virtuale basato su IA a un'app nativa iOS o Android usando l'API di Photta: non rilasciare mai la chiave sul dispositivo, usa il backend come proxy, rispecchia lo stato dei job.
Vedi l'endpointConfronta
Photta vs FASHN — API AI per la moda a confronto
Photta e FASHN a confronto: endpoint, costi in crediti, piani, limiti di concorrenza. Dati ricavati dalle rispettive pagine prezzi il 2026-04-19. Nessun numero inventato.
Vedi l'endpointConfronta
Photta vs Fitroom — scegli la soluzione ideale tra le API per il fashion
Confronto tra Photta e Fitroom su endpoint, costo in crediti per chiamata, modello di pricing e superficie di integrazione. Dati estratti da ciascun sito il 2026-04-19. Nessun dato inventato.
Vedi l'endpointGuida rapida
La prima immagine con Photta in meno di cinque minuti.
Registrati, genera una chiave API, esegui la tua prima chiamata cURL, fai polling fino al completamento, salva il risultato. Cinque passaggi, interamente documentati.
Vedi l'endpointRiferimento
Errori delle API di Photta
L'elenco completo dei tipi di errore delle API di Photta con i relativi codici di stato, la struttura del payload di errore e quali fallimenti ha senso riprovare.
Vedi l'endpointRiferimento
Rate limit delle API Photta
Il rate limit delle API Photta, la relativa finestra, l'header Retry-After, l'intervallo di polling e i limiti di concorrenza per piano, tutti desunti dalla documentazione delle API.
Vedi l'endpoint
Ogni dato in questa pagina proviene da la documentazione dell'API di Photta · verificato
Prova l'API in 5 minuti
Genera una chiave API di Photta, incolla lo snippet cURL qui sopra e otterrai la tua prima immagine con modello prima ancora che il caffè sia pronto.
- 1–1.5 min
- 5 credits a 2K · 6 credits a 4K
- asincrono, polling
- 600 richieste/min
- Chiave Bearer