Skip to main content
POST
This is an asynchronous image endpoint. A successful submission returns a task ID. Poll Get Task Status for the final result. Omit image_urls for text-to-image; include them for image editing or multi-image reference.

Model capabilities

Authorization

string
required
Use Bearer YOUR_API_KEY.

Body

string
default:"grok-imagine-image-2.0"
required
Must be grok-imagine-image-2.0.
boolean
default:"false"
Whether to run content moderation before submitting the image task.
  • true: use omni-moderation-latest to review prompts and input images
  • false or omitted: do not send a moderation request, adding no moderation cost or latency (default)
string
required
Image generation or editing instructions. Must be non-empty after trimming and no longer than 8,000 characters.
integer
default:"1"
Number of output images, from 1 to 10.
string
default:"auto"
Supported values: 1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2, 2:1, and auto.
string
default:"1k"
1k or 2k.
string
Text-to-image only: low or medium (default). Do not send this field when image_urls is present.
array
One to three reference images. Only publicly accessible absolute HTTP(S) URLs are accepted. Upload local images with POST /v1/uploads/images, then use the returned url. Omit the field when there is no reference image.

Asynchronous task flow

The submission response uses HTTP 202; the task ID is in data.id. Use data.poll_url or GET /v1/tasks/{task_id} until the task becomes completed or failed. See Get Task Status.
Do not expose a long-lived APIMart API key in browser code, public environment variables, URLs, local storage, or client logs. Call this endpoint from your backend or BFF.