身份验证
创建一个 API 密钥,并将完整密钥作为 Bearer 凭据发送。密钥仅显示一次。
Authorization: Bearer fd_live_xxx提交虚拟试穿任务
提交服装图像和模特图像。成功请求将返回 HTTP 202 状态码及任务 ID。
curl -X POST \
"https://www.fashiondiffusion.ai/api/public/v1/virtual-try-on/tasks" \
-H "Authorization: Bearer fd_live_xxx" \
-H "Content-Type: application/json" \
--data-raw '{
"garmentImageUrl": "https://cdn.example.com/garment.jpg",
"modelImageUrl": "https://cdn.example.com/model.jpg",
"imageCount": 1,
"resolution": "2K",
"ratio": "3:4",
"mode": "FAST",
"prompt": "Keep the garment shape and fabric texture"
}'| 参数 | 支持的值 | 默认值 |
|---|---|---|
| imageCount | 1, 2, 4 | 1 |
| resolution | 2K, 4K | 2K |
| ratio | 1:1, 3:4, 4:3, 9:16, 16:9 | 3:4 |
| mode | FAST, REFINE | FAST |
两幅图像均须为公开的 HTTPS URL,响应内容类型为图像,且文件大小不得超过 20 MB。
每个被接受的请求均会创建并计费一项新任务。本版本不提供幂等性保护,因此除非可接受重复扣费,否则请勿自动重试超时的提交。
查询任务
使用提交端点返回的任务 ID。一个 API 密钥仅能读取其所属用户及当前团队拥有的任务。
curl \
-H "Authorization: Bearer fd_live_xxx" \
"https://www.fashiondiffusion.ai/api/public/v1/tasks/{taskId}"任务状态包括 QUEUED(排队中)、RUNNING(运行中)、SUCCEEDED(成功)和 FAILED(失败)。成功任务的输出图像 URL 将在 outputs 字段中返回。
列出任务
列出当前用户通过公开 API 提交的所有虚拟试穿任务。使用该用户任一 API 密钥提交的任务均会被包含。
curl \
-H "Authorization: Bearer fd_live_xxx" \
"https://www.fashiondiffusion.ai/api/public/v1/tasks?limit=20&createdAfter=2026-08-01T00%3A00%3A00Z"limit 参数取值范围为 1 至 100,默认值为 20;请在下一次请求中将 nextCursor 用作 cursor 参数;createdAfter 为可选的 ISO 8601 时间戳。
错误
错误响应采用统一的数据结构封装。请求 ID 同时会在 X-Request-Id 响应头中返回。
{
"error": {
"code": "VALIDATION_ERROR",
"message": "garmentImageUrl: Invalid url",
"requestId": "request-uuid"
}
}