How to fix 401001 issues with MSTranslator API Errors
Facing issues with MSTranslator, getting a 401001 exception after sometime that is before expiring char tokens of 33k per min for resource new-initatives-translator-1
Azure AI Translator
-
Ravada Shivaprasad • 1,965 Reputation points • Microsoft External Staff • Moderator
2025-08-25T14:56:47.1866667+00:00 This issue is known to occur intermittently and is often linked to token propagation delays or inconsistencies across Translator API endpoints. Developers have reported that the first request after generating a token sometimes fails with a 401001 error, while subsequent retries succeed. This behavior is not necessarily tied to token expiration or rate limits, but rather to how quickly the token becomes usable across all regional endpoints.
To mitigate this, Microsoft recommends several best practices. First, reuse the same token for its full validity period (typically 10 minutes) instead of generating a new one for each request. Second, introduce a short delay—around 2 to 3 seconds—after acquiring the token before making the first API call. Third, implement retry logic with exponential backoff for requests that fail with a 401 error. Additionally, ensure that all required headers are included in your requests, such as
Authorization,Ocp-Apim-Subscription-Key, andOcp-Apim-Subscription-Regionif you're using a regional endpoint.If you're using a lower-tier pricing plan like F0, you might also be hitting transactions-per-second (TPS) limits, even if you're within the character quota. Upgrading to a higher tier like S1 can help alleviate this. Lastly, if you're operating in a restricted network environment, make sure your firewall and endpoint configurations align with Microsoft’s Translator firewall guidance.
Hope it helps!
Thank you
-
Sina Salam • 25,761 Reputation points • Volunteer Moderator
2025-08-25T18:12:46.1233333+00:00 Hello Sunjyot Singh Anand,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to fix 401001 issues with MSTranslator API Errors.
The first thing to confirm is that your Translator resource is called with the correct endpoint/region combination. Regional resources require either an API key with the
Ocp-Apim-Subscription-Regionheader or a token issued from the region-specific STS endpoint. You can validate this quickly by running a test call with your key:curl -s -X POST "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es" \ -H "Ocp-Apim-Subscription-Key: <YOUR_KEY>" \ -H "Ocp-Apim-Subscription-Region: <YOUR_REGION>" \ -H "Content-Type: application/json" \ -d "[{ \"Text\": \"Hello world\" }]"For more details - https://free.blessedness.top/en-us/azure/ai-services/translator/text-translation/reference/v3/reference
If you are using token-based authentication, Microsoft recommends caching and reusing a token for up to 10 minutes instead of requesting one per call. A common approach is to refresh the token around the 9-minute mark and share it across all running instances. This avoids race conditions and intermittent 401s. For example, you can request a token from
https://<region>.api.cognitive.microsoft.com/sts/v1.0/issueTokenusing your subscription key as it been discussed here - https://free.blessedness.top/en-us/azure/ai-services/authentication . If you prefer, you can bypass token management entirely and authenticate directly with your API key, which is simpler for most applications as long as the key is stored securely.Beyond authentication, it is important to handle transient errors with retry logic. For 401 errors on a new token, retry once with a short delay; for expired tokens, refresh and retry; and for 429 or 5xx responses, use exponential backoff with jitter - https://free.blessedness.top/en-us/azure/architecture/best-practices/transient-faults Also confirm that your usage is not exceeding the free tier quota of ~33,300 characters per minute in a sliding window here - https://free.blessedness.top/en-us/azure/ai-services/translator/service-limits If you are hitting this ceiling, upgrading to a paid tier such as S1 is recommended.
Finally, if errors continue after these adjustments, enable diagnostic logging on your Translator resource and capture failure details such as
X-RequestId,X-ClientTraceId, and timestamps. This data is essential if you need to open a Microsoft support case, as it allows the engineering team to trace and investigate your failed calls - https://free.blessedness.top/en-us/azure/ai-services/diagnostic-loggingI hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.
-
Sunjyot Singh Anand • 0 Reputation points
2025-08-26T08:58:34.0166667+00:00 So does the server respond with 401x error code when "usage is exceeding the free tier quota of ~33,300 characters per minute in a sliding window" ?
-
Sina Salam • 25,761 Reputation points • Volunteer Moderator
2025-08-26T12:55:44.7666667+00:00 Thank you for asking.
No, the server does not return a 401 error when you exceed the free-tier quota (like exceeding 33,300 characters per minute). Instead, you would typically receive a 429 error indicating that your usage or rate limit has been exceeded.
The advice is to check your API key, subscription, and endpoint, not your usage quota exactly.
- Double-check that the API key or subscription key is correct.
- Confirm that the key is active and linked to the right Azure resource.
- Ensure the correct region/endpoint is being used.
Success
-
Sunjyot Singh Anand • 0 Reputation points
2025-08-27T09:35:25.9233333+00:00 can you please verify that we get 429? I have seen once the 2 million chars are consumed per app/region then the api starts giving 401001 errors
-
Ravada Shivaprasad • 1,965 Reputation points • Microsoft External Staff • Moderator
2025-08-29T00:42:34.9466667+00:00 When you exceed the per-minute or per-second quota for Azure Cognitive Services or OpenAI, the API should return 429 (Too Many Requests), which indicates throttling. This is the expected behavior and can be resolved by implementing retry logic with exponential backoff and honoring the
Retry-Afterheader.The 401001 error, however, is not related to throttling; it typically signals an authentication or authorization issue, such as an invalid or expired key, disabled resource, or hitting a hard subscription-level cap (e.g., monthly limit). If you see 401001 after consuming around 2 million characters, it likely means your subscription key was invalidated or the resource reached a hard quota, not a rate-limit scenario.
Hope it helps!
Thank you
-
Ravada Shivaprasad • 1,965 Reputation points • Microsoft External Staff • Moderator
2025-09-02T02:13:42.0566667+00:00 -
Ravada Shivaprasad • 1,965 Reputation points • Microsoft External Staff • Moderator
2025-09-10T22:50:56.8533333+00:00 Just following up to see if you had a chance to review the above response.
Thank you
Sign in to comment