機能 · アパレル

バーチャルtry-on API アパレル向け

要約

Phottaのバーチャルtry-on APIは、平置きのアパレル画像、マネキンID、ポーズIDを受け取り、2Kまたは4Kのモデル着用写真を返します。ジョブをPOSTし、3〜5秒ごとにポーリングし、ステータスがcompletedになったらダウンロードします。

  • 所要時間の目安: 1.5–4 min
  • Credits: 2Kで5 credits · 4Kで6 credits
  • 処理方式: 非同期、ポーリング
  • 制限: 600 リクエスト/分
  • 認証: Bearerキー

このページに記載されている数値はすべて以下に基づきます: Photta APIドキュメント · 確認済み

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
出力例

概要

概要

エンドポイント
POST /api/v1/tryon/apparel
認証
Bearer APIキー
処理方式
非同期 — ステータスエンドポイントをポーリング
所要時間の目安
1.5–4 min
Credits
2Kで5 credits · 4Kで6 credits
アスペクト比
3:4 · 1:1 · 4:3 · 9:16 · 16:9
入力制限
1画像あたり最大10 MB、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": "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"
}

リクエストパラメータ

product_type

型: string必須

Type of garment.

値: topbottomtop_and_bottomone_piece
product_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. 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

型: 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. Auto-selected on back-facing poses when present.

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. Auto-selected on back-facing poses when present.

mannequin_id

型: string必須

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

pose_id

型: string必須

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

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

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

型: string

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

= 2K

値: 2K4K
aspect_ratio

型: string

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

= 3:4

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

型: string

Body size of the mannequin.

= M

値: XSSMLXLXXL
expression

型: string

Facial expression.

= neutral

値: neutralhappyserioussmiling
footwear_url

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

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

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

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

エラー

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.

制限

  • APIキーごとに毎分600リクエスト (固定ウィンドウ方式。制限値はすべてのプランで共通です)
  • 429にはRetry-After: 30 secondsが含まれます
  • 1画像あたり最大10 MB
  • フォーマット: JPEG, PNG, WebP
  • プランごとの同時実行バッチ数: Free 1 · Hobby 2 · Seller 3 · Brand 4 · Studio 6
  • ポーリングのみ — APIはWebhookを送信しません。

5つのステップ、1枚の商品写真

マネキンを選択し、ジョブを送信、完了までポーリングして、結果をダウンロードします。

  1. ステップ 1

    APIキーの生成

    ai.photta.app でサインアップし、Developers タブを開いて Generate API key をクリックします。本番キーは `photta_live_` で始まります。キーは `PHOTTA_API_KEY` に設定し、決してコミットしないでください。

  2. ステップ 2

    マネキンとポーズの選択

    利用可能な選択肢を取得するには GET `/api/v1/mannequins` を実行します。構図の取得には GET `/api/v1/poses` を使用します。両方のIDを try-on リクエストに含めます。

  3. ステップ 3

    try-on ジョブの POST 送信

    `/api/v1/tryon/apparel` に `product_type`、`product_images`、`mannequin_id`、`pose_id`、および任意の `resolution` と `aspect_ratio` を含めて POST リクエストを送信します。API は生成IDとともに 202 Accepted を返します。

  4. ステップ 4

    ジョブが完了するまでポーリング

    3秒ごとに GET `/api/v1/tryon/apparel/:id` を実行します。`data.status` が `completed` に切り替わると、ペイロードに `output_url` と `thumbnail_url` が含まれます。ジョブのハングによってリクエストが停止しないよう、上限回数を設けてください。

  5. ステップ 5

    ダウンロードと永続化

    `output_url` からバイトデータを取得し、自前のオブジェクトストレージに保存します。CDN の URL は安定していますが、プロダクトのレンダリングをこれに直接依存させるべきではありません。

アパレル try-on のリリース前に開発者からよくある質問

Photta のバーチャル try-on API とは?

商品の平置き写真とマネキンIDを受け取り、モデルが着用した写実的な画像を返す REST エンドポイントです。Photta のコンシューマー向けアプリと同じパイプラインを採用しています。top、bottom、top+bottom、one-piece の4つの商品タイプに対応しています。

1回のリクエストあたりのコストは?

2K の結果は 5 credits、4K は 6 credits です。credits はサブスクリプションに含まれており、追加購入も可能です。生成に失敗した場合は credits は消費されず、返金されます。

生成にはどのくらい時間がかかりますか?

エンドツーエンドの計測で、通常完了まで 1.5 〜 4分です。POST リクエストは1秒未満で生成IDを返し、GPU による処理はポーリング中にバックグラウンドで実行されます。

サポートされている商品タイプは?

`top`、`bottom`、`top_and_bottom`、`one_piece` の4種類です。それぞれ想定される `product_images` の形式が異なります。たとえば `top_and_bottom` では `top_image` と `bottom_image` の両方の URL が必要です。

独自のマネキンを使用できますか?

はい。`POST /api/v1/mannequins` でマネキン写真をアップロードするか、`POST /api/v1/mannequins/generate` で新しい AI マネキンを生成できます。返されたIDは、そのまま try-on リクエストに指定できます。

結果のポーリングはどのように行いますか?

`data.status` が `completed` または `failed` になるまで、3〜5秒ごとに GET `/api/v1/tryon/apparel/:id` を実行します。試行回数には上限を設定してください — 120回 × 3秒 に設定すれば、ドキュメントに記載された処理時間を十分にカバーできます。

関連機能

このページに記載されている数値はすべて以下に基づきます: Photta APIドキュメント · 確認済み

5分でAPIを試す

Photta APIキーを生成し、上記のcURLスニペットを貼り付ければ、コーヒーが淹れ終わる前に最初のモデル着用画像が手に入ります。

  • 1.5–4 min
  • 2Kで5 credits · 4Kで6 credits
  • 非同期、ポーリング
  • 600 リクエスト/分
  • Bearerキー