Generate Image (Pro)
curl --request POST \
--url https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A cute cat is eating.",
"imageUrls": [
""
],
"resolution": "2K",
"callBackUrl": "https://example-callback.com",
"aspectRatio": "16:9"
}
'import requests
url = "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro"
payload = {
"prompt": "A cute cat is eating.",
"imageUrls": [""],
"resolution": "2K",
"callBackUrl": "https://example-callback.com",
"aspectRatio": "16:9"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'A cute cat is eating.',
imageUrls: [''],
resolution: '2K',
callBackUrl: 'https://example-callback.com',
aspectRatio: '16:9'
})
};
fetch('https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => 'A cute cat is eating.',
'imageUrls' => [
''
],
'resolution' => '2K',
'callBackUrl' => 'https://example-callback.com',
'aspectRatio' => '16:9'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro"
payload := strings.NewReader("{\n \"prompt\": \"A cute cat is eating.\",\n \"imageUrls\": [\n \"\"\n ],\n \"resolution\": \"2K\",\n \"callBackUrl\": \"https://example-callback.com\",\n \"aspectRatio\": \"16:9\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A cute cat is eating.\",\n \"imageUrls\": [\n \"\"\n ],\n \"resolution\": \"2K\",\n \"callBackUrl\": \"https://example-callback.com\",\n \"aspectRatio\": \"16:9\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"A cute cat is eating.\",\n \"imageUrls\": [\n \"\"\n ],\n \"resolution\": \"2K\",\n \"callBackUrl\": \"https://example-callback.com\",\n \"aspectRatio\": \"16:9\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"taskId": "task_12345678"
}
}NanoBanana API
Generate Image (Pro)
Submit NanoBanana Pro image generation task using the nano-banana-pro model.
POST
/
api
/
v1
/
nanobanana
/
generate-pro
Generate Image (Pro)
curl --request POST \
--url https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A cute cat is eating.",
"imageUrls": [
""
],
"resolution": "2K",
"callBackUrl": "https://example-callback.com",
"aspectRatio": "16:9"
}
'import requests
url = "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro"
payload = {
"prompt": "A cute cat is eating.",
"imageUrls": [""],
"resolution": "2K",
"callBackUrl": "https://example-callback.com",
"aspectRatio": "16:9"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'A cute cat is eating.',
imageUrls: [''],
resolution: '2K',
callBackUrl: 'https://example-callback.com',
aspectRatio: '16:9'
})
};
fetch('https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => 'A cute cat is eating.',
'imageUrls' => [
''
],
'resolution' => '2K',
'callBackUrl' => 'https://example-callback.com',
'aspectRatio' => '16:9'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro"
payload := strings.NewReader("{\n \"prompt\": \"A cute cat is eating.\",\n \"imageUrls\": [\n \"\"\n ],\n \"resolution\": \"2K\",\n \"callBackUrl\": \"https://example-callback.com\",\n \"aspectRatio\": \"16:9\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A cute cat is eating.\",\n \"imageUrls\": [\n \"\"\n ],\n \"resolution\": \"2K\",\n \"callBackUrl\": \"https://example-callback.com\",\n \"aspectRatio\": \"16:9\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"A cute cat is eating.\",\n \"imageUrls\": [\n \"\"\n ],\n \"resolution\": \"2K\",\n \"callBackUrl\": \"https://example-callback.com\",\n \"aspectRatio\": \"16:9\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"taskId": "task_12345678"
}
}Important Notes
- Task ID returned in response is used to query task status via the Get Task Details endpoint
- Callback URL notifications are sent immediately upon task completion
Authorizations
All APIs require authentication via Bearer Token.
Get API Key:
- 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
A text description of the image you want to generate
Example:
"A cute cat is eating."
Input images to transform or use as reference (supports up to 8 images)
Maximum array length:
8Example:
["https://example-image.png"]
Resolution of the generated image
Available options:
1K, 2K, 4K Example:
"2K"
Callback URL to receive task completion notifications (required)
Example:
"https://example-callback.com"
Aspect ratio of the generated image
Available options:
1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, auto Example:
"16:9"