Kyvykkyys · Vaatteet
Virtuaalinen try-on API vaatteille
Yhdellä lauseella
Phottan virtuaalinen try-on API ottaa vastaan tasokuvatun vaatekuvan ja mallinukke-ID:n ja palauttaa 2K- tai 4K-mallikuvan. Tee POST työstä, tee polling 3–5 sekunnin välein ja lataa tulos, kun tila on completed.
- Tyypillinen kesto: 1.5–4 min
- Credits: 5 credits resoluutiolla 2K · 6 credits resoluutiolla 4K
- Käsittely: asynkroninen, polling
- Rajoitukset: 600 pyyntöä/min
- Autentikointi: Bearer-avain
Jokainen luku tällä sivulla on peräisin Photta-rajapinnan dokumentaatiosta · tarkistettu
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')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": "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."
}),
});
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": "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."
},
)
data = res.json()["data"] # data["id"], data["status"]
Lyhyesti
Lyhyesti
- Endpoint
- POST /api/v1/tryon/apparel
- Autentikointi
- Bearer-API-avain
- Käsittely
- Asynkroninen — tee polling-kyselyitä status-endpointiin
- Tyypillinen kesto
- 1.5–4 min
- Credits
- 5 credits resoluutiolla 2K · 6 credits resoluutiolla 4K
- Kuvasuhteet
- 3:4 · 1:1 · 4:3 · 2:3 · 3:2 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9
- Syöterajoitukset
- Enintään 10 MB per kuva; JPEG, PNG, WebP
- Idempotentti
- Ei
Pyyntö ja vastaus
Pyyntö
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')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": "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."
}),
});
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": "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."
},
)
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"
}Pyyntöparametrit
product_typeTyyppi: stringPakollinen
Type of garment.
Arvot:topbottomtop_and_bottomone_pieceproduct_imagesTyyppi: array[string]Pakollinen
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_imageTyyppi: 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_imageTyyppi: string
Front image of the top garment. Required when product_type is "top_and_bottom".
top_back_imageTyyppi: string
Optional back image of the top garment. Sending one asks for a back shot, exactly as product_back_image does.
bottom_imageTyyppi: string
Front image of the bottom garment. Required when product_type is "top_and_bottom".
bottom_back_imageTyyppi: string
Optional back image of the bottom garment. Sending one asks for a back shot, exactly as product_back_image does.
mannequin_idTyyppi: stringPakollinen
ID of the mannequin to wear the garment. Use GET /api/v1/mannequins to list available options.
background_colorTyyppi: 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.
Arvot:whitelight_graygraycharcoalblackbeigecreamsandpose_idTyyppi: 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.
backgroundTyyppi: 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_backgroundTyyppi: 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
resolutionTyyppi: string
Output resolution.
= 2K
Arvot:2K4Kaspect_ratioTyyppi: string
Output aspect ratio.
= 3:4
Arvot:3:41:14:32:33:24:55:49:1616:921:9body_sizeTyyppi: string
Body size of the mannequin.
= M
Arvot:XSSMLXLXXLexpressionTyyppi: string
Facial expression.
= neutral
Arvot:neutralhappyserioussmilingfootwear_urlTyyppi: string
URL or base64 of a custom footwear image. Every generation is a full-body shot, so supplied footwear is staged and worn.
user_instructionTyyppi: 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_categoryTyyppi: 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_categoryTyyppi: string
Silhouette anchor for the top half. Only valid when product_type is "top_and_bottom".
bottom_categoryTyyppi: string
Silhouette anchor for the bottom half. Only valid when product_type is "top_and_bottom".
lengthTyyppi: 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}.
fitTyyppi: 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_lengthTyyppi: 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_fitTyyppi: 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_lengthTyyppi: 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_fitTyyppi: 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.
Virheet
- 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.
- 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). Retry later with backoff.
Rajoitukset
- 600 pyyntöä minuutissa per tili (Kiinteä aikaikkuna; rajoitus on sama kaikissa tilauksissa)
- Vastaus 429 sisältää otsakkeen Retry-After: 30 sekuntia
- Enintään 10 MB per kuva
- Formaatit: JPEG, PNG, WebP
- Rinnakkaiset eräajot per tilaus: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
- Vain polling — API ei lähetä webhookeja.
Viisi vaihetta, yksi tuotekuva
Valitse mallinukke, lähetä työ, tee pollingia valmistumiseen asti, lataa tulos.
Vaihe 1
Luo API-avain
Rekisteröidy osoitteessa ai.photta.app, avaa Developers-välilehti ja klikkaa Generate API key. Live-avaimet alkavat tunnisteella `photta_live_`. Aseta avain muuttujaan `PHOTTA_API_KEY` — älä koskaan commitoi sitä.
Vaihe 2
Valitse mallinukke
GET `/api/v1/mannequins` listaa saatavilla olevat mallit, joista voit ottaa haluamasi ID:n. Asennot poistettiin käytöstä 2026-08-10: jokainen kuva on suora, kameraa kohti oleva kokovartalokuva, joten mitään muuta ei tarvitse valita.
Vaihe 3
Tee POST try-on-työlle
Lähetä POST-pyyntö polkuun `/api/v1/tryon/apparel` kentillä `product_type`, `product_images`, `mannequin_id` sekä valinnaisilla kentillä `resolution` ja `aspect_ratio`. API palauttaa 202 Accepted ja generointi-ID:n.
Vaihe 4
Tee pollingia, kunnes työ valmistuu
GET `/api/v1/tryon/apparel/:id` 3 sekunnin välein. Kun `data.status` muuttuu tilaan `completed`, payload sisältää kentät `output_url` ja `thumbnail_url`. Aseta yläraja, jotta jumiutunut työ ei jätä pyyntöä roikkumaan.
Vaihe 5
Lataa ja tallenna pysyvästi
Nouda tavut osoitteesta `output_url` ja tallenna ne omaan objektitallennukseesi. CDN-URL on vakaa, mutta tuotteesi ei pitäisi riippua siitä renderöinnissä.
Sama endpoint kielillä Node.js, Python ja cURL
Node.js
Virtuaalinen try-on API ympäristössä Node.js
Kutsu Phottan ominaisuutta virtuaalinen try-on API Node.js-taustajärjestelmästä natiivilla fetchillä. SDK:ta ei tarvita: tallenna avaimesi, lähetä työ, pollaa tulosta.
LuePython
Virtuaalinen try-on API Pythonissa
Kutsu Phottan virtuaalinen try-on API -ominaisuutta Pythonissa requests-kirjaston avulla. Kolmenkymmenen rivin kääre, async-yhteensopiva httpx:n kautta, toimii Djangossa, FastAPIssa ja Celeryssä.
LuecURL
Virtuaalinen try-on API cURLillä
Kutsu Phottan virtuaalinen try-on API-rajapintaa suoraan komentoriviltä cURLin avulla. Lähetä, pollaa, lataa — jokainen koodinpätkä toimii yhdessä jq:n kanssa skriptatuissa putkissa.
Lue
Kysymyksiä, joita kehittäjät kysyvät ennen vaatteiden try-on-ominaisuuden julkaisua
Mikä on Phottan virtuaalinen try-on-API?
REST-endpoint, joka ottaa flat-lay-tuotekuvan sekä mallinuken ID:n ja palauttaa fotorealistisen kuvan mallin päällä. Sama putki kuin Phottan kuluttajasovelluksessa. Neljä tuotetyyppiä tuettuina: top, bottom, top+bottom, one-piece.
Paljonko kutsu maksaa?
5 credits 2K-tuloksesta, 6 credits 4K-tuloksesta. Krediitit sisältyvät tilaukseesi ja niitä voi ladata lisää. Epäonnistuneet generoinnit eivät kuluta krediittejä — ne hyvitetään.
Kauanko generointi kestää?
Tyypillinen valmistumisaika on 1.5–4 minuuttia alusta loppuun mitattuna. POST-pyyntö palauttaa generointi-ID:n alle sekunnissa; GPU-työ tapahtuu taustalla pollingin aikana.
Mitä tuotetyyppejä tuetaan?
Neljää: `top`, `bottom`, `top_and_bottom`, `one_piece`. Kukin odottaa erilaista `product_images`-rakennetta — esimerkiksi `top_and_bottom` vaatii sekä `top_image`- että `bottom_image`-URL-osoitteet.
Voinko käyttää omaa mallinukkea?
Kyllä. Lataa mallinuken kuva kutsulla `POST /api/v1/mannequins` tai luo uusi tekoälymallinukke kutsulla `POST /api/v1/mannequins/generate`. Palautettu ID kytketään suoraan try-on-pyyntöön.
Miten teen pollingia tuloksen saamiseksi?
GET `/api/v1/tryon/apparel/:id` 3–5 sekunnin välein, kunnes `data.status` on `completed` tai `failed`. Aseta yrityksille yläraja — 120 × 3s kattaa dokumentoidun aikaikkunan reilusti.
Liittyvät kyvykkyydet
Ominaisuudet
Korujen try-on-API kaulakoruille, sormuksille, rannekoruille ja korvakoruille
Sovita kaulakoruja, sormuksia, rannekoruja ja korvakoruja AI-malleille RESTin kautta. 5 credits resoluutiolla 2K, sisäänrakennetut lähikuvamallit, heijastukset huomioiva renderöinti Photta-dokumentaation mukaisesti.
Katso endpointOminaisuudet
Ghost mannequin API näkymättömän mallinuken tuotekuviin
Tekoälypohjainen ghost mannequin -endpoint. Poista nukke vaatekuvasta ja säilytä sisäpuolen yksityiskohdat. 3D tai flat-lay, eräajo, 4 credits resoluutiolla 2K.
Katso endpointRakenna
Rakenna virtuaalinen try-on -ominaisuus sovellukseesi
Kattava toteutusmalli virtuaalisen try-on -ominaisuuden julkaisemiseen Photta APIlla: lataus, lähetys, polling workerista ja lopputuloksen renderöinti. TypeScript + vain palvelimella ajettavat mallit.
Katso endpointRakenna
Lisää virtuaalinen try-on iOS- tai Android-sovellukseen
Kuinka lisätä tekoälypohjainen virtuaalinen try-on natiiviin iOS- tai Android-sovellukseen Photta API:lla: älä koskaan toimita avainta laitteeseen, käytä proxyna taustajärjestelmääsi, peilaa työn tila.
Katso endpointVertailu
Photta vs FASHN — Muodin AI-rajapinnat rinnakkain
Photta ja FASHN vertailussa: endpointit, credit-hinnoittelu, tilaustasot, samanaikaisuusrajat. Perustuu kummankin yrityksen omaan hinnoittelusivuun 2026-04-19. Ei keksittyjä lukuja.
Katso endpointVertailu
Photta vs Fitroom — valitse sopivin muotialan API
Photta ja Fitroom vertailussa: endpointit, kutsukohtainen credit-kustannus, hinnoittelumalli ja integraatiopinta. Tiedot haettu kummaltakin sivustolta 2026-04-19. Ei keksittyjä lukuja.
Katso endpointPikaopas
Ensimmäinen Photta-kuva alle viidessä minuutissa.
Rekisteröidy, luo API-avain, suorita ensimmäinen cURL-kutsusi, tee pollingia valmistumiseen asti ja tallenna tulos. Viisi vaihetta, dokumentoitu alusta loppuun.
Katso endpointReferenssi
Photta API -virheet
Täydellinen luettelo Photta API -virhetyypeistä statuskoodeineen, virheen rungon rakenne ja tiedot siitä, mitkä virheet kannattaa yrittää uudelleen.
Katso endpointReferenssi
Photta API:n rate limitit
Photta API:n rate limit, sen aikaikkuna, Retry-After-otsake, pollausväli ja tilauskohtaiset rinnakkaisuusrajat, kaikki API-dokumentaatiosta luettuna.
Katso endpoint
Jokainen luku tällä sivulla on peräisin Photta-rajapinnan dokumentaatiosta · tarkistettu
Kokeile APIa viidessä minuutissa
Luo Photta-API-avain, liitä yllä oleva cURL-koodinpätkä, ja sinulla on ensimmäinen mallikuva ennen kuin kahvi ehtii tippua.
- 1.5–4 min
- 5 credits resoluutiolla 2K · 6 credits resoluutiolla 4K
- asynkroninen, polling
- 600 pyyntöä/min
- Bearer-avain