Skip to main content

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

1

Sign Up

Create a Pro or Business account at neospeech.io
Free accounts cannot generate API keys
2

Navigate to Settings

Go to DashboardAPI Settings
3

Generate Key

Click Generate New API Key and copy it immediately
API keys are only displayed once. Store it securely.

API Key Format

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:
.env
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
.gitignore
.env
.env.local
.env.*.local

Rotate Keys Regularly

Regenerate your API keys periodically:
  1. Generate a new key in your dashboard
  2. Update your application configuration
  3. Test the new key
  4. 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

PlanAPI AccessConcurrent Requests
FreeN/A
Pro18 regular / 10 streaming
Business25 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

Support

Contact our team