Skip to main content
POST
/
v1
/
images
/
generations
# model can be "grok-imagine-1.5-apimart", or the compatible alias "grok-imagine-1.5-ext"
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-imagine-1.5-apimart",
    "prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
    "size": "1:1",
    "n": 1
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01JNXXXXXXXXXXXXXXXXXX"
    }
  ]
}
Model name compatibility note: This endpoint also accepts the alias grok-imagine-1.5-ext, which is equivalent to grok-imagine-1.5-apimart. The two are interchangeable and produce identical results.
# model can be "grok-imagine-1.5-apimart", or the compatible alias "grok-imagine-1.5-ext"
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-imagine-1.5-apimart",
    "prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
    "size": "1:1",
    "n": 1
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01JNXXXXXXXXXXXXXXXXXX"
    }
  ]
}

Authorizations

Authorization
string
required
All APIs require Bearer Token authenticationGet API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY

Body

model
string
default:"grok-imagine-1.5-apimart"
required
Image generation model nameSupported models:
  • grok-imagine-1.5-apimart - Grok Image Generation (compatible alias grok-imagine-1.5-ext)
Example: "grok-imagine-1.5-apimart"
For backward compatibility, the alias grok-imagine-1.5-ext (for grok-imagine-1.5-apimart) remains usable.
prompt
string
required
Text description for image generation, supports multiple languages
size
string
default:"1:1"
Image generation sizeSupported formats:
  • 1:1 - Square (default)
  • 16:9 - Landscape widescreen
  • 9:16 - Portrait tall
  • 3:2 - Landscape
  • 2:3 - Portrait
n
integer
default:1
Number of images to generateRange: 1-10 (minimum 1, maximum 10)⚠️ Note: Must be a plain number (e.g. 1), do not add quotes, otherwise an error will occur

Response

code
integer
Response status code
data
array
Response data array

Use Cases

Case 1: Text-to-Image

{
  "model": "grok-imagine-1.5-apimart",
  "prompt": "An orange cat sitting on a sunny windowsill, oil painting style"
}

Case 2: Text-to-Image

{
  "model": "grok-imagine-1.5-apimart",
  "prompt": "A starry night sky background with a person standing in the foreground",
  "size": "16:9",
  "n": 2
}