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 or Edit Image

POST
/api/v1/nanobanana/generate
Submit Nanobanana image generation or editing task using the NanoBanana AI model.

Usage Modes#

1.
Text-to-Image Generation
Provide prompt and set type to "TEXTTOIAMGE"
Model will generate a new image based on the text description
2.
Image-to-Image Editing
Provide prompt, imageUrls and set type to "IMAGETOIAMGE"
Model will edit the input images according to the prompt

Important Notes#

You can generate 1-4 images per request using the numImages parameter
Use the image_size parameter to specify the desired aspect ratio for your images
Callback URL (callBackUrl) is required for receiving task completion notifications
Task completion will be sent to your callback URL via POST request
Use the Get Task Details endpoint to poll task status if needed
Choose the appropriate generation type based on your needs:
TEXTTOIAMGE: Text to Image generation
IMAGETOIAMGE: Image editing with input images

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

🟠400Bad Request
🟠401Unauthorized
🔴500Server Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://api.nanobananaapi.ai/api/v1/nanobanana/generate' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "A serene mountain landscape at sunset with a lake reflecting the orange sky",
    "numImages": 1,
    "type": "TEXTTOIAMGE",
    "image_size": "16:9",
    "callBackUrl": "https://your-callback-url.com/callback"
}'
Response Response Example
200 - Success Example
{
    "code": 200,
    "msg": "success",
    "data": {
        "taskId": "task12345"
    }
}
Modified at 2026-11-11 03:43:02
Previous
Generate Image (Pro) Callbacks
Next
Generate Image (Nanobanana 2)
Built with