Skip to content

How to get GitHub request limit state? #23857

How to get GitHub request limit state? #23857
Sep 23, 2021 · 2 answers

Hi!
In our scripts, we frequently use the following command:
Preformatted text hub api --paginate -XGET orgs/our_name/actions/runners -f per_page=100

We would like to monitor the number of requests we generate, however, we don’t know how to retrieve the information we need. We tested the following queries:

curl -H “Accept: application/vnd.github.v3+json” https://api.github.com/rate_limit
curl -I https://api.github.com/user/repos
curl -I https://api.github.com/user
curl -I https://api.github.com/org

None of them, however, returned results related to the above-mentioned command

Thanks for your help,
Sandra

Ratelimit information is provided in the headers for every API response, no matter which endpoint you use. Check the header fields with names starting with x-ratelimit. Their meanings are described in the docs:

  <a href="https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting" target="_blank" rel="noopener">GitHub Docs</a>

Resources in the REST API - GitHub Docs

Replies

2 suggested answers

Ratelimit information is provided in the headers for every API response, no matter which endpoint you use. Check the header fields with names starting with x-ratelimit. Their meanings are described in the docs:

  <a href="https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting" target="_blank" rel="noopener">GitHub Docs</a>

Resources in the REST API - GitHub Docs

0 replies
Answer selected

Thanks. It worked :slight_smile:

0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants