Generation API
Generation endpoints create asynchronous image-processing jobs.
Workflow
- Client requests available tools.
- Client sends a generation request with selected tool.
- API validates auth, payload, and limits.
- Job is queued for AI workers.
- Worker processes request and stores result.
- Client polls by
history_item_idfor final status.
Available Tools
Before generation, request the current tool list:
GET /generation/tools
Authorization: Bearer <api_key>
Example response:
[
{
"group_tool": "fashion",
"tool": "lego_clothes",
"title": "Lego Clothes"
},
{
"group_tool": "fashion",
"tool": "mamasfit",
"title": "MamasFit"
},
{
"group_tool": "fashion",
"tool": "lengerie",
"title": "Lengerie"
},
{
"group_tool": "fashion",
"tool": "fashion_card",
"title": "Fashion Card"
},
{
"group_tool": "fashion",
"tool": "fashion_swap",
"title": "Fashion Swap"
},
{
"group_tool": "fashion",
"tool": "fashion_swap_half",
"title": "Fashion Swap Half"
},
{
"group_tool": "interior",
"tool": "furniture",
"title": "Furniture"
},
{
"group_tool": "textile",
"tool": "fabric",
"title": "Fabric"
},
{
"group_tool": "default",
"tool": "default",
"title": "Default"
}
]
Use the tool value from this list in generation payload fields.
Example:
Generation Types
For selected tool, fetch available generation types:
GET /generation/generationTypes?tool=fashion_swap
Authorization: Bearer <api_key>
Example:
Generation Endpoint
Primary generation endpoint:
POST /generation/generate_image_v2/
Request Example
POST /generation/generate_image_v2/
Authorization: Bearer <api_key>
Content-Type: multipart/form-data
tool=fashion_swap
clothes=@clothes.png
person=@person.png
The value of tool should come from GET /generation/tools.
Example:
Initial Response
{
"preview_image": "image/generation_result/image_2.webp",
"stock_image": "image/generation_result/image_3.png",
"history_item_id": "gfd41688fhgf"
}
Status Model
| Status | Meaning |
|---|---|
pending | Accepted and queued |
complete | Result is ready |
error | Processing ended with an error |
Polling for Completion
GET /user/generation-history/{id}
Authorization: Bearer <api_key>
{
"status": "complete",
"preview_url": "/image/generation_result/preview.webp",
"stock_url": "/image/generation_result/stock.png"
}
Example:
Integration Notes
- Refresh tools cache periodically by calling
GET /generation/tools. - Use idempotency on the client side when retrying failed submissions.
- Poll with backoff (for example 2s, 4s, 8s) to reduce load.
- Treat
output_urlas externally accessible media and apply your own retention policy. - Validate real required fields against your OpenAPI schema at
http://localhost:8000/docs.
Example Links
- Tools discovery: GET /generation/tools examples
- Generation types: GET /generation/generationTypes examples
- Create generation: POST /generation/generate_image_v2/ examples
- Check generation result: GET /user/generation-history/:id examples