How to hit the GitHub API

The GitHub REST API lives at https://api.github.com and returns JSON. Public data — users, repos, issues, releases, search — needs no token, so the first six examples below run as-is. Anything that reads private data or writes needs a personal access token.

Authentication

Create a token at GitHub → Settings → Developer settings → Personal access tokens. A fine-grained token scoped to the repos you need is safest; give it Issues: read and write to try the create-an-issue example.

Send it as Authorization: Bearer <token>. In the examples it's written {{GITHUB_TOKEN}}.

Full reference: https://docs.github.com/en/rest

Get a user

Public profile for any user or organization.

curl https://api.github.com/users/octocat \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28"
Run in PostTaco
Example response (trimmed)
{
  "login": "octocat",
  "id": 583231,
  "name": "The Octocat",
  "company": "@github",
  "blog": "https://github.blog",
  "location": "San Francisco",
  "public_repos": 8,
  "followers": 24208,
  "created_at": "2011-01-25T18:44:36Z"
}

List a user's repositories

Public repos, most recently updated first. per_page goes up to 100; page through with page.

curl "https://api.github.com/users/octocat/repos?sort=updated&per_page=3" \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28"
Run in PostTaco
Example response (trimmed)
[
  {
    "name": "Spoon-Knife",
    "full_name": "octocat/Spoon-Knife",
    "description": "This repo is for demonstration purposes only.",
    "stargazers_count": 14052,
    "language": "HTML",
    "updated_at": "2026-09-23T19:18:19Z"
  },
  {
    "name": "Hello-World",
    "full_name": "octocat/Hello-World",
    "description": "My first repository on GitHub!",
    "stargazers_count": 3822,
    "language": null,
    "updated_at": "2026-09-23T14:08:47Z"
  }
]

Get a repository

Stars, forks, open issues, default branch, last push.

curl https://api.github.com/repos/cli/cli \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28"
Run in PostTaco
Example response (trimmed)
{
  "full_name": "cli/cli",
  "description": "GitHub’s official command line tool",
  "stargazers_count": 46382,
  "forks_count": 9070,
  "open_issues_count": 1092,
  "language": "Go",
  "default_branch": "trunk",
  "pushed_at": "2026-09-23T16:38:30Z"
}

Search repositories

Same query syntax as the search box on github.com — here, Rust HTTP clients by stars.

curl "https://api.github.com/search/repositories?q=http+client+language:rust&sort=stars&per_page=3" \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28"
Run in PostTaco
Example response (trimmed)
{
  "total_count": 1255,
  "items": [
    {
      "full_name": "seanmonstar/reqwest",
      "description": "An easy and powerful Rust HTTP Client",
      "stargazers_count": 11838
    },
    {
      "full_name": "warp-tech/warpgate",
      "description": "Fully transparent SSH, HTTPS, Kubernetes, database and RDP/VNC bastion/PAM that doesn't need additional client-side software",
      "stargazers_count": 7960
    }
  ]
}

List open issues

Issues on a repo. Pull requests come back too — they carry a pull_request field.

curl "https://api.github.com/repos/cli/cli/issues?state=open&per_page=2" \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28"
Run in PostTaco
Example response (trimmed)
[
  {
    "number": 14512,
    "title": "Choose a specific organization-owned fork as the pull request head",
    "state": "open",
    "comments": 1,
    "created_at": "2026-09-23T11:35:10Z",
    "user": {
      "login": "williammartin"
    }
  },
  {
    "number": 14511,
    "title": "Use the tracked organization-owned fork as the pull request head",
    "state": "open",
    "comments": 1,
    "created_at": "2026-09-23T11:35:10Z",
    "user": {
      "login": "williammartin"
    }
  }
]

Get the latest release

Tag, publish date, and downloadable assets with download counts.

curl https://api.github.com/repos/cli/cli/releases/latest \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28"
Run in PostTaco
Example response (trimmed)
{
  "tag_name": "v2.101.0",
  "name": "GitHub CLI 2.101.0",
  "published_at": "2026-09-15T14:24:34Z",
  "html_url": "https://github.com/cli/cli/releases/tag/v2.101.0",
  "assets": [
    {
      "name": "gh_2.101.0_checksums.txt",
      "size": 1971,
      "download_count": 47179
    },
    {
      "name": "gh_2.101.0_linux_386.deb",
      "size": 14379800,
      "download_count": 218
    }
  ]
}

Check your rate limit

Doesn't count against the limit. Add your token to see the 5,000/hour authenticated budget.

curl https://api.github.com/rate_limit \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28"
Run in PostTaco
Example response (trimmed)
{
  "resources": {
    "core": {
      "limit": 60,
      "remaining": 51,
      "reset": 1790195105,
      "used": 9
    }
  }
}

Get the authenticated user

Your own profile — the quickest way to check a token works. Without one you get 401 Requires authentication.

curl https://api.github.com/user \
  -H "Authorization: Bearer {{GITHUB_TOKEN}}" \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28"
Run in PostTaco

Create an issue

Needs a token with Issues write access on the repo.

curl -X POST https://api.github.com/repos/{{OWNER}}/{{REPO}}/issues \
  -H "Authorization: Bearer {{GITHUB_TOKEN}}" \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  -H "Content-Type: application/json" \
  -d '{"title": "Found a bug", "body": "Steps to reproduce…", "labels": ["bug"]}'
Run in PostTaco