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-3.1-flash-image-preview",
    "prompt": "Cyberpunk cityscape at night with neon lights",
    "size": "16:9",
    "resolution": "2K",
    "n": 1
  }'
{
  "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-3.1-flash-image-preview",
    "prompt": "Cyberpunk cityscape at night with neon lights",
    "size": "16:9",
    "resolution": "2K",
    "n": 1
  }'
{
  "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-3.1-flash-image-preview"
required
Image generation model nameExample: "gemini-3.1-flash-image-preview"
prompt
string
required
Text description for image generation
size
string
Image aspect ratioSupported ratios:
  • 1:1 - Square, avatars, social media
  • 3:2 / 2:3 - Standard photos
  • 4:3 / 3:4 - Traditional display ratio
  • 16:9 / 9:16 - Widescreen / vertical video covers
  • 5:4 / 4:5 - Instagram images
  • 21:9 - Ultra-wide banner
  • 1:4 / 4:1 - Long poster / banner
  • 1:8 / 8:1 - Extreme long images / banner ads
resolution
string
default:"1K"
Output image resolutionSupported values:
  • 0.5K - ~512px, low-resolution preview
  • 1K - ~1024px, standard resolution (default)
  • 2K - ~2048px, high resolution
  • 4K - ~4096px, ultra-high resolution
Note: Different resolutions have different pricing. 4K costs more than 1K.
n
integer
Number of images to generateDefault: 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 generationTwo formats are supported:1. Full image URL
  • Publicly accessible image URL (http:// or https://)
  • Example: https://example.com/image.jpg
2. Base64 encoded format
  • Must use the full Data URI format
  • Format: data:image/{format};base64,{base64data}
  • Supported image formats: jpeg, png, webp
  • Example: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABg...
  • ⚠️ Note: Must include the data:image/jpeg;base64, prefix
Limitations:
  • Maximum 14 reference images (recommended: up to 10 object refs + 4 character refs)
  • Single image size: not exceeding 10MB
  • Supported formats: jpeg, png, webp
Enable Google text search enhancement
  • true: The model will search web text information to assist image generation, suitable for scenarios requiring real-world information
  • false: Disabled (default)
Enable Google image search enhancement
  • true: In addition to text search, will also search for reference images to assist generation, suitable for scenarios requiring visual references
  • false: Disabled (default)
Note: Must be used together with google_search: true

Response

code
integer
Response status code
data
array
Response data array