GitHub compatibility
Use gh, Octokit and other GitHub clients against Upstream by changing the host.
The Upstream API is in alpha. Endpoints, fields and limits can change before it's stable. Send feedback to support@coline.app.
Upstream answers like a GitHub Enterprise server. The REST API is at https://api.upstream.codes/api/v3 and GraphQL at https://api.upstream.codes/api/graphql; both also answer on upstream.codes itself. Responses use GitHub's field names, numeric IDs, node_id values, Link pagination and error format, so most GitHub clients work unchanged.
Use gh with Upstream
Create a token in Settings, API tokens with repository, issue and change request access, and Read organization membership, which gh auth login checks for. Then:
gh auth login --hostname upstream.codes --with-token < token.txt
gh pr list -R acme/api
To make Upstream the default host in a shell, set GH_HOST=upstream.codes. Inside a clone whose remote is on upstream.codes, gh finds the repository by itself.
These work: gh pr list, view, status, checks, diff, create, comment, review, ready, merge (with --auto), close, reopen, edit and update-branch (merge or --rebase); gh issue list, view, status, create, comment, close (with a reason), reopen, edit, lock and unlock; gh repo view, list and create; gh release list and view; and gh api, for REST and GraphQL.
Not yet: gh pr ready --undo, gh issue delete, gh issue transfer and gh issue pin. Each says so when you run it.
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.
GraphQL
POST /api/graphql answers the part of GitHub's GraphQL API that gh and common clients use: repositories, pull requests with their reviews, review threads, files, commits and checks, issues and comments, labels, releases, search for issues and pull requests in one repository, node and nodes, and the mutations behind the commands above, plus createRef, updateRef, deleteRef and createCommitOnBranch (make a branch, then commit to it with no Git client), resolveReviewThread, markAsDuplicate, updateSubscription and reactions. Renovate's queries work too: a file's text with object(expression: "main:path"), tags newest first with their dates, releases, and branchProtectionRules from the default branch's rules. Upstream has no merge queue and no vulnerability alerts, so those answer empty. IDs are the same as the REST API's node_id.
A field or mutation Upstream doesn't have yet fails like an unknown field on GitHub, with a message that names it. Queries can be up to 16 levels deep. Each query counts against your rate limit as the REST calls it makes, at least one.
Supported areas
| Area | Paths |
|---|---|
| Repositories | repos/{owner}/{repo}, user/repos, orgs/{org}/repos, forks, transfer |
| Contents | contents/{path}, including raw media types, and creating, updating and deleting files |
| Git data | git/ref, git/refs, git/matching-refs, git/trees (with recursive=1), git/commits, git/blobs, git/tags |
| Commits | commits, commits/{ref} (including .diff and .patch), compare/{base}...{head}, branches, tags |
| Pull requests | pulls, files, commits, merge, update-branch, reviews (including pending reviews and reviews/{id}/events), review comments and replies, requested reviewers |
| Collaborators | collaborators, collaborators/{user} (check, add, remove), collaborators/{user}/permission |
| Checks | check-runs, commits/{ref}/check-runs, check-suites, commits/{ref}/check-suites, rerequest, statuses/{sha}, commits/{ref}/status |
| Issues | issues, comments, labels, assignees, reactions, lock |
| Releases | releases, latest, by tag, assets and asset upload |
| Actions | workflows, runs, jobs, dispatches, cancel, rerun |
| Apps | app, app/installations, access tokens, suspension, installation/repositories, app/hook/config, app/hook/deliveries |
| Webhooks | Repository and organization hooks, and app webhooks with installation, installation_repositories, check_suite, check_run, workflow_run and workflow_job |
| 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 share one sequence, and
issues/{number}endpoints also reach pull requests. Older repositories can have an Issue and a Change Request with the same number; there,issues/{number}addresses the Issue. - Releases for a tag that doesn't exist create it at
target_commitish, or the default branch; that needs write access to the repository's contents. Releases can't be deleted. - Collaborators: adding someone who isn't in the workspace creates an invitation; its
html_urlis the link that accepts it. Upstream has no triage role, sotriagegives read access. - Update branch answers
202and updates the branch shortly after.update_method: "rebase"rebases instead of merging; it isn't available on change requests mirrored to GitHub. - Commit filters
author,sinceanduntilaren't supported yet. - Search: issue search needs one
repo:owner/namequalifier. Code search takesrepo:, ororg:oruser:for the owner's 20 most recently updated repositories. - Assignees are listed only to people who can write to the repository.
- GraphQL covers what's listed above, not all of GitHub's schema. Projects, milestones, discussions and sponsors aren't there.