Capacidad · Apparel

API de virtual try-on para ropa

En una frase

La API de virtual try-on de Photta toma una imagen de ropa en flat-lay y un ID de maniquí, y devuelve una foto sobre modelo en 2K o 4K. Envía el job mediante POST, haz polling cada 3–5 segundos y descarga cuando el estado sea completed.

  • Tiempo típico: 1–1.5 min
  • Credits: 5 credits a 2K · 6 credits a 4K
  • Procesamiento: asíncrono, polling
  • Límites: 600 requests/min
  • Autenticación: Bearer key

Cada cifra de esta página proviene de la documentación de la API de Photta · verificado

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": "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')
A garment rendered on an AI model by the apparel try-on API
Salida de ejemplo

De un vistazo

De un vistazo

Endpoint
POST /api/v1/tryon/apparel
Autenticación
Bearer API key
Procesamiento
Asíncrono — realiza polling al endpoint de estado
Tiempo típico
1–1.5 min
Credits
5 credits a 2K · 6 credits a 4K
Relaciones de aspecto
3:4 · 1:1 · 4:3 · 2:3 · 3:2 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9
Límites de entrada
Hasta 10 MB por imagen; JPEG, PNG, WebP
Idempotente
Sí

Petición y respuesta

Petición

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')

202 Accepted / Completado

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

Parámetros de la petición

product_type

Tipo: stringObligatorio

Type of garment.

Valores: topbottomtop_and_bottomone_piece
product_images

Tipo: array[string]Obligatorio

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

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

Tipo: string

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

top_back_image

Tipo: string

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

bottom_image

Tipo: string

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

bottom_back_image

Tipo: string

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

mannequin_id

Tipo: stringObligatorio

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_color

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

Valores: whitelight_graygraycharcoalblackbeigecreamsand
pose_id

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

background

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

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

Tipo: string

Output resolution.

= 2K

Valores: 2K4K
aspect_ratio

Tipo: string

Output aspect ratio.

= 3:4

Valores: 3:41:14:32:33:24:55:49:1616:921:9
body_size

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

Valores: XSSMLXLXXLpetiteslimregularathleticcurvyplus_size
expression

Tipo: string

Facial expression. `happy` and `smiling` are both a soft smile. An unknown value adds no expression to the prompt.

= neutral

Valores: neutralsoft_smileconfidentseriousrelaxedhappysmiling
footwear_url

Tipo: 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_instruction

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

Tipo: 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_category

Tipo: string

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

bottom_category

Tipo: string

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

length

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

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

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

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

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

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

Errores

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, or (background removal) a free account has used its three cut-outs. Branch on the code.
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 or background_removal_unavailable). Retry later with backoff.

Límites

  • 600 solicitudes por minuto por cuenta (Ventana fija; el límite es el mismo en todos los planes)
  • Un 429 incluye Retry-After: 30 segundos
  • Hasta 10 MB por imagen
  • Formatos: JPEG, PNG, WebP
  • Lotes simultáneos por plan: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
  • Solo polling — la API no envía webhooks.

Cinco pasos, una sola foto de producto

Elige un maniquí, envía el job, haz polling hasta que termine, descarga el resultado.

  1. Paso 1

    Genera una API key

    Regístrate en ai.photta.app, abre la pestaña Developers y haz clic en Generate API key. Las claves de producción empiezan por `photta_live_`. Guarda la clave en `PHOTTA_API_KEY` — nunca la subas al repositorio.

  2. Paso 2

    Elige un maniquí

    GET `/api/v1/mannequins` para listar los modelos disponibles y tomar el ID que quieras. Las poses se retiraron el 2026-08-10: cada toma es de cuerpo entero recto, mirando a la cámara, por lo que no hay nada más que elegir.

  3. Paso 3

    Haz POST del job de try-on

    Envía un POST a `/api/v1/tryon/apparel` con `product_type`, `product_images`, `mannequin_id` y los parámetros opcionales `resolution` y `aspect_ratio`. La API devuelve 202 Accepted con un ID de generación.

  4. Paso 4

    Haz polling hasta que el job se complete

    GET `/api/v1/tryon/apparel/:id` cada 3 segundos. Cuando `data.status` cambie a `completed`, el payload incluirá `output_url` y `thumbnail_url`. Establece un límite máximo para evitar que un job bloqueado congele tu petición.

  5. Paso 5

    Descarga y persiste

    Obtén los bytes desde `output_url` y almacénalos en tu propio almacenamiento de objetos. La URL de la CDN es estable, pero tu producto no debería depender de ella para renderizar.

Preguntas que hacen los desarrolladores antes de integrar el try-on de ropa

¿Qué es la API de virtual try-on de Photta?

Un endpoint REST que recibe la foto de un producto en plano cenital (flat-lay) y un ID de maniquí, y devuelve una imagen fotorrealista sobre modelo. Es el mismo pipeline que utiliza la app para consumidores de Photta. Se admiten cuatro tipos de producto: top, bottom, top+bottom y one-piece.

¿Cuánto cuesta por llamada?

5 credits para un resultado en 2K, 6 credits para 4K. Los credits se incluyen con tu suscripción y se pueden recargar. Las generaciones fallidas no consumen credits — se reembolsan.

¿Cuánto tarda una generación?

El tiempo típico de finalización es de 1.5 a 4 minutos, medido de extremo a extremo. El POST devuelve un ID de generación en menos de un segundo; el procesamiento en GPU se realiza en segundo plano mientras haces polling.

¿Qué tipos de producto son compatibles?

Cuatro: `top`, `bottom`, `top_and_bottom`, `one_piece`. Cada uno espera una estructura distinta en `product_images` — por ejemplo, `top_and_bottom` requiere las URLs de `top_image` y `bottom_image`.

¿Puedo usar mi propio maniquí?

Sí. Sube la foto de un maniquí mediante `POST /api/v1/mannequins` o genera un nuevo maniquí con IA usando `POST /api/v1/mannequins/generate`. El ID devuelto se pasa directamente en la petición de try-on.

¿Cómo hago polling para obtener el resultado?

GET `/api/v1/tryon/apparel/:id` cada 3 a 5 segundos hasta que `data.status` sea `completed` o `failed`. Establece un límite máximo de intentos — 120 × 3s cubre la ventana documentada con margen de sobra.

Capacidades relacionadas

Cada cifra de esta página proviene de la documentación de la API de Photta · verificado

Prueba la API en cinco minutos

Genera una API key de Photta, pega el snippet de cURL de arriba y tendrás tu primera imagen con modelo antes de que termine de prepararse el café.

  • 1–1.5 min
  • 5 credits a 2K · 6 credits a 4K
  • asíncrono, polling
  • 600 requests/min
  • Bearer key