API rate limit exceeded even x-ratelimit-remaining is not 0


first i’m running : curl -I https://api.github.com/users/username

and the below is the response :

HTTP/2 200 
server: GitHub.com
date: Wed, 28 Apr 2021 07:23:05 GMT
content-type: application/json; charset=utf-8
cache-control: public, max-age=60, s-maxage=60
vary: Accept, Accept-Encoding, Accept, X-Requested-With
etag: W/"0e616a155b360e6caf1a5c08aeddb9d0ad013f4ca7467b676ae2bbb050ecccba"
last-modified: Sat, 17 Apr 2021 10:53:46 GMT
x-github-media-type: github.v3; format=json
access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
access-control-allow-origin: *
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'
x-ratelimit-limit: 60
x-ratelimit-remaining: 57
x-ratelimit-reset: 1619598096
x-ratelimit-used: 3
accept-ranges: bytes
content-length: 1622
x-github-request-id: 8BF4:5E38:91C6C:A13CF:60890D59

as i still have 57 limit remaining, next i’m running

curl -u "username" https://api.github.com

but it gives following response :

  "message": "API rate limit exceeded for xx.xx.xxx.x. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
  "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"

can anyone help me please how do i resolve this?


Hey there @Kaushal-Chapaneri :wave:

When you say you’re running:

curl -u "username" https://api.github.com

…are you including your token, or are you only including your username?

Typically, an authenticated REST call (as that message suggests) will have a higher rate limit, but it does require that you are authenticating with a Personal Access Token. The syntax for the REST API is found here.

So you would want to do curl -u username:token in your call.

Give that a try and let us know if you continue to run into rate limit issues.

Thanks! :bow: