Can't query Twitter API v2 with elevated acces project/app

Question:

I’m trting to query twitter API v2 with elevated research access via tweepy, but it still gives me a 403 Forbidden.
evelevated acces proof of my app

client = tweepy.Client(
    bearer_token=BEARER_TOKEN,
#    consumer_key=CONSUMER_KEY,
#    consumer_secret=CONSUMER_SECRET,
#    access_token=OAUTH_ACCESS_TOKEN,
#    access_token_secret=OAUTH_ACCESS_TOKEN_SECRET,
    
)

test = client.search_all_tweets(query="#something",
                                start_time = "2023-01-01")
print(test)

Response: Forbidden: 403 Forbidden When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.

I’ve tried all the combinations of the comented lines when created the client, notihg works.
What am I doing wrong?
No problem with normal acces endpoints and bearer_token param. However, can’t nothing when using consumer_key/secret and acces_token(_secret) instead. Maybe this is the real issue?

Thank you in advance.

Asked By: juanmac

||

Answers:

This table shows which account access or not

If you has free account (Essential or Elevated), you can’t use search_all_tweets method. It is equivalent the GET /2/tweets/search/all API.

enter image description here

You can check which account has in your Developer Portal

https://developer.twitter.com/en/portal/products

In the three tabs (Essential, Elevated, and Academic Research),
Checked green item is your account.
enter image description here

But you can use recent 7 days search API by search_recent_tweets() even if free account.

That is equivalent with GET /2/tweets/search/recent

Answered By: Bench Vue
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.