API Key Authentication
NeoSpeech API uses API key authentication via Bearer tokens. All requests must include a valid API key in the Authorization header.
Getting Your API Key
Sign Up
Create a Pro or Business account at neospeech.io Free accounts cannot generate API keys
Navigate to Settings
Go to Dashboard → API Settings
Generate Key
Click Generate New API Key and copy it immediately API keys are only displayed once. Store it securely.
sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Prefix: sk-
Length: 32 characters
Total: 35 characters
Invalid format will result in 400 Bad Request
Making Authenticated Requests
Include your API key in the Authorization header with the Bearer prefix:
curl -X POST "https://api.neospeech.io/v1/audio/speech" \
-H "Authorization: Bearer sk-your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"input": "Hello", "voice": "lyra", "model": "aurora-4"}'
Security Best Practices
Store Keys Securely
Never hardcode API keys in your source code. Use environment variables:
NEOSPEECH_API_KEY = sk-your-api-key-here
// Good
const apiKey = process . env . NEOSPEECH_API_KEY ;
// Bad - Never do this
const apiKey = 'sk-1234567890abcdef1234567890abcdef123' ;
Keep Keys Private
Never commit API keys to version control
Do not share keys in public forums or repositories
Add .env to your .gitignore file
.env
.env.local
.env.*.local
Rotate Keys Regularly
Regenerate your API keys periodically:
Generate a new key in your dashboard
Update your application configuration
Test the new key
Revoke the old key
Use Different Keys Per Environment
Maintain separate API keys for development, staging, and production:
# Development
NEOSPEECH_API_KEY_DEV = sk-dev-key-here
# Production
NEOSPEECH_API_KEY_PROD = sk-prod-key-here
Authentication Errors
401 Unauthorized
Missing Authorization Header
{
"success" : false ,
"message" : "Authorization header is missing or invalid."
}
Solution: Include the Authorization header with Bearer token
400 Bad Request
Invalid API Key Format
{
"success" : false ,
"message" : "Invalid API key format."
}
Solution: Verify your API key follows the format: sk- + 32 characters
403 Forbidden
Disabled or Invalid API Key
{
"success" : false ,
"message" : "Access denied: API key is disabled or not found."
}
Solution: Check if your API key is active in the dashboard
Free Plan Restriction
{
"success" : false ,
"message" : "Access denied. This API is only available for Pro and Business plans. Please upgrade your plan to access our services."
}
Solution: Upgrade to Pro or Business plan
Plan Requirements
Plan API Access Concurrent Requests Free ❌ N/A Pro ✅ 18 regular / 10 streaming Business ✅ 25 regular / 15 streaming
Only Pro and Business plan users can generate and use API keys
Testing Your Authentication
Verify your API key works correctly:
curl -X GET "https://api.neospeech.io/v1/balance" \
-H "Authorization: Bearer sk-your-api-key-here"
Success Response:
{
"success" : true ,
"data" : {
"balance" : { ... },
"plan" : {
"type" : "Pro" ,
"renewal_type" : "monthly"
}
}
}
Need Help?
Dashboard Manage your API keys