Возможность · Одежда
API виртуального try-on для одежды
В двух словах
API виртуального try-on от Photta принимает фото одежды раскладкой (flat-lay) и ID манекена, возвращая фото на модели в 2K или 4K. Отправьте задачу через POST, делайте polling каждые 3–5 секунд, скачайте результат, когда статус станет completed.
- Типичное время: 1–1.5 min
- Кредиты: 5 credits при 2K · 6 credits при 4K
- Обработка: async, polling
- Лимиты: 600 запросов/мин
- Аутентификация: Ключ Bearer
Все показатели на этой странице взяты из документации API Photta · проверено
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')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": "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."
}),
});
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": "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."
},
)
data = res.json()["data"] # data["id"], data["status"]
Коротко о главном
Коротко о главном
- Эндпоинт
- POST /api/v1/tryon/apparel
- Аутентификация
- API-ключ Bearer
- Обработка
- Асинхронно — опрашивайте эндпоинт статуса
- Типичное время
- 1–1.5 min
- Кредиты
- 5 credits при 2K · 6 credits при 4K
- Соотношения сторон
- 3:4 · 1:1 · 4:3 · 2:3 · 3:2 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9
- Ограничения на входные данные
- До 10 МБ на изображение; JPEG, PNG, WebP
- Идемпотентность
- Да
Запрос и ответ
Запрос
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')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": "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."
}),
});
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": "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."
},
)
data = res.json()["data"] # data["id"], data["status"]202 Accepted / Завершено
{
"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"
}Параметры запроса
product_typeТип: stringОбязательное
Type of garment.
Значения:topbottomtop_and_bottomone_pieceproduct_imagesТип: array[string]Обязательное
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Тип: 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Тип: string
Front image of the top garment. Required when product_type is "top_and_bottom".
top_back_imageТип: string
Optional back image of the top garment. Sending one asks for a back shot, exactly as product_back_image does.
bottom_imageТип: string
Front image of the bottom garment. Required when product_type is "top_and_bottom".
bottom_back_imageТип: string
Optional back image of the bottom garment. Sending one asks for a back shot, exactly as product_back_image does.
mannequin_idТип: stringОбязательное
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Тип: 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.
Значения:whitelight_graygraycharcoalblackbeigecreamsandpose_idТип: 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Тип: 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Тип: 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Тип: string
Output resolution.
= 2K
Значения:2K4Kaspect_ratioТип: string
Output aspect ratio.
= 3:4
Значения:3:41:14:32:33:24:55:49:1616:921:9body_sizeТип: 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
Значения:XSSMLXLXXLpetiteslimregularathleticcurvyplus_sizeexpressionТип: string
Facial expression. `happy` and `smiling` are both a soft smile. An unknown value adds no expression to the prompt.
= neutral
Значения:neutralsoft_smileconfidentseriousrelaxedhappysmilingfootwear_urlТип: 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Тип: 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Тип: 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Тип: string
Silhouette anchor for the top half. Only valid when product_type is "top_and_bottom".
bottom_categoryТип: string
Silhouette anchor for the bottom half. Only valid when product_type is "top_and_bottom".
lengthТип: 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Тип: 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Тип: 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Тип: 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Тип: 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Тип: 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.
Ошибки
- 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, or (background removal) a free account has used its three cut-outs. Branch on the code.
- 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 or background_removal_unavailable). Retry later with backoff.
Лимиты
- 600 запросов в минуту на один аккаунт (Фиксированное окно; лимит одинаков для всех планов)
- Ответ 429 содержит заголовок Retry-After: 30 секунд
- До 10 МБ на изображение
- Форматы: JPEG, PNG, WebP
- Параллельных пакетов на план: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
- Только polling — API не отправляет вебхуки.
Пять шагов, одно фото товара
Выберите манекен, отправьте задачу, опрашивайте до готовности, скачайте результат.
Шаг 1
Сгенерируйте API-ключ
Зарегистрируйтесь на ai.photta.app, откройте вкладку Developers и нажмите Generate API key. Боевые ключи начинаются с `photta_live_`. Сохраните ключ в `PHOTTA_API_KEY` — никогда не коммитьте его.
Шаг 2
Выберите манекен
Выполните GET `/api/v1/mannequins`, чтобы получить список доступных моделей и взять нужный ID. Позы были удалены 2026-08-10: каждый снимок делается в полный рост прямо перед камерой, так что выбирать больше нечего.
Шаг 3
Отправьте задачу на try-on через POST
Отправьте POST-запрос на `/api/v1/tryon/apparel` с параметрами `product_type`, `product_images`, `mannequin_id`, а также опциональными `resolution` и `aspect_ratio`. API вернёт 202 Accepted с ID генерации.
Шаг 4
Опрашивайте статус до завершения задачи
Выполняйте GET `/api/v1/tryon/apparel/:id` каждые 3 секунды. Когда `data.status` переключится на `completed`, payload будет содержать `output_url` и `thumbnail_url`. Задайте верхний лимит попыток, чтобы зависшая задача не блокировала ваш запрос.
Шаг 5
Скачайте и сохраните
Заберите байты по `output_url` и сохраните их в собственном объектном хранилище. URL в CDN стабилен, но ваш продакшн не должен зависеть от него при рендеринге.
Один и тот же эндпоинт на Node.js, Python и cURL
Node.js
API виртуального try-on на Node.js
Вызывайте aPI виртуального try-on от Photta из бэкенда на Node.js с помощью нативного fetch. SDK не требуется: сохраните ключ, отправьте задачу, получите результат через polling.
ЧитатьPython
API виртуального try-on на Python
Вызывайте Photta aPI виртуального try-on на Python с помощью библиотеки requests. Обертка на тридцать строк, поддержка асинхронности через httpx, работает в Django, FastAPI и Celery.
ЧитатьcURL
API виртуального try-on с помощью cURL
Вызывайте aPI виртуального try-on от Photta напрямую из терминала с помощью cURL. Отправка, поллинг, загрузка — каждый фрагмент готов к использованию с jq для построения скриптовых пайплайнов.
Читать
Вопросы, которые разработчики задают перед запуском try-on одежды
Что такое API виртуальной примерки Photta?
REST-эндпоинт, который принимает раскладку товара (flat-lay) и ID манекена, возвращая фотореалистичное изображение на модели. Тот же пайплайн, что и в пользовательском приложении Photta. Поддерживаются четыре типа товаров: top, bottom, top+bottom, one-piece.
Сколько стоит один вызов?
5 credits за результат в 2K, 6 credits за 4K. Кредиты включены в подписку, их можно докупать. Неудачные генерации не расходуют credits — за них оформляется возврат.
Сколько времени занимает генерация?
Обычно выполнение занимает от 1.5 до 4 минут (полный цикл end-to-end). POST-запрос возвращает ID генерации менее чем за секунду; обработка на GPU происходит в фоне, пока вы выполняете polling.
Какие типы товаров поддерживаются?
Четыре: `top`, `bottom`, `top_and_bottom`, `one_piece`. Для каждого требуется своя структура `product_images` — например, для `top_and_bottom` нужны URL как для `top_image`, так и для `bottom_image`.
Можно ли использовать собственный манекен?
Да. Загрузите фото манекена с помощью `POST /api/v1/mannequins` или сгенерируйте новый AI-манекен через `POST /api/v1/mannequins/generate`. Полученный ID сразу передаётся в запрос на try-on.
Как опрашивать статус для получения результата?
Выполняйте GET `/api/v1/tryon/apparel/:id` каждые 3–5 секунд, пока `data.status` не примет значение `completed` или `failed`. Обязательно ограничьте число попыток сверху — 120 × 3s с запасом покрывает документированное окно ожидания.
Связанные возможности
Возможности
API примерки ювелирных изделий для колье, колец, браслетов и серег
Примерка ожерелий, колец, браслетов и серёг на AI-моделях через REST. 5 credits в 2K, встроенные манекены крупным планом, рендеринг с учётом отражений из документации Photta.
Посмотреть endpointВозможности
API невидимого манекена (ghost mannequin) для фото товаров на невидимом манекене
AI-эндпоинт для эффекта невидимого манекена. Удаляет манекен с фото одежды с сохранением деталей внутренней части. 3D или раскладка, пакетная обработка, 4 credits в 2K.
Посмотреть endpointРазработка
Внедрите виртуальную примерку (virtual try-on) в свое приложение
Полное пошаговое руководство по запуску виртуальной примерки с помощью Photta API: загрузка, отправка задачи, polling из воркера и отображение результата. Паттерны для TypeScript и бэкенда.
Посмотреть endpointРазработка
Добавьте виртуальный try-on в приложение для iOS или Android
Как добавить виртуальный AI-try-on в нативное приложение для iOS или Android с помощью Photta API: никогда не зашивайте ключ в устройство, проксируйте через бэкенд, дублируйте статус задачи.
Посмотреть endpointСравнение
Photta против FASHN — прямое сравнение fashion AI API
Сравнение Photta и FASHN: эндпоинты, цены в credits, тарифные планы, лимиты параллельных запросов. Данные собраны с официальных страниц с тарифами обеих компаний на 2026-04-19. Никаких выдуманных цифр.
Посмотреть endpointСравнение
Photta против Fitroom — выберите подходящий fashion AI API
Сравнение Photta и Fitroom по доступным endpoints, стоимости вызова в credits, модели тарификации и возможностям интеграции. Данные собраны с сайтов 2026-04-19. Без выдуманных цифр.
Посмотреть endpointБыстрый старт
Первое изображение в Photta менее чем за 5 минут.
Зарегистрируйтесь, сгенерируйте API-ключ, выполните первый вызов cURL, опрашивайте статус до завершения, сохраните результат. 5 шагов с полным описанием.
Посмотреть endpointСправочник
Ошибки Photta API
Полный список типов ошибок Photta API с их статус-кодами, формат тела ошибки и сбои, которые имеет смысл повторять.
Посмотреть endpointСправочник
Rate limits в Photta API
Rate limit Photta API, его окно, заголовок Retry-After, интервал polling и ограничения параллелизма по планам — прямо из документации API.
Посмотреть endpoint
Все показатели на этой странице взяты из документации API Photta · проверено
Протестируйте API за пять минут
Сгенерируйте API-ключ Photta, вставьте пример cURL выше, и вы получите первое изображение на модели быстрее, чем сварится кофе.
- 1–1.5 min
- 5 credits при 2K · 6 credits при 4K
- async, polling
- 600 запросов/мин
- Ключ Bearer