Error 401 Authorization Required, "UNAUTHORIZED_ACCESS"



I followed following steps:
1, I created a Twitter App.
2. Then, I got my App Id, Client ID, Client Secret, Access Toke, Access token secret .
3. Then, I got my App Id whitelisted by twitter.
4. Then, I tried using following Ads Api:
a. “
d. account_Id/recommendations
using my account_Id as Account Id associated with my account.
5. Still I am getting " 401 Authorization Required " with response: {
“errors”: [{
“message”: “This request is not properly authenticated”
“request”: {
“params”: {}

Why this error is coming, whether I am missing something or there is any change in steps to use Api endpoints?
Please help me to get over this error.


Hi @snigdhaJogdand ,

That 401 error most likely means your authorization token is incorrect. Can you try using twurl and see if you still get 401?



I used OAuth 1 mechanism to use Ads API, using client Id, client secret, access token, access token secret and used App ID that is got whitelisted by Twitter.
I am getting 401 error.
Is there any “authentication token” required?
If yes, can you please help me with how and when to use it while using Ads API.
Thank You.


Can you send me any documentation link to understand how to get authentication token and where & how to use Authentication token for Ads API.
Thank you


Hi @snigdhaJogdand ,

Sorry, I meant token in general. I recommend you reading this guide:

There are several steps you need to follow in order to make a valid Authorization HTTP request header (I’m assuming you’re following this with your script/application you wrote). Could you please make sure you’re not missing any pieces there? such as “Building the header string” section on that page (escaping stuff).


REST API return 401 (unauthorized access) error when trying to GET tweet preview

I used OAuth ! Authorization while using Ads Api.
still getting the same error.
please help me out with this.




It’s difficult to debug without knowing your code. Are you using any third-party libraries?



I am calling Ads API using postman.
Authorization Machanism: OAuth 1 with Client Id, Client secret, Access toke, Access token Secret.
API documentation I refered is:

That all what I am doing.
Is any other thing required to access Api for whitelisted account.



@snigdhaJogdand (Sorry I removed my previous answer as I misunderstood what’s the issue)

Anyway, I was able to call API via Postman with basic OAuth1.0 setup. You may want to check your ADVANCED setting area. Default settings worked for me though.

Also, you should select “Request Headers” for Add authorization data to setting:

If it doesn’t help, please double check that you’re using correct key and secret there. Again, but we highly recommend using twurl as it’s our official tool and easy to debug&help questions like this.



Hey! Did you get this figured out?! I am running into the same problem.



Yes, actually I missed to use option, “Add Authorization data to” : “Request Headers” .
Then, preview request and see if the Aauth token is added to your headers.