Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Random 401 error when using the REST API (Authentication failed: invalid or missing user/password or session cookie)



Since version 5.4, we have been getting random 401 errors when trying to access the API using either user/password or an API key.
When this happens, since our scripts keep trying to connect to our Testrail instance, the account gets locked out and then we have to wait some time before attempting the connection again.

The strange part is, this seems to be random. At one moment it is working, at the next it starts responding with 401 errors, then the account gets locked, then it usually works again and the cycle repeats.

On the admin backend, we have confirmed that the API is enabled to be used.

Is there any reason why this could have started happening after the update to v5.4.0.3659?



Hi Felipe,

Thanks for your post! There wouldn’t be any change to the authentication process or the API in the latest version of TestRail. So this could just be an actual authentication issue, or an issue with the script in general. Can you send an email to so we can gather more details? We’re happy to help troubleshoot, and look forward to your email!