Skip to main content
POST
https://api.apimart.ai
/
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": "gemini-2.5-flash-image-preview",
    "prompt": "A bamboo forest path under moonlight",
    "size": "1:1",
    "n": 1,
    "image_urls": [
      "https://cdn.apimart.ai/files/9998237590083776-36dfe26e-f6dd-43d4-83d5-afc5e6d29070-image_task_01K9BX28VRC2WG4S6F0N0DYWPJ_0.png"
    ]
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
    }
  ]
}
curl --request POST \
  --url https://api.apimart.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gemini-2.5-flash-image-preview",
    "prompt": "A bamboo forest path under moonlight",
    "size": "1:1",
    "n": 1,
    "image_urls": [
      "https://cdn.apimart.ai/files/9998237590083776-36dfe26e-f6dd-43d4-83d5-afc5e6d29070-image_task_01K9BX28VRC2WG4S6F0N0DYWPJ_0.png"
    ]
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
    }
  ]
}

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:"gemini-2.5-flash-image-preview"
required
Image generation model nameExample: "gemini-2.5-flash-image-preview"
prompt
string
required
Text description for image generationMaximum 1000 characters
size
string
Image generation sizeSupported formats:
  • Ratio: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
n
integer
Number of images to generateFixed at 1⚠️ Note: Must enter a plain number (e.g., 1), do not use quotes or it will cause an error
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

code
integer
Response status code
data
array
Response data array