- REST endpoints often return many fields you don’t need, increasing payload size and client-side filtering.
- GraphQL lets you request exact fields and nested relationships in a single query, lowering bandwidth and the number of requests.
- GraphQL exposes a
rateLimitobject so you can monitor query cost and remaining quota.
GraphQL gives you fine-grained control over the fields returned and supports nested queries, which reduces payload size and fewer HTTP requests compared to REST.
- REST (list members):
- GraphQL (only request
nameandavatarUrlfor the first 100 members):
https://api.github.com/graphql with your GraphQL query in the JSON request body. You can pass variables and include rateLimit in the query to inspect cost and remaining quota.
Request example (headers):
rateLimit and one commit from the default branch:
rateLimit.limit— total points available to your token.rateLimit.cost— cost charged for the query you ran.rateLimit.remaining— points left after the query.rateLimit.resetAt— UTC timestamp when your limit refreshes.
Notes:
- Simple queries frequently cost 1 point; complex nested queries often cost more.
- Monitor
rateLimitto avoid unexpectedly exhausting your quota.

Never commit personal access tokens or credentials to source control. For automation, use GitHub Actions secrets, environment variables, or a secrets manager and scope tokens with the least privilege required.
- Request only the fields you need to minimize query cost and improve response times.
- Use pagination (
first,after) on list fields to control result size. - Include
rateLimitin diagnostic queries to track your cost and remaining quota. - Cache stable data where appropriate to avoid repeated expensive queries.
- For very large reports, consider batching queries with variables or server-side caching rather than one huge nested request.