Authentication
Overview
All API requests require a valid API key in the Authorization header:
Without this header, requests return 401 Unauthorized.
Getting an API key
- Sign in to the Speechify Console
- Navigate to API Keys
- Copy your default key, or create a new one
Set the SPEECHIFY_API_KEY environment variable and our SDKs will authenticate automatically — no need to pass the key in code.
Using API keys
Python
TypeScript
cURL
Security best practices
API keys grant full access to your account, including creating/deleting voices and generating audio at your expense. Treat them like passwords.
Do
- Store keys in environment variables or secret managers
- Use server-side code to make API calls
- Add
.envto your.gitignore - Rotate keys periodically via the Console
Don’t
- Embed keys in client-side code (JavaScript bundles, mobile apps)
- Commit keys to version control, even in private repos
- Share keys over unencrypted channels
Platform-specific secret management
Server-side proxy pattern
If your frontend needs to call the API, set up a server-side proxy instead of exposing the key:
Always authenticate your own users before proxying requests. An open proxy allows anyone to make API calls at your expense.
Key considerations:
- Create specific proxy endpoints (not a wildcard passthrough)
- Validate and sanitize inputs before forwarding
- Add rate limiting to prevent abuse
Error responses
Deprecated: Access Tokens (JWT)
Access Tokens were previously available for client-side authentication via the POST /v1/auth/token endpoint. This method is now deprecated.
All applications should use API keys with a server-side proxy pattern instead. If you’re currently using Access Tokens, migrate to API keys at your earliest convenience.
For reference, the legacy endpoint documentation is available in the API Reference.