17

When I try to query recent search endpoint of twitter /2/tweets/search/recent it throws an exception

{
    "client_id": "xxxxx",
    "required_enrollment": "Standard Basic",
    "detail": "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.",
    "registration_url": "https://developer.twitter.com/en/portal/opt-in",
    "title": "Client Forbidden",
    "reason": "client-not-enrolled",
    "type": "https://api.twitter.com/2/problems/client-forbidden"
}

Additional informations

Authorization Oauth 1.0

Signature Method HMAC-SHA1

Also provide consumer key,secret,access token,token secret

why this happen? i don't get any useful information when i search with this error 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. Please help..

  • In the developer portal, do you have a Project and an App set up? Or only Standalone Apps? This should show up on this page https://developer.twitter.com/en/portal/projects-and-apps after you have use the portal opt-in URL from the error message. – Andy Piper Jan 06 '21 at 13:58
  • 1
    I have a project and app already setup –  Jan 06 '21 at 14:30
  • @AndyPiper under the projects section I can see a project app where my app is listed –  Jan 06 '21 at 14:58
  • https://developer.twitter.com/en/portal/opt-in redirect me to the dashboard –  Jan 06 '21 at 15:00
  • How are you accessing the endpoint, is this from Postman, or from code? It sounds like you may be trying to use user authentication, have you tried using the Bearer Token for your app in your project? – Andy Piper Jan 06 '21 at 15:15
  • Using postman,providing oauth authentication, I am not sure where can I get the bearer token –  Jan 06 '21 at 15:24
  • **Additional info**,when i try this end point https://api.twitter.com/2/tweets/search/recent?query=conversation_id:1346972806005858309 it returns Unauthorized if i search for https://api.twitter.com/2/tweets/search/recent?query=cristiano i got the above client-not-enrolled error –  Jan 07 '21 at 05:32
  • @soju Hi, have you solved it? I'm getting the same message ""reason": "client-not-enrolled"" – whitesiroi Jun 21 '21 at 02:17
  • @whitesiroi Hi,this is definetly twitter app related issue,my client gives me new app credentials and it works fine.sorry if that don't helps –  Jun 21 '21 at 05:27
  • @soju thank you for your reply, I found that I was able to apply for v2 labs here on the top of this page https://developer.twitter.com/en/account/labs & now it works. Good to hear that your stuff works too. – whitesiroi Jun 21 '21 at 05:37

4 Answers4

10

Just create a project to the standalone app in the Twitter Developer Portal. And also ensure you have v2 Access tag under Projects and Apps => overview in front of your project name.

enter image description here

Tatsuya Fujisaki
  • 1,434
  • 15
  • 18
Adam Smaka
  • 5,977
  • 3
  • 50
  • 55
  • 2
    I'm getting same error, although my app is under project. My app is been for 4 years. I wanted to migrate to V2 endpoints. I was able to perform V2 GET requests with bearer token. As few V2 endpoints still use consumer keys and oauth tokens (oauth 1.0 a), they are getting failed. URL: https://api.twitter.com/2/users/1391xxxxxxxxxxx30/following with post body as json {"target_user_id":"11348282"} Please let me know solution – Sudheer m Aug 16 '21 at 13:54
  • 2
    I was using a bearer token from standalone app hence the issue, Creating a new project and adding the standalone app in it fixed the issue. Also, ensure that under Project=>Overview your project has `v2 Access` tag – Mahesh Jamdade Jun 24 '22 at 05:30
  • 2
    How do you apply for v2 if you don't have the access tag? – Martin Erlic Apr 17 '23 at 22:47
  • 4
    I deleted all the old apps, created a new project, and then created a new app within the project. I still do not see a v2 access tag in the application. Is there something I am missing here? – Gaurav Pandey Apr 27 '23 at 11:46
4

Twitter API v2 doesn't support search API on Free plan

Only APIs available with free plans are

Manage Tweets:

  1. POST /2/tweets
  2. DELETE /2/tweets/:id

User Lookups:

  1. GET /2/users/me

Check here for more details regarding pricing and features.

Anjan Talatam
  • 2,212
  • 1
  • 12
  • 26
3

Due to Twitter API changes, you can only post up to 1500 tweets with a free tier. To retrieve tweets you need to upgrade the package. enter image description here

1

/2/tweets/search/recent is not available in the free plan. See V2 endpoints available on the free plan here: https://developer.twitter.com/en/portal/products/free fk

Santiago
  • 448
  • 3
  • 12