Authentication
How to authenticate with the NB Pro API
API Keys
All API requests require authentication using an API key. You can create and manage your API keys in the Settings > API Keys page.
Subscription Required
API access is only available for users with an active subscription (Standard or Pro plan).
Creating an API Key
- Navigate to Settings > API Keys
- Click Create Key
- Enter a descriptive name for your key (e.g., "Production", "Development")
- Copy and securely store your API key
Important
Your API key will only be shown once when created. Store it securely - you won't be able to see it again.
Using Your API Key
Include your API key in the Authorization header of every request:
Authorization: Bearer sk-your-api-keyExample Request
curl -X POST https://nano-banana-pro.net/api/ai/nano-banana/generate \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"prompt": "a cute cat"}'const response = await fetch('https://nano-banana-pro.net/api/ai/nano-banana/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-your-api-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({ prompt: 'a cute cat' }),
});import requests
response = requests.post(
'https://nano-banana-pro.net/api/ai/nano-banana/generate',
headers={
'Authorization': 'Bearer sk-your-api-key',
'Content-Type': 'application/json',
},
json={'prompt': 'a cute cat'}
)API Key Limits
- Maximum 5 API keys per user
- Keys do not expire automatically
- You can delete keys at any time from the settings page
Security Best Practices
Never expose your API key
Do not include your API key in client-side code, public repositories, or anywhere it could be accessed by others.
Use environment variables
Store your API key in environment variables rather than hardcoding it:
# .env file
NB_PRO_API_KEY=sk-your-api-key// Usage
const apiKey = process.env.NB_PRO_API_KEY;Rotate keys regularly
If you suspect your key has been compromised, delete it immediately and create a new one.
Use separate keys for different environments
Create separate API keys for development, staging, and production environments.
Authentication Errors
| Status Code | Error | Description |
|---|---|---|
401 | Unauthorized | Missing or invalid API key |
402 | Payment Required | Insufficient credits or no active subscription |
403 | Forbidden | API key does not have permission for this action |
Example Error Response
{
"error": "Unauthorized"
}Next Steps
Generate Images
Learn how to use the image generation API endpoint
