Authentication
All API requests must be authenticated with a personal API Key. Keys are prefixed with nb_ and tied to your account's subscription plan.
API Plan Required
API access requires the API / Build plan (€59.99/mo). The Free, Basic and Pro plans do not have programmatic API access.
Getting your API Key
- 1 Sign up or log in at nanobananavideo.com/register.php
- 2 Subscribe to the API / Build plan from your dashboard.
-
3
Navigate to Dashboard → API. Your key (
nb_xxxxxxxx...) is displayed there. - 4 Store it as an environment variable — never hard-code it in client-side code.
Authentication Methods
The API accepts three equivalent ways to pass your key. Bearer header is recommended for server-to-server calls.
Method 1 — Authorization Header (recommended)
RecommendedAuthorization: Bearer nb_YOUR_API_KEY_HERE
Method 2 — X-API-Key Header
X-API-Key: nb_YOUR_API_KEY_HERE
Method 3 — Query Parameter (not recommended for production)
https://nanobananavideo.com/api/v1/text-to-video.php?api_key=nb_YOUR_KEY
Authentication Errors
| HTTP Status | Error Message | Cause |
|---|---|---|
401 |
Missing or invalid Authorization header | No key provided or wrong format |
401 |
Invalid API key format | Key doesn't start with nb_ |
401 |
Invalid API key | Key not found or user inactive |
403 |
API access requires the API plan | Active plan price below €89/mo threshold |
Security Best Practices
Never expose your API key in client-side code
Store it in environment variables (.env) or a secrets manager like AWS Secrets Manager or Vault.
Rotate keys periodically
You can regenerate your API key from the dashboard at any time. Old keys become invalid immediately.
Use HTTPS always
All API endpoints enforce HTTPS. Never make requests over plain HTTP.
Restrict access server-side
Only make API calls from your backend server, never from browser JavaScript or mobile apps directly.
Full Example with Authentication
# Set your key as an environment variable export NB_API_KEY="nb_your_key_here" # Generate a video curl https://nanobananavideo.com/api/v1/text-to-video.php \ -X POST \ -H "Authorization: Bearer $NB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A majestic mountain landscape at sunrise", "resolution": "1080p", "duration": 5, "video_model": "seedance2" }' # Expected response { "success": true, "video_id": "vid_abc123", "video_url": "https://cdn.nanobananavideo.com/videos/vid_abc123.mp4", "credits_used": 7 }