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

AreaPaths
Repositoriesrepos/{owner}/{repo}, user/repos, orgs/{org}/repos, forks, transfer
Contentscontents/{path}, including raw media types
Git datagit/ref, git/matching-refs, git/trees (with recursive=1), git/commits, git/blobs
Commitscommits, commits/{ref} (including .diff and .patch), compare/{base}...{head}, branches, tags
Pull requestspulls, files, commits, merge, update-branch, reviews, review comments, requested reviewers
Checkscheck-runs, commits/{ref}/check-runs, statuses/{sha}, commits/{ref}/status
Issuesissues, comments, labels, assignees, reactions, lock
Releasesreleases, latest, by tag, assets and asset upload
Actionsworkflows, runs, dispatches, cancel, rerun
Accountuser, users/{user}, orgs/{org}, members, notifications
Searchsearch/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 through pulls/{number}/reviews or pulls/{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_commitish doesn't create a missing tag. Releases can't be deleted.
  • Pending reviews aren't supported. Submit a review with an event; inline comments are added before the review.
  • Comparisons of repositories stored on Upstream return 501 for commit history between two revisions. Use commits?sha= instead.
  • Commit filters author, since and until aren't supported yet.
  • Search needs one repo:owner/name qualifier for code and issue search.
  • GraphQL isn't available.