Skip to main content
POST
/
v1
/
images
/
generations
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-4o-image",
    "prompt": "An ancient castle under the starry sky",
    "size": "1:1",
    "n": 1,
    "image_urls": [
      "https://cdn.apimart.ai/doc/9998238784524590-549804af-14bc-4fbc-bae5-9d8469d35de3-image_task_01K889V97T2YF8RHQW21XMVMS1_0.png"
    ]
  }'
{
  "code": 200,
  "data": {
    "created": 1757156493,
    "id": "task_01J9HC8X5M7P3QKWN2R9T4VYZ6",
    "model": "gpt-4o-image",
    "object": "image.generation.task",
    "progress": 0,
    "status": "pending",
    "task_info": {
      "can_cancel": true,
      "estimated_time": 100
    },
    "type": "image"
  }
}
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-4o-image",
    "prompt": "An ancient castle under the starry sky",
    "size": "1:1",
    "n": 1,
    "image_urls": [
      "https://cdn.apimart.ai/doc/9998238784524590-549804af-14bc-4fbc-bae5-9d8469d35de3-image_task_01K889V97T2YF8RHQW21XMVMS1_0.png"
    ]
  }'
{
  "code": 200,
  "data": {
    "created": 1757156493,
    "id": "task_01J9HC8X5M7P3QKWN2R9T4VYZ6",
    "model": "gpt-4o-image",
    "object": "image.generation.task",
    "progress": 0,
    "status": "pending",
    "task_info": {
      "can_cancel": true,
      "estimated_time": 100
    },
    "type": "image"
  }
}

Authorizations

Authorization
string
required
All API endpoints require Bearer Token authenticationGet your 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:"gpt-4o-image"
required
Image generation model nameExample: "gpt-4o-image"
prompt
string
required
Text description for image generationMaximum 1000 characters
size
string
Image generation sizeSupported formats:
  • Ratios: 1:1, 2:3, 3:2
n
integer
Number of images to generateSupports 1, 2, 4. Charges will be pre-deducted based on the number
image_urls
array
Reference image URL list for image-to-image or image editing
  • Maximum 5 images
  • Each image should not exceed 10MB
  • Supported formats: .jpeg, .jpg, .png, .webp
mask_url
string
Mask image URL
  • Must be PNG format
  • Size must match the reference image
  • Maximum 4MB

Response

created
integer
Task creation timestamp
id
string
Unique task identifier
model
string
The actual model name used
object
string
Object type, fixed as image.generation.task
progress
integer
Task completion progress percentage (0-100)
status
string
Task statusPossible values:
  • pending - Waiting for processing
  • processing - In progress
  • completed - Completed
  • failed - Failed
task_info
object
Task details
type
string
Output type, fixed as image
usage
object
Billing information