POST /v2/images/generations to create images synchronously. The API waits for completion and returns the finished files in the same response.
What to send
At minimum, send amodel and prompt.
Key parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
model | string | required | Model identifier. See Models. |
prompt | string | required | Text description of the image to generate. |
aspect_ratio | string | model default | Aspect ratio. Common values: 1:1, 16:9, 9:16, 2:3, 3:2. |
resolution | string | model default | Resolution label. Common values: 1K, 2K, 4K. |
output_format | string | jpeg | Output format: png, jpeg, webp. |
images | array | — | Reference images for guided generation. |
Using reference images
Pass one or more reference images in theimages array. Each image requires a url and a role.
reference_image when you need tighter control over style, composition, or subject.
Response handling
A completed image generation returns:idfor the generationstatus: "completed"data, which contains one or more generated filesusage, which contains billing details for the generation
data includes a signed download URL and a deletes_at timestamp. Download the file before it expires if you need to keep it in your own system.
See Media responses for the full response shape.
Common failure cases
- Invalid model, aspect ratio, or resolution returns
400. - Missing or invalid API keys return
401. - Insufficient balance returns
402. - Safety failures for prompts or reference images return
422. - Rate or concurrency limits return
429.