Yetenek · Giyim

Sanal try-on API'si giyim için

Tek cümlede

Photta'nın sanal try-on API'si düz zemin giysi görseli ve bir manken ID'si alır ve 2K veya 4K model üzerinde çekim döndürür. İşi POST edin, her 3–5 saniyede bir sorgulayın (poll), durum completed olduğunda indirin.

  • Tipik süre: 1.5–4 min
  • Credits: 2K'da 5 credits · 4K'da 6 credits
  • İşleme: asenkron, polling
  • Sınırlar: 600 istek/dk
  • Kimlik doğrulama: Bearer anahtarı

Bu sayfadaki her veri şuradan alınmıştır: Photta API dokümantasyonu · kontrol edildi

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
Örnek çıktı

Genel bakış

Genel bakış

Endpoint
POST /api/v1/tryon/apparel
Kimlik doğrulama
Bearer API anahtarı
İşleme
Asenkron — durum endpoint'ini sorgulayın (poll)
Tipik süre
1.5–4 min
Credits
2K'da 5 credits · 4K'da 6 credits
En-boy oranları
3:4 · 1:1 · 4:3 · 2:3 · 3:2 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9
Girdi sınırları
Görsel başına en fazla 10 MB; JPEG, PNG, WebP
Idempotent
Hayır

İstek ve yanıt

İstek

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"
}

İstek parametreleri

product_type

Tür: stringZorunlu

Type of garment.

Değerler: topbottomtop_and_bottomone_piece
product_images

Tür: array[string]Zorunlu

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

Tür: 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

Tür: string

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

top_back_image

Tür: string

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

bottom_image

Tür: string

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

bottom_back_image

Tür: string

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

mannequin_id

Tür: stringZorunlu

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

background_color

Tür: 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.

Değerler: whitelight_graygraycharcoalblackbeigecreamsand
pose_id

Tür: 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

Tür: 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

Tür: 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

Tür: string

Output resolution.

= 2K

Değerler: 2K4K
aspect_ratio

Tür: string

Output aspect ratio.

= 3:4

Değerler: 3:41:14:32:33:24:55:49:1616:921:9
body_size

Tür: string

Body size of the mannequin.

= M

Değerler: XSSMLXLXXL
expression

Tür: string

Facial expression.

= neutral

Değerler: neutralhappyserioussmiling
footwear_url

Tür: 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

Tür: 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

Tür: 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

Tür: string

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

bottom_category

Tür: string

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

length

Tür: 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

Tür: 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

Tür: 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

Tür: 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

Tür: 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

Tür: 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.

Hatalar

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.

Sınırlar

  • Hesap başına dakikada 600 istek (Sabit pencere; limit her planda aynıdır)
  • 429 yanıtı Retry-After: 30 saniye içerir
  • Görsel başına en fazla 10 MB
  • Formatlar: JPEG, PNG, WebP
  • Plan başına eşzamanlı toplu işlem: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
  • Yalnızca polling — API webhook göndermez.

Beş adım, tek bir ürün fotoğrafı

Bir manken seçin, işi gönderin, tamamlanana kadar polling yapın, sonucu indirin.

  1. Adım 1

    Bir API anahtarı oluşturun

    ai.photta.app adresinden kaydolun, Developers sekmesini açın, Generate API key butonuna tıklayın. Canlı anahtarlar `photta_live_` ile başlar. Anahtarı `PHOTTA_API_KEY` içine koyun — asla commit etmeyin.

  2. Adım 2

    Bir manken seçin

    Kullanılabilir modelleri listelemek ve istediğiniz ID'yi almak için GET `/api/v1/mannequins` yapın. Pozlar 2026-08-10 tarihinde kullanımdan kaldırıldı: her çekim düz, kameraya bakan tam boy bir çekimdir, bu nedenle seçilecek başka bir şey yoktur.

  3. Adım 3

    Try-on işini POST edin

    `/api/v1/tryon/apparel` adresine `product_type`, `product_images`, `mannequin_id` ve isteğe bağlı `resolution` ile `aspect_ratio` içeren bir POST gönderin. API, bir üretim ID'si ile birlikte 202 Accepted döner.

  4. Adım 4

    İş tamamlanana kadar polling yapın

    Her 3 saniyede bir GET `/api/v1/tryon/apparel/:id` yapın. `data.status` değeri `completed` olduğunda payload `output_url` ve `thumbnail_url` içerir. Takılan bir işin isteğinizi askıda bırakmaması için bir üst sınır koyun.

  5. Adım 5

    İndirin ve kalıcı hale getirin

    Baytları `output_url` üzerinden çekin ve kendi nesne depolamanızda saklayın. CDN URL'i kararlıdır ancak ürününüz render için buna bağımlı olmamalıdır.

Geliştiricilerin giyim try-on özelliğini yayına almadan önce sorduğu sorular

Photta'nın sanal try-on API'si nedir?

Düz zemin (flat-lay) ürün görseli ve manken ID'si alıp model üzerinde fotogerçekçi bir görsel döndüren bir REST endpoint. Photta'nın tüketici uygulamasıyla aynı işlem hattı. Dört ürün türü desteklenir: top, bottom, top+bottom, one-piece.

Çağrı başına maliyeti ne kadar?

2K sonuç için 5 credits, 4K için 6 credits. Krediler aboneliğinizle birlikte gelir ve bakiye yüklenebilir. Başarısız üretimler kredi harcamaz — iade edilir.

Bir üretim ne kadar sürer?

Uçtan uca ölçüldüğünde tipik tamamlanma süresi 1.5 ila 4 dakikadır. POST işlemi bir saniyeden kısa sürede bir üretim ID'si döndürür; siz polling yaparken GPU işi arka planda gerçekleşir.

Hangi ürün türleri destekleniyor?

Dört adet: `top`, `bottom`, `top_and_bottom`, `one_piece`. Her biri farklı bir `product_images` yapısı bekler — örneğin `top_and_bottom`, hem `top_image` hem de `bottom_image` URL'lerini ister.

Kendi mankenimi kullanabilir miyim?

Evet. `POST /api/v1/mannequins` ile bir manken fotoğrafı yükleyin veya `POST /api/v1/mannequins/generate` ile yeni bir yapay zeka mankeni oluşturun. Dönen ID doğrudan try-on isteğine bağlanır.

Sonuç için nasıl polling yaparım?

`data.status` değeri `completed` veya `failed` olana kadar her 3 ila 5 saniyede bir GET `/api/v1/tryon/apparel/:id` yapın. Deneme sayısına bir üst sınır koyun — 120 × 3s, belgelenen zaman aralığını fazlasıyla karşılar.

İlgili yetenekler

Bu sayfadaki her veri şuradan alınmıştır: Photta API dokümantasyonu · kontrol edildi

API'yi beş dakikada deneyin

Bir Photta API key oluşturun, yukarıdaki cURL kod parçacığını yapıştırın; kahveniz demlenmeden önce model üzerindeki ilk görselinizi alın.

  • 1.5–4 min
  • 2K'da 5 credits · 4K'da 6 credits
  • asenkron, polling
  • 600 istek/dk
  • Bearer anahtarı