Kapabilitas · Apparel

Virtual try-on API untuk pakaian

Ringkasan singkat

Virtual try-on API dari Photta menerima gambar pakaian flat-lay, ID manekin, serta ID pose, dan mengembalikan foto on-model 2K atau 4K. POST job tersebut, lakukan polling setiap 3–5 detik, unduh saat status completed.

  • Waktu umum: 1.5–4 min
  • Credits: 5 credits pada 2K · 6 credits pada 4K
  • Pemrosesan: async, polling
  • Batasan: 600 requests/min
  • Autentikasi: Bearer key

Setiap angka di halaman ini bersumber dari dokumentasi API Photta · diperiksa

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",
  "pose_id": "pose_c2d4e5",
  "background": "https://cdn.yourstore.com/backgrounds/studio-loft.jpg",
  "lock_background": true,
  "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
Contoh output

Sekilas

Sekilas

Endpoint
POST /api/v1/tryon/apparel
Autentikasi
API key Bearer
Pemrosesan
Asinkron — lakukan polling ke endpoint status
Waktu umum
1.5–4 min
Credits
5 credits pada 2K · 6 credits pada 4K
Rasio aspek
3:4 · 1:1 · 4:3 · 9:16 · 16:9
Batas input
Hingga 10 MB per gambar; JPEG, PNG, WebP
Idempoten
Tidak

Request dan 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": "t_shirt",
  "mannequin_id": "mnk_f3a9b1",
  "pose_id": "pose_c2d4e5",
  "background": "https://cdn.yourstore.com/backgrounds/studio-loft.jpg",
  "lock_background": true,
  "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",
    "pose_id": "pose_c2d4e5",
    "lock_background": true,
    "resolution": "2K",
    "aspect_ratio": "3:4",
    "credits_used": 5,
    "created_at": "2026-04-10T12:00:00Z"
  },
  "request_id": "req_xyz789"
}

Parameter request

product_type

Tipe: stringWajib

Type of garment.

Nilai: topbottomtop_and_bottomone_piece
product_images

Tipe: array[string]Wajib

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

Tipe: string

Optional URL or base64 data URI for the BACK of the garment. When supplied, the pipeline auto-switches to the back image whenever the selected pose is back-facing (Back / BackCloseUp). Not used when product_type is "top_and_bottom".

top_image

Tipe: string

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

top_back_image

Tipe: string

Optional back image of the top garment. Auto-selected on back-facing poses when present.

bottom_image

Tipe: string

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

bottom_back_image

Tipe: string

Optional back image of the bottom garment. Auto-selected on back-facing poses when present.

mannequin_id

Tipe: stringWajib

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

pose_id

Tipe: stringWajib

ID of the pose. Use GET /api/v1/poses to list available options. The pose dictates the framing of the output — what's in frame, whether the face/feet are visible, full body vs half body, etc.

background

Tipe: string

Optional URL or base64 data URI to a background photo. Anything that is not a URL or data: URI is rejected with HTTP 400. When omitted, an editorial neutral backdrop is used.

lock_background

Tipe: boolean

When true, the supplied background image is reproduced faithfully (locked) instead of being treated as loose inspiration. Requires the background field — returns 400 if set without a background. Echoed back in the response object.

= false

resolution

Tipe: string

Output resolution. 4K cannot be combined with aspect_ratio 1:1 — that combination returns 400.

= 2K

Nilai: 2K4K
aspect_ratio

Tipe: string

Output aspect ratio. 1:1 cannot be combined with resolution 4K — that combination returns 400.

= 3:4

Nilai: 3:41:14:39:1616:9
body_size

Tipe: string

Body size of the mannequin.

= M

Nilai: XSSMLXLXXL
expression

Tipe: string

Facial expression.

= neutral

Nilai: neutralhappyserioussmiling
footwear_url

Tipe: string

URL or base64 of a custom footwear image. The pipeline always stages the footwear when supplied; the prompt's pose-authority block decides whether to render it (poses that don't show feet drop it cleanly).

user_instruction

Tipe: 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

Tipe: 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

Tipe: string

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

bottom_category

Tipe: string

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

length

Tipe: 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

Tipe: 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

Tipe: 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

Tipe: 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

Tipe: 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

Tipe: 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.

Error

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. Retry later.

Batasan

  • 600 request per menit per API key (Fixed window; batasannya sama di setiap paket)
  • Respons 429 menyertakan Retry-After: 30 detik
  • Hingga 10 MB per gambar
  • Format: JPEG, PNG, WebP
  • Batch konkuren per paket: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
  • Hanya polling — API tidak mengirim webhook.

Lima langkah, satu foto produk

Pilih manekin, kirim job, lakukan polling hingga selesai, unduh hasilnya.

  1. Langkah 1

    Buat API key

    Daftar di ai.photta.app, buka tab Developers, klik Generate API key. Live key diawali dengan `photta_live_`. Simpan key di `PHOTTA_API_KEY` — jangan pernah di-commit.

  2. Langkah 2

    Pilih manekin dan pose

    Lakukan GET ke `/api/v1/mannequins` untuk melihat opsi yang tersedia. GET ke `/api/v1/poses` untuk framing. Masukkan kedua ID tersebut ke dalam request try-on.

  3. Langkah 3

    Kirim job try-on via POST

    Kirim POST ke `/api/v1/tryon/apparel` dengan `product_type`, `product_images`, `mannequin_id`, `pose_id`, serta `resolution` dan `aspect_ratio` opsional. API akan mengembalikan 202 Accepted beserta generation ID.

  4. Langkah 4

    Lakukan polling hingga job selesai

    Lakukan GET ke `/api/v1/tryon/apparel/:id` setiap 3 detik. Saat `data.status` berubah menjadi `completed`, payload akan menyertakan `output_url` dan `thumbnail_url`. Tetapkan batas maksimal agar job yang macet tidak menggantung request Anda.

  5. Langkah 5

    Unduh dan simpan

    Ambil byte dari `output_url` dan simpan di object storage milik Anda sendiri. URL CDN bersifat stabil, tetapi produk Anda sebaiknya tidak bergantung padanya untuk rendering.

Pertanyaan yang diajukan developer sebelum merilis try-on pakaian

Apa itu API virtual try-on Photta?

Endpoint REST yang menerima foto produk flat-lay serta ID manekin, lalu mengembalikan foto pada model yang fotorealistis. Pipeline yang sama dengan aplikasi konsumen Photta. Empat tipe produk didukung: top, bottom, top+bottom, one-piece.

Berapa biayanya per panggilan?

5 credits untuk hasil 2K, 6 credits untuk 4K. Credits disertakan dalam langganan Anda dan dapat di-top up. Generasi yang gagal tidak memotong credits — credits akan dikembalikan.

Berapa lama proses generasi berlangsung?

Penyelesaian tipikal berkisar antara 1.5 hingga 4 menit, diukur secara end-to-end. Request POST mengembalikan generation ID dalam waktu kurang dari satu detik; pemrosesan GPU berjalan di latar belakang selagi Anda melakukan polling.

Tipe produk apa saja yang didukung?

Empat: `top`, `bottom`, `top_and_bottom`, `one_piece`. Masing-masing membutuhkan struktur `product_images` yang berbeda — contohnya `top_and_bottom` membutuhkan URL `top_image` dan `bottom_image` sekaligus.

Bisakah saya menggunakan manekin saya sendiri?

Bisa. Unggah foto manekin dengan `POST /api/v1/mannequins` atau buat manekin AI baru dengan `POST /api/v1/mannequins/generate`. ID yang dikembalikan dapat langsung dimasukkan ke request try-on.

Bagaimana cara melakukan polling untuk mendapatkan hasil?

Lakukan GET ke `/api/v1/tryon/apparel/:id` setiap 3 hingga 5 detik sampai `data.status` bernilai `completed` atau `failed`. Tetapkan batas maksimal percobaan — 120 × 3s mencakup jendela waktu yang terdokumentasi dengan toleransi aman.

Kapabilitas terkait

Setiap angka di halaman ini bersumber dari dokumentasi API Photta · diperiksa

Coba API dalam lima menit

Buat Photta API key, tempel cuplikan cURL di atas, dan Anda akan mendapatkan gambar on-model pertama sebelum kopi selesai diseduh.

  • 1.5–4 min
  • 5 credits pada 2K · 6 credits pada 4K
  • async, polling
  • 600 requests/min
  • Bearer key