Find an API

Search public APIs with auth details & Postman guides

← All APIs

GitHub REST API

GitHub · Company

Company Bearer Token Developer Tools Source Control Repositories

Access GitHub data — repos, users, issues, pull requests, commits, and more. Many endpoints are public; authenticated requests get higher rate limits and private repo access.

Authentication

Bearer Token Pass a Personal Access Token (PAT) in the Authorization header as a Bearer token. Many read endpoints work without auth at 60 req/hour; authenticated requests get 5000 req/hour.

Sample Requests

GET Get a user profile

Returns public profile information for any GitHub user. No auth required.

https://api.github.com/users/octocat

Hover any highlighted part to learn what it does

curl -X GET "https://api.github.com/users/octocat" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
headers = {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.get(
    "https://api.github.com/users/octocat",
    headers=headers,
)
print(response.json())
const url = 'https://api.github.com/users/octocat';

const response = await fetch(url, {
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  },
}); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	targetURL := "https://api.github.com/users/octocat"
	req, _ := http.NewRequest("GET", targetURL, nil)
	req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.github.com/users/octocat")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.github.com/users/octocat";
$opts = ["http" => [
    "method" => "GET",
    "header" => implode("\r\n", [
        "Authorization: Bearer YOUR_ACCESS_TOKEN"
    ]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET List public repos for a user

Returns a list of public repositories for the specified user.

https://api.github.com/users/octocat/repos?sort=updated&per_page=5

Hover any highlighted part to learn what it does

curl -X GET "https://api.github.com/users/octocat/repos?sort=updated&per_page=5" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
params = {
    "sort": "updated",
    "per_page": "5"
}
headers = {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.get(
    "https://api.github.com/users/octocat/repos",
    params=params,
    headers=headers,
)
print(response.json())
const url = new URL('https://api.github.com/users/octocat/repos');
url.searchParams.set('sort', 'updated');
url.searchParams.set('per_page', '5');

const response = await fetch(url, {
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  },
}); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://api.github.com/users/octocat/repos")
	q := baseURL.Query()
	q.Set("sort", "updated")
	q.Set("per_page", "5")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)
	req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.github.com/users/octocat/repos")
uri.query = URI.encode_www_form({
  "sort" => "updated",
  "per_page" => "5"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.github.com/users/octocat/repos?" . http_build_query([
    "sort" => "updated",
    "per_page" => "5"
]);
$opts = ["http" => [
    "method" => "GET",
    "header" => implode("\r\n", [
        "Authorization: Bearer YOUR_ACCESS_TOKEN"
    ]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Get authenticated user

Returns the profile of the authenticated user. Requires a valid PAT.

https://api.github.com/user

Hover any highlighted part to learn what it does

Headers — extra info sent with the request
Accept application/vnd.github+json
Authorization Bearer YOUR_TOKEN
curl -X GET "https://api.github.com/user" \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
headers = {
    "Accept": "application/vnd.github+json",
    "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.get(
    "https://api.github.com/user",
    headers=headers,
)
print(response.json())
const url = 'https://api.github.com/user';

const response = await fetch(url, {
  headers: {
    'Accept': 'application/vnd.github+json',
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  },
}); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	targetURL := "https://api.github.com/user"
	req, _ := http.NewRequest("GET", targetURL, nil)
	req.Header.Set("Accept", "application/vnd.github+json")
	req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api.github.com/user")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)
req["Accept"] = "application/vnd.github+json"
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.github.com/user";
$opts = ["http" => [
    "method" => "GET",
    "header" => implode("\r\n", [
        "Accept: application/vnd.github+json",
        "Authorization: Bearer YOUR_ACCESS_TOKEN"
    ]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Create a new GET request to https://api.github.com/users/octocat
  2. Add a header: Accept = application/vnd.github+json
  3. Send — no auth needed for this public endpoint
  4. For authenticated requests: go to the Authorization tab, select Bearer Token, paste your PAT
  5. Create a PAT at GitHub → Settings → Developer Settings → Personal access tokens → Generate new token
  6. Tip: store the token as a Postman variable {{github_token}} and reference it in the Authorization tab

What can you build with GitHub REST API?

GitHub REST API is a Company API. Developers commonly use company APIs for:

  • enriching CRM records with company firmographics
  • building lead-generation and prospecting tools
  • verifying business identity and registration details
  • monitoring competitors and market intelligence
  • powering B2B data enrichment pipelines

Bearer token. Your app exchanges credentials for a short-lived token, then sends it as an Authorization header. Tokens expire, so your code needs to handle renewal.

New to APIs? Read our beginner's guide · Learn about API keys · What is REST?

Open documentation ↗