Fonctionnalité · Apparel
API de try-on virtuel pour les vêtements
En une phrase
L'API de try-on virtuel de Photta prend une photo de vêtement à plat, un mannequin_id et un identifiant de pose, puis renvoie une photo portée sur modèle en 2K ou 4K. Envoyez le job en POST, interrogez le statut toutes les 3–5 secondes, téléchargez lorsque le statut est completed.
- Délai typique: 1.5–4 min
- Crédits: 5 crédits en 2K · 6 crédits en 4K
- Traitement: asynchrone, polling
- Limites: 600 requêtes/min
- Authentification: Clé Bearer
Chaque chiffre sur cette page provient de la documentation de l'API Photta · vérifié
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')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",
"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."
}),
});
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",
"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."
},
)
data = res.json()["data"] # data["id"], data["status"]
En un coup d'œil
En un coup d'œil
- Endpoint
- POST /api/v1/tryon/apparel
- Authentification
- Clé API Bearer
- Traitement
- Asynchrone — interrogez l'endpoint de statut par polling
- Délai typique
- 1.5–4 min
- Crédits
- 5 crédits en 2K · 6 crédits en 4K
- Rapports d'aspect
- 3:4 · 1:1 · 4:3 · 9:16 · 16:9
- Limites d'entrée
- Jusqu'à 10 Mo par image ; JPEG, PNG, WebP
- Idempotent
- Non
Requête et réponse
Requête
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')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",
"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."
}),
});
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",
"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."
},
)
data = res.json()["data"] # data["id"], data["status"]202 Accepted / Terminé
{
"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"
}{
"data": {
"id": "try_abc123",
"status": "completed",
"product_type": "top",
"mannequin_id": "mnk_f3a9b1",
"pose_id": "pose_c2d4e5",
"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"
}Paramètres de requête
product_typeType: stringRequis
Type of garment.
Valeurs:topbottomtop_and_bottomone_pieceproduct_imagesType: array[string]Requis
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_imageType: 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_imageType: string
Front image of the top garment. Required when product_type is "top_and_bottom".
top_back_imageType: string
Optional back image of the top garment. Auto-selected on back-facing poses when present.
bottom_imageType: string
Front image of the bottom garment. Required when product_type is "top_and_bottom".
bottom_back_imageType: string
Optional back image of the bottom garment. Auto-selected on back-facing poses when present.
mannequin_idType: stringRequis
ID of the mannequin to wear the garment. Use GET /api/v1/mannequins to list available options.
pose_idType: stringRequis
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.
backgroundType: 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_backgroundType: 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
resolutionType: string
Output resolution. 4K cannot be combined with aspect_ratio 1:1 — that combination returns 400.
= 2K
Valeurs:2K4Kaspect_ratioType: string
Output aspect ratio. 1:1 cannot be combined with resolution 4K — that combination returns 400.
= 3:4
Valeurs:3:41:14:39:1616:9body_sizeType: string
Body size of the mannequin.
= M
Valeurs:XSSMLXLXXLexpressionType: string
Facial expression.
= neutral
Valeurs:neutralhappyserioussmilingfootwear_urlType: 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_instructionType: 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_categoryType: 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_categoryType: string
Silhouette anchor for the top half. Only valid when product_type is "top_and_bottom".
bottom_categoryType: string
Silhouette anchor for the bottom half. Only valid when product_type is "top_and_bottom".
lengthType: 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}.
fitType: 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_lengthType: 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_fitType: 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_lengthType: 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_fitType: 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.
Erreurs
- 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. Retry later.
Limites
- 600 requêtes par minute par clé API (Fenêtre fixe ; la limite est identique sur tous les forfaits)
- Une 429 renvoie Retry-After: 30 secondes
- Jusqu'à 10 Mo par image
- Formats: JPEG, PNG, WebP
- Lots simultanés par forfait: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
- Polling uniquement — l'API n'envoie aucun webhook.
5 étapes, une seule photo de produit
Choisissez un mannequin, soumettez le job, effectuez le polling jusqu'à la fin, téléchargez le résultat.
Étape 1
Générer une clé API
Inscrivez-vous sur ai.photta.app, ouvrez l'onglet Developers, cliquez sur Generate API key. Les clés de production commencent par `photta_live_`. Placez la clé dans `PHOTTA_API_KEY` — ne la committez jamais.
Étape 2
Choisir un mannequin et une pose
GET `/api/v1/mannequins` pour lister les options disponibles. GET `/api/v1/poses` pour le cadrage. Les deux identifiants s'intègrent dans la requête de try-on.
Étape 3
Envoyer le job de try-on en POST
Envoyez une requête POST à `/api/v1/tryon/apparel` avec `product_type`, `product_images`, `mannequin_id`, `pose_id` et les options `resolution` et `aspect_ratio`. L'API renvoie 202 Accepted avec un identifiant de génération.
Étape 4
Effectuer le polling jusqu'à la fin du job
GET `/api/v1/tryon/apparel/:id` toutes les 3 secondes. Lorsque `data.status` passe à `completed`, le payload contient `output_url` et `thumbnail_url`. Définissez une limite haute pour éviter qu'un job bloqué ne suspende indéfiniment votre requête.
Étape 5
Télécharger et persister
Récupérez les octets depuis `output_url` et stockez-les dans votre propre stockage d'objets. L'URL CDN est stable, mais votre produit ne doit pas en dépendre pour l'affichage.
Même endpoint en Node.js, Python et cURL
Node.js
API de try-on virtuel en Node.js
Appelez aPI de try-on virtuel de Photta depuis un backend Node.js avec fetch natif. Aucun SDK requis : stockez votre clé, soumettez le job, récupérez le résultat par polling.
LirePython
API de try-on virtuel en Python
Appelez aPI de try-on virtuel de Photta en Python avec la bibliothèque requests. Un wrapper de trente lignes, compatible asynchrone via httpx, fonctionnant dans Django, FastAPI et Celery.
LirecURL
API de try-on virtuel avec cURL
Appelez aPI de try-on virtuel de Photta directement depuis le shell avec cURL. Soumettez, effectuez le polling, téléchargez — chaque extrait s'associe à jq pour vos pipelines scriptés.
Lire
Questions que les développeurs se posent avant de déployer le try-on de vêtements
Qu'est-ce que l'API de virtual try-on de Photta ?
Un endpoint REST qui prend en entrée une photo de produit à plat (flat-lay) ainsi qu'un mannequin ID, et renvoie une image photoréaliste portée sur modèle. Même pipeline que l'application grand public de Photta. 4 types de produits sont pris en charge : haut, bas, haut+bas, une-pièce.
Combien coûte chaque appel ?
5 credits pour un résultat en 2K, 6 credits pour la 4K. Les credits sont inclus dans votre abonnement et peuvent être rechargés. Les générations échouées ne coûtent aucun credit — elles sont remboursées.
Combien de temps prend une génération ?
La finalisation prend généralement 1.5 à 4 minutes, mesurée de bout en bout. La requête POST renvoie un identifiant de génération en moins d'une seconde ; le traitement GPU s'exécute en tâche de fond pendant votre polling.
Quels types de produits sont pris en charge ?
Quatre : `top`, `bottom`, `top_and_bottom`, `one_piece`. Chacun attend une structure spécifique pour `product_images` — par exemple, `top_and_bottom` nécessite les URL `top_image` et `bottom_image`.
Puis-je utiliser mon propre mannequin ?
Oui. Uploadez une photo de mannequin avec `POST /api/v1/mannequins` ou générez un nouveau mannequin IA via `POST /api/v1/mannequins/generate`. L'identifiant renvoyé s'injecte directement dans la requête de try-on.
Comment effectuer le polling pour obtenir le résultat ?
GET `/api/v1/tryon/apparel/:id` toutes les 3 à 5 secondes jusqu'à ce que `data.status` passe à `completed` ou `failed`. Fixez une limite haute sur les tentatives — 120 × 3s couvre largement la fenêtre documentée.
Fonctionnalités associées
Fonctionnalités
API de try-on de bijoux pour colliers, bagues, bracelets et boucles d'oreilles
Positionnez colliers, bagues, bracelets et boucles d'oreilles sur des modèles IA via REST. 5 credits en 2K, mannequins gros plan intégrés, rendu gérant les reflets d'après la documentation de Photta.
Voir l'endpointFonctionnalités
API mannequin fantôme pour des photos de produits sur mannequin invisible
Endpoint AI de mannequin fantôme. Supprimez le mannequin d'une photo de vêtement et préservez les détails intérieurs. 3D ou flat-lay, traitement par lots, 4 credits en 2K.
Voir l'endpointDévelopper
Intégrez une fonctionnalité de try-on virtuel à votre application
Guide d'implémentation de bout en bout pour intégrer le try-on virtuel avec l'API Photta : upload, soumission, polling via un worker, rendu du résultat. Architecture TypeScript + server-only.
Voir l'endpointDévelopper
Ajouter le virtual try-on à une application iOS ou Android
Comment ajouter le virtual try-on IA à une application native iOS ou Android avec l'API Photta : ne livrez jamais la clé sur l'appareil, passez par un proxy sur votre backend, répliquez l'état des jobs.
Voir l'endpointComparer
Photta vs FASHN — API d’IA pour la mode, côte à côte
Photta et FASHN comparés : endpoints, tarification en crédits, niveaux d’abonnement, limites de concurrence. Données issues de la page de tarification respective de chaque entreprise au 2026-04-19. Aucun chiffre inventé.
Voir l'endpointComparer
Photta vs Fitroom — choisissez l'API mode adaptée à vos besoins
Comparaison entre Photta et Fitroom : endpoints, coût en crédits par appel, modèle tarifaire et surface d'intégration. Données extraites de chaque site le 2026-04-19. Aucun chiffre inventé.
Voir l'endpointDémarrage rapide
Première image Photta en moins de cinq minutes.
Inscrivez-vous, générez une clé d'API, lancez votre premier appel cURL, effectuez le polling jusqu'à la complétion, persistez le résultat. Cinq étapes documentées de bout en bout.
Voir l'endpointRéférence
Erreurs de l’API Photta
La liste complète des types d’erreurs de l’API Photta avec leurs codes de statut, la structure du corps d’erreur et les échecs pouvant être réessayés.
Voir l'endpointRéférence
Rate limits de l'API Photta
La rate limit de l'API Photta, sa fenêtre, l'en-tête Retry-After, l'intervalle de polling et les plafonds de simultanéité par forfait, tels que documentés dans l'API.
Voir l'endpoint
Chaque chiffre sur cette page provient de la documentation de l'API Photta · vérifié
Testez l'API en cinq minutes
Générez une clé d'API Photta, collez le snippet cURL ci-dessus, et vous obtiendrez votre première photo portée sur modèle avant même que le café ait fini de couler.
- 1.5–4 min
- 5 crédits en 2K · 6 crédits en 4K
- asynchrone, polling
- 600 requêtes/min
- Clé Bearer