Documentation
GitHub compatibility
Use Octokit and other GitHub REST clients against Upstream by changing the base URL.
Upstream serves a GitHub-compatible REST API at https://api.upstream.codes/api/v3. Responses use GitHub's field names, numeric IDs, node_id values, Link pagination and error format, so most GitHub REST clients work unchanged.
Octokit
import { Octokit } from "@octokit/rest";
const octokit = new Octokit({
baseUrl: "https://api.upstream.codes/api/v3",
auth: process.env.UPSTREAM_TOKEN,
});
const { data: pull } = await octokit.rest.pulls.create({
owner: "acme",
repo: "api",
head: "feature/search",
base: "main",
title: "Add search",
});
octokit.paginate follows the Link header. X-GitHub-Api-Version accepts 2022-11-28 and 2026-03-10.
gh
gh api works against upstream.codes:
GH_ENTERPRISE_TOKEN=$UPSTREAM_TOKEN gh api --hostname upstream.codes repos/acme/api
Most other gh commands, including gh pr, gh issue and gh auth login, use GitHub's GraphQL API, which Upstream doesn't serve yet.
Supported areas
| Area | Paths |
|---|---|
| Repositories | repos/{owner}/{repo}, user/repos, orgs/{org}/repos, forks, transfer |
| Contents | contents/{path}, including raw media types |
| Git data | git/ref, git/matching-refs, git/trees (with recursive=1), git/commits, git/blobs |
| Commits | commits, commits/{ref} (including .diff and .patch), compare/{base}...{head}, branches, tags |
| Pull requests | pulls, files, commits, merge, update-branch, reviews, review comments, requested reviewers |
| Checks | check-runs, commits/{ref}/check-runs, statuses/{sha}, commits/{ref}/status |
| Issues | issues, comments, labels, assignees, reactions, lock |
| Releases | releases, latest, by tag, assets and asset upload |
| Actions | workflows, runs, dispatches, cancel, rerun |
| Account | user, users/{user}, orgs/{org}, members, notifications |
| Search | search/code, search/issues, search/repositories, search/users |
Differences from GitHub
- Issue and pull request numbers are separate. An Issue and a Change Request can both be #4.
issues/{number}endpoints address Issues only. Comment on a pull request throughpulls/{number}/reviewsorpulls/{number}/comments. - No file or ref writes yet. Creating, updating or deleting refs and files through the API isn't available. Push with Git instead.
- Releases need their tag pushed first;
target_commitishdoesn't create a missing tag. Releases can't be deleted. - Pending reviews aren't supported. Submit a review with an
event; inlinecommentsare added before the review. - Comparisons of repositories stored on Upstream return
501for commit history between two revisions. Usecommits?sha=instead. - Commit filters
author,sinceanduntilaren't supported yet. - Search needs one
repo:owner/namequalifier for code and issue search. - GraphQL isn't available.