Authentication
NeuraAI uses API keys to authenticate requests. All API requests must include a valid API key in the authorization header.
Getting Your API Key
- Sign up for a NeuraAI account at neura-ai.app
- Navigate to your dashboard
- Go to the API Keys section
- Click “Create New API Key”
- Copy and securely store your API key
Keep your API key secure! Never share it publicly or commit it to version control. Treat it like a password.
Authentication Method
NeuraAI uses Bearer token authentication. Include your API key in the Authorization header of every request:
Using Authentication
Python (OpenAI SDK)
The recommended way to authenticate is using environment variables:
Alternatively, you can pass the API key directly:
cURL
JavaScript/Node.js
Python (Requests)
If you prefer using the requests library directly:
Setting Environment Variables
Linux/macOS
Add to your .bashrc, .zshrc, or .bash_profile:
Or set temporarily in your current session:
Windows (PowerShell)
Windows (Command Prompt)
Using .env Files
For local development, use a .env file:
Then load it in your application:
Install python-dotenv:
Managing API Keys
Creating Multiple Keys
You can create multiple API keys for different applications or environments:
- Development - For testing and development
- Staging - For pre-production testing
- Production - For live applications
This allows you to:
- Rotate keys without downtime
- Track usage per application
- Revoke compromised keys without affecting others
Rotating Keys
Best practice is to rotate API keys periodically:
- Create a new API key
- Update your application to use the new key
- Test that the new key works
- Delete the old key
Revoking Keys
If you suspect a key has been compromised:
- Go to your dashboard
- Navigate to API Keys
- Click “Revoke” on the compromised key
- Create a new key immediately
- Update your applications
Error Responses
Invalid API Key
HTTP Status: 401 Unauthorized
Missing API Key
HTTP Status: 401 Unauthorized
Expired API Key
HTTP Status: 401 Unauthorized
Security Best Practices
DO:
- ✅ Store API keys in environment variables
- ✅ Use different keys for different environments
- ✅ Rotate keys regularly (every 90 days recommended)
- ✅ Revoke unused or old keys
- ✅ Monitor API usage for unusual activity
- ✅ Use
.gitignoreto exclude.envfiles from version control - ✅ Limit key permissions when possible
DON’T:
- ❌ Hardcode API keys in your source code
- ❌ Commit API keys to version control (Git, SVN, etc.)
- ❌ Share API keys via email or messaging apps
- ❌ Use the same key across multiple applications
- ❌ Expose keys in client-side code (JavaScript, mobile apps)
- ❌ Log API keys in application logs
- ❌ Store keys in publicly accessible locations
Rate Limiting
API keys are subject to rate limits based on your subscription tier. See the Pricing page for details.
If you exceed your rate limit, you’ll receive:
HTTP Status: 429 Too Many Requests
Testing Your Authentication
Quick test to verify your API key works:
Need Help?
If you’re having authentication issues:
- Verify your API key is correct (copy-paste to avoid typos)
- Check that the key hasn’t been revoked
- Ensure you’re using the correct base URL:
https://api.neura-ai.app/v1 - Verify the Authorization header format:
Bearer YOUR_KEY - Contact support if issues persist