docs.nanobananaapi.ai
language
language
  • 🇺🇸 English
  • 🇨🇳 Chinese
language
language
  • 🇺🇸 English
  • 🇨🇳 Chinese
Support
NanoBanana API
Common API
NanoBanana API
Common API
  1. NanoBanana API
  • Welcome to NanoBanana API
  • NanoBanana API Quickstart
  • Image Generation or Editing Callbacks
  • Generate Image Callbacks (Nanobanana 2)
  • Generate Image (Pro) Callbacks
  • Generate or Edit Image
    POST
  • Generate Image (Nanobanana 2)
    POST
  • Generate Image (Pro)
    POST
  • Get Task Details
    GET
  1. NanoBanana API

Generate Image (Nanobanana 2)

POST
/api/v1/nanobanana/generate-2
Submit NanoBanana Generate-2 image generation task using the latest NanoBanana model.

Important Notes#

Task ID returned in the response is used to query task status via the Get Task Details endpoint
If callBackUrl is provided, task completion notifications will be sent to that URL via POST request
The prompt field supports up to 20,000 characters; more detailed prompts generally produce better results
When imageUrls is an empty array, the request runs in pure text-to-image mode; when URLs are provided, it runs in image-to-image / reference mode
You can control the aspect ratio, resolution, and output format using aspectRatio, resolution, and outputFormat

Parameter Overview#

prompt: Text prompt (required), up to 20,000 characters
imageUrls: Array of reference image URLs; use an empty array for text-to-image mode, up to 14 images
aspectRatio: Aspect ratio of the generated image. Supported: 1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9, auto
resolution: Output quality level, one of 1K / 2K / 4K
googleSearch: Whether to enable Google Web Search grounding (default: false)
outputFormat: Output format, either png or jpg (default: jpg)
callBackUrl: Optional callback URL to receive async task completion notifications

Request

Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Body Params application/jsonRequired

Examples

Responses

🟢200Success
application/json
Request successful
Bodyapplication/json

Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://api.nanobananaapi.ai/api/v1/nanobanana/generate-2' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "a happy dog running in the park",
    "imageUrls": [],
    "aspectRatio": "auto",
    "resolution": "1K",
    "googleSearch": false,
    "outputFormat": "jpg",
    "callBackUrl": "https://example-callback.com"
}'
Response Response Example
{
    "code": 200,
    "message": "success",
    "data": {
        "taskId": "task_12345678"
    }
}
Modified at 2026-11-11 03:43:02
Previous
Generate or Edit Image
Next
Generate Image (Pro)
Built with