Logo
Logo
API OverviewAuthenticationGenerate Images
API Testing Guide
API Reference

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

  1. Navigate to Settings > API Keys
  2. Click Create Key
  3. Enter a descriptive name for your key (e.g., "Production", "Development")
  4. 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-key

Example 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 CodeErrorDescription
401UnauthorizedMissing or invalid API key
402Payment RequiredInsufficient credits or no active subscription
403ForbiddenAPI 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

API Overview

NB Pro API for programmatic image generation

Generate Images

API endpoint for generating images

Table of Contents

API Keys
Creating an API Key
Using Your API Key
Example Request
API Key Limits
Security Best Practices
Never expose your API key
Use environment variables
Rotate keys regularly
Use separate keys for different environments
Authentication Errors
Example Error Response
Next Steps