I’m trying to access the API of TestRail (by gurock) on our self-hosted TestRail server (version v5.1.0.3413). To use TestRail, we have to login with basic authentication plus form-based authentication. The sample call in the API documentation uses curl -u … to handle basic authentication. But this just gives me following error:

{“error”:“Authentication failed: invalid or missing user/password or session cookie.”}

I guess this is because I somehow have to provide the form-based login credentials. Has anybody here handled this scenario of TestRail API access with basic plus form-based authentication before?

Thanks in advance!

1 Answer 1


The following does the trick for me.

# Login
curl -u basicUser:basicPassword -c cookies -d "name=formUser&password=formPassword" -X POST "https://testrailserver/index.php?/auth/login"

# Get test statuses
curl  -u basicUser:basicPassword -b cookies -H "Content-Type: application/json" "https://testrailserver/index.php?/api/v2/get_statuses"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.