Expected authorization in headers, but none provided. | XM Community
Solved

Expected authorization in headers, but none provided.


Hello
I'm just starting to work with Qualtrics API and am getting these errors using cUrl:
>curl -H "X-API-TOKEN ###" -X GET https://ca1.qualtrics.com/API/v3/whoami 
{"meta":{"httpStatus":"400 - Bad Request","error":{"errorMessage":"Expected authorization in headers, but none provided.","errorCode":"ATP_2"},..
>curl -H "Authorization:bearer ###" "https://ca1.qualtrics.com/API/v3/whoami"
{"meta":{"httpStatus":"403 - Forbidden","error":{"errorMessage":"insufficient_scope","errorCode":"AUTH_13.0"},...
In the second case I gave my client all available scopes!
Any help is greatly appreciated!
Thank you!

icon

Best answer by shlasasha 5 May 2021, 16:07

View original

4 replies

Userlevel 4
Badge +18

This error is because you are not providing the correct X-API-TOKEN in the cUrl. I tried this out in Postman and was able to successfully get user details.

In the first case colon is missing after X-API-TOKEN
>curl -H "X-API-TOKEN: ###"  ...

IN the second case need to include scope when requesting token.
>curl -X POST -d "grant_type=client_credentials&scope=manage:all" ...

https://www.qualtrics.com/community/discussion/comment/37100#Comment_37100that would be too easy :(

Userlevel 4
Badge +18

Are you trying it in this format? The highlighted part should be replaced by your Qualtrics API TOKEN.
image.png

Leave a Reply