Skip to content

X API v2 usersIdTweets incorrectly enforcing rate limits or I am confused by documentation and developer portal info #96

Open

Description

@mattmazzola

API only allows single request to https://api.twitter.com/2/users/{id}/tweets or await client.tweets.usersIdTweets({ ... })

Expected behavior

The Rate Limits documentation does not explicitly list the GET_2_users_tweets endpoint rate limits.
But other minimums are about 5 requests per 15 minutes so I assume this should be similar

My developer portal page still says:

Monthly Post cap usage: 34% (34 Posts pulled of 100) Resets on January 23 at 00:00 UTC

I expect to be able to make many more requests to the endpoint before hitting the rate limit.

Actual behavior

1st request: succeeds
2nd request: error 429: Too Many Requests

It is as if the rate limit is only 1 request per 24 hrs

Steps to reproduce the behavior

  1. Get V2 API Access Token
  2. Make request to usersIdTweets()

Other information

My token can still make successful requests to xClient.users.findMyUser despite failing for userIdTweets which is expected since findMyUser has higher rate limit, and also means the token is not the issue.

Headers

Notice it says: x-rate-limit-limit: 1❗

      'api-version': '2.119',
      'cache-control': 'no-cache, no-store, max-age=0',
      'content-disposition': 'attachment; filename=json.json',
      'content-encoding': 'gzip',
      'content-length': '94',
      'content-type': 'application/json; charset=utf-8',
      date: 'Sat, 04 Jan 2025 21:36:47 UTC',
      perf: '7402827104',
      server: 'tsa_p',
      'set-cookie': <removed>,
      'strict-transport-security': 'max-age=631138519',
      'x-access-level': 'read',
      'x-connection-hash': 'bdf592f8d92211f53437d5d021b9298f69c395a766071932deb4abd4f89245ce',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'SAMEORIGIN',
      'x-rate-limit-limit': '1',
      'x-rate-limit-remaining': '0',
      'x-rate-limit-reset': '1736026949',
      'x-response-time': '16',
      'x-transaction-id': 'ccf6815b6803a7a3',
      'x-xss-protection': '0'

Questions

  • Where is rate limit documentation for users id tweets endpoint?
  • Can someone else confirm if this issue exists for them?

Activity

  1. changed the title [-]X API v2 incorrectly enforcing rate limits or I am confused by documentation and developer portal[/-] [+]X API v2 usersIdTweets incorrectly enforcing rate limits or I am confused by documentation and developer portal info[/+] on Jan 4, 2025
  2. mattmazzola commented on Jan 4, 2025

    @mattmazzola
    Author

    After playing more with x-rate-limit-reset: 1736026949 header value which is time in "seconds" (not the native milliseconds)

    Sample code

    milliseconds_per_sec = 1000
    seconds_per_minute = 60
    
    xResetTimeSec = 1736028941
    xResetTimeMs = xResetTime * milliseconds_per_sec
    
    timeRemainingUntilRateLimitResetMs = new Date(xResetTimeMs) - Date.now()
    timeRemainingUntilRateLimitResetMinutes = timeRemainingUntilRateLimitResetMs / milliseconds_per_sec / seconds_per_minute
    // 5.70975

    The rate limit does appear to be 1 request per 15 minutes...

    Given this is likely a very common endpoint it is understandable that it has lower limit, but is this limit correct?
    If so, I think it should be made much clearer in the documentation.

  3. mattmazzola commented on Jan 4, 2025

    @mattmazzola
    Author

    I finally found the documentation in the Developer Portal. 1 Request per 15 minutes is confirmed.

    image

    The confusion was the that /users/:id/tweets endpoint is not listed under the Users endpoints section, but under the Tweets section and I missed it. Also, the link to API documentation takes you to generic /2/tweets endpoint which has different rate limits and causes a type circular loop navigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions