Skip to main content
Use 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 a model and prompt.

Key parameters

Using reference images

Pass one or more reference images in the images array. Each image requires a url and a role.
Use reference_image when you need tighter control over style, composition, or subject.

Response handling

A completed image generation returns:
  • id for the generation
  • status: "completed"
  • data, which contains one or more generated files
  • usage, which contains billing details for the generation
Each item in 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.
See Errors for error handling details.

Full example