POST
/
api
/
v1
/
nanobanana
/
generate
Generate or Edit Image
curl --request POST \
  --url 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",
  "callBackUrl": "https://your-callback-url.com/callback"
}'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task12345"
  }
}

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
  • 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

Authorizations

Authorization
string
header
required

All APIs require authentication via Bearer Token.

Get API Key:

  1. Visit API Key Management Page to get your API Key

Usage: Add to request header: Authorization: Bearer YOUR_API_KEY

Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately in the management page

Body

application/json

Response

200
application/json

Request successful

The response is of type object.