Skip to main content

Full API Keys Documentation

Need more details? View the complete API Keys guide with security best practices and advanced features.

What You’ll Learn

Create Your First Key

Generate an API key in under 2 minutes

Authenticate Requests

Make your first authenticated API call

Test & Verify

Verify your API key is working correctly

Best Practices

Learn essential security practices

Step 1: Create Your API Key

Using the Dashboard

  1. Log in to your NeuroAI account
  2. Navigate to SettingsUsers and TeamsAPI Keys
  3. Click Create API Key
  4. Fill in the details:
    Name: My First API Key
    Description: Testing API integration
    Role: Developer
    Expiration: (optional) 90 days
    
  5. Click Create
⚠️ Important: Copy your API key immediately and store it securely—you won’t be able to see it again!
Your API key will look something like this:
neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz

Step 2: Store Your API Key Securely

Never commit API keys to version control or hardcode them in your application source code.
Create a .env file in your project directory:
# .env
NEUROAI_API_KEY=neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz
NEUROAI_API_BASE=https://api.neuroai.com/v1
Add .env to your .gitignore:
# .gitignore
.env
.env.local
*.env

Step 3: Make Your First API Call

Using cURL

Test your API key with a simple request:
curl "https://api.neuroai.com/v1/agents" \
  -H "Authorization: Bearer neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz"
Or using environment variables:
# Set your API key
export NEUROAI_API_KEY="neuro_sk_1234567890abcdefghijklmnopqrstuvwxyz"

# Make the request
curl "https://api.neuroai.com/v1/agents" \
  -H "Authorization: Bearer $NEUROAI_API_KEY"

Step 4: Verify Your API Key

Test that your API key is valid and check its permissions:
curl "https://api.neuroai.com/v1/auth/verify" \
  -H "Authorization: Bearer $NEUROAI_API_KEY"
Expected response:
{
  "valid": true,
  "key_id": "key_abc123",
  "name": "My First API Key",
  "role": "developer",
  "permissions": ["agents:read", "agents:create", "workflows:execute"],
  "expires_at": "2026-04-12T10:00:00Z"
}
✅ If you see "valid": true, your API key is working correctly!

Common API Operations

Now that your API key is set up, try these common operations:

List Agents

GET /v1/agents
View all available AI agents

Create Task

POST /v1/tasks
Create a new AI task

Upload File

POST /v1/files
Upload files for processing

Get Task Status

GET /v1/tasks/{task_id}
Check task completion status

Example: Create a Task

curl -X POST "https://api.neuroai.com/v1/tasks" \
  -H "Authorization: Bearer $NEUROAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instruction": "Analyze this quarterly report and summarize key findings",
    "agent_type": "analyst",
    "attachments": ["file_id_123"]
  }'

Security Best Practices

Environment Variables

Store keys in .env files, never in source code

Separate Keys

Use different keys for dev, staging, and production

Rotate Regularly

Change your API keys every 90 days

Monitor Usage

Track API key activity for suspicious patterns

Quick Security Checklist

  • ✅ Store API keys in environment variables
  • ✅ Add .env to .gitignore
  • ✅ Use separate keys per environment
  • ✅ Set expiration dates for keys
  • ✅ Use minimum required permissions
  • ❌ Never commit keys to version control
  • ❌ Don’t share keys via email or chat
  • ❌ Avoid logging API keys

Troubleshooting

Problem: Your request is being rejected with a 401 error.Solutions:
  • Verify your API key is correct (no extra spaces or characters)
  • Check the Authorization header format: Bearer YOUR_API_KEY
  • Ensure the API key hasn’t been revoked or expired
  • Confirm you’re using the correct API base URL
Test your key:
curl "https://api.neuroai.com/v1/auth/verify" \
  -H "Authorization: Bearer $NEUROAI_API_KEY"
Problem: Your API key doesn’t have permission for this operation.Solutions:
  • Check your API key’s role and permissions
  • Use a key with higher privileges (e.g., Administrator)
  • Create a new key with the required permissions
Check permissions:
curl "https://api.neuroai.com/v1/api-keys/CURRENT_KEY_ID" \
  -H "Authorization: Bearer $NEUROAI_API_KEY"
Problem: You lost or forgot your API key.Solutions:
  • API keys cannot be retrieved after creation
  • Create a new API key from the dashboard
  • Revoke the old key if you’re concerned about security
  • Update your applications with the new key
Problem: Your code can’t read the API key from .env.Solutions for Python:
pip install python-dotenv
from dotenv import load_dotenv
load_dotenv()  # Add this at the top of your script
Solutions for Node.js:
npm install dotenv
require('dotenv').config();  // Add this at the top
Verify the file exists:
ls -la | grep .env
cat .env  # Make sure API key is there

Next Steps

Quick Reference

Bearer Token (Recommended):
Authorization: Bearer neuro_sk_your_key_here
X-API-Key Header:
X-API-Key: neuro_sk_your_key_here
Query Parameter (Not recommended for production):
?api_key=neuro_sk_your_key_here
Create .env file:
NEUROAI_API_KEY=neuro_sk_your_key_here
NEUROAI_API_BASE=https://api.neuroai.com/v1
Load in Python:
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv('NEUROAI_API_KEY')
Load in Node.js:
require('dotenv').config();
const apiKey = process.env.NEUROAI_API_KEY;
  • Verify Key: GET /v1/auth/verify
  • List Agents: GET /v1/agents
  • Create Task: POST /v1/tasks
  • Get Task: GET /v1/tasks/{task_id}
  • Upload File: POST /v1/files
  • List API Keys: GET /v1/api-keys
Create Key:
POST /v1/api-keys
List Keys:
GET /v1/api-keys
Rotate Key:
POST /v1/api-keys/{key_id}/rotate
Delete Key:
DELETE /v1/api-keys/{key_id}

Get Help

Documentation

Browse comprehensive guides and tutorials

API Status

Check real-time API availability

Support

Contact our support team

Community

Join the developer community