Z-Image
Use z-image to create image output. This page contains the complete request needed for this model.
Model facts
| Property | Value |
|---|---|
| Model ID | z-image |
| Endpoint | POST /api/v1/generation/create |
| Output | Image |
| Modes | text-to-image, image-to-image |
| Pricing | View current pricing |
Minimal request
curl -X POST https://api.api-stock.com/api/v1/generation/create \
-H "Authorization: Bearer $API_STOCK_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "z-image",
"input": {
"prompt": "A cinematic scene with soft natural light"
}
}'The create response contains a task ID:
{
"code": 200,
"data": {
"taskId": "019ca881-9503-7270-a560-f00fc2b15785",
"status": "not_started",
"createdAt": "2026-08-22T12:00:00.000Z"
}
}Parameters
Parameters belong inside the top-level input object. Unknown fields are rejected.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | — | Text description for image generation max 1000 chars |
urls | string[] | No | — | Optional reference image for editing (exactly one URL). Providing it switches the request to image editing. |
size | “1:1” | “4:3” | “3:4” | “16:9” | “9:16” | No | "1:1" | Image aspect ratio. Required for text-to-image; optional for image editing (defaults to following the reference image). |
enableSafetyChecker | boolean | No | — | Enable the model’s safety checker (defaults to true) |
Modes
Minimal generation
{
"model": "z-image",
"input": {
"prompt": "A cinematic scene with soft natural light"
}
}With urls
{
"model": "z-image",
"input": {
"prompt": "A cinematic scene with soft natural light",
"urls": [
"https://example.com/input.jpg"
]
}
}Constraints
prompt: maximum 1000 characters.size: allowed:1:1,4:3,3:4,16:9,9:16.
Invalid types, unsupported enum values, out-of-range numbers, and missing required fields return HTTP 400 with error.code: "invalid_input". Correct the request rather than retrying it unchanged.
Result
Poll the task or provide a top-level webhook URL in the create request:
curl https://api.api-stock.com/api/v1/task/status/$TASK_ID \
-H "Authorization: Bearer $API_STOCK_KEY"A successful media task returns one or more files:
{
"code": 200,
"data": {
"taskId": "019ca881-9503-7270-a560-f00fc2b15785",
"status": "finished",
"files": [
{
"fileUrl": "https://storage.api-stock.com/result.png",
"fileType": "image"
}
],
"createdTime": "2026-08-22T12:00:00.000Z"
}
}See Tasks and webhooks for terminal statuses, retries and webhook delivery.