Resolving "Not authorized" error when generating temporary tokens for streaming transcription
Last updated: September 30, 2025
If you're receiving a 401 "Not authorized" error when trying to generate temporary tokens for streaming transcription, this is likely because you're using an outdated API endpoint.
The Issue
The error occurs when using the old version of the Streaming Speech-to-Text feature with the /v2/realtime/token endpoint, which is no longer supported.
Solution
You need to use the new Streaming STT feature instead of the legacy version. The old /v2 endpoint has been deprecated.
For the current implementation of streaming transcription and temporary token generation, refer to the Universal Streaming documentation.
Best Practices for API Key Security
When implementing streaming transcription in your application:
Use temporary authentication tokens instead of directly embedding API keys in client-side code
Generate temporary tokens on your server and pass them to your client
Store API keys as environment variables
Use different API keys for development and production environments
Monitor usage patterns in your dashboard
Additional Troubleshooting
If you continue to experience issues after updating to the new streaming API:
Verify your API key matches exactly what's shown in your AssemblyAI dashboard
Check that your account has sufficient balance
Ensure you haven't exceeded rate limits or concurrent session limits
Confirm your account status is active