gh-api
authenticated HTTP requests to GitHub REST and GraphQL APIs
TLDR
Make GET request
$ gh api [/repos/owner/repo]
Make POST request$ gh api -X POST [/repos/owner/repo/issues] -f title="[title]"
With JSON body$ gh api [/endpoint] --input [data.json]
Use GraphQL$ gh api graphql -f query='[query]'
Paginate results$ gh api [/endpoint] --paginate
Output specific field$ gh api [/repos/owner/repo] --jq '.[field]'
SYNOPSIS
gh api [options] endpoint
DESCRIPTION
gh api makes authenticated HTTP requests to the GitHub API. Supports both REST and GraphQL APIs with automatic authentication.
PARAMETERS
-X, --method method
HTTP method.-f, --raw-field key=value
Add a string parameter.-F, --field key=value
Add a typed parameter (non-string values, file references with @, booleans, null).--input file
Read body from file.--jq query
Filter JSON output.--paginate
Fetch all pages of results.--slurp
With --paginate, combine all pages into a single JSON array.-i, --include
Include HTTP response headers in the output.-p, --preview name
Opt into a GitHub API preview feature.-H, --header header
Add HTTP header.-t, --template template
Format output with a Go template.--hostname host
Make request against a specific GitHub hostname (for GHES).--cache duration
Cache the response (e.g., 1h, 30m).

