Skip to main content
POST
  1. After submission, a task_id will be returned. If you provided a callback_url, when the task status becomes finished or failed, a POST request will be sent to the callback_url.
  2. Regardless of whether callback_url is provided, you can retrieve the response result through the unified Query Task Status endpoint.

Grok Imagine Image 2.0 Generation

Use grok-imagine-image-2.0 for text-to-image generation and image editing through one model ID. When input.image_urls is empty or omitted, the model creates images from the prompt. When input.image_urls contains one to three images, the model edits those images. The default aspect ratio is 1:1. Use input.quality and input.resolution to control the output tier, and input.n to request up to four output images. Usage depends on the selected output count, quality, resolution, and number of input images.

Available Models

  • grok-imagine-image-2.0 - Text-to-image generation and multi-image editing

Authorizations

Authorization
string
header
required

All API endpoints require Bearer Token authentication

Get your API Key:

Visit the API Key Management Page to get your API Key

Add it to the request header:

Body

application/json
model
enum<string>
required

Grok Imagine Image 2.0 model identifier

Available options:
grok-imagine-image-2.0
input
object
required

Generation parameters. Providing image_urls selects image editing; otherwise the request creates images from text.

callback_url
string<uri>

Webhook callback URL for result notifications

Example:

"https://your-domain.com/callback"

Response

200 - application/json

Task submitted successfully

code
integer
required

HTTP status code

Example:

200

data
object
required