POST
/api/v1/imagine4 creditsSynchronousGrok Image 2
Provider · xAIType · T2IModel ID ·
grok-image-2Upstream ID · grok-4.2-imagexAI Grok 4.2 Image. Newest Grok image model with higher quality photorealism. Comparable to Midjourney quality for photographs. Recommended when photorealism is the priority.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Required | The text prompt describing the image to generate. |
| model | string | Optional | Set to `grok-image-2` to use this model.Default: grok-image-2 |
| aspect_ratio | string | Optional | Output aspect ratio. Allowed: 1:1 · 16:9 · 9:16 · 4:3 · 3:4 · 3:2 · 2:3.Default: 1:1 |
| webhook_url | string | Optional | URL where we POST the completed task result. |
| webhook_secret | string | Optional | Sent as x-webhook-secret header in webhook delivery for verification. |
Example Request
cURL
curl -X POST https://api.journeyapi.com/api/v1/imagine \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-image-2",
"prompt": "cinematic close-up of rain drops on a red rose, dramatic lighting, shallow depth of field",
"aspect_ratio": "3:4"
}'Response
This model is synchronous — the response includes the finished image_url directly. No polling required.
200 OK
{
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "finished",
"image_url": "https://cdn.example.com/output.png"
}Tips
- 1One of the best models for hyperrealistic photographs.
- 2Handles complex lighting scenarios and material textures very well.