API Endpoints
- Projects — projects, branches, browsing, import, sync
- Workspaces
- Changes — the change lifecycle, merging, GitHub promotion
- Reviews and Comments — comment threads and review verdicts
- Issues — the built-in issue tracker
- Deployments and Deploy Secrets — post-merge deployments, the approval gate, and the per-project secret store
- Agents
- Users — profile, account deletion, API tokens
- Organizations
- GitHub App installations — which Stratum owner’s projects may act on GitHub through an app installation
The complete, authoritative surface — request and response schemas included — is the OpenAPI specification.
Projects API
Section titled “Projects API”List Projects
Section titled “List Projects”GET /api/projects
Create Project
Section titled “Create Project”POST /api/projects
Get Project
Section titled “Get Project”GET /api/projects/{namespace}/{slug}
Import from GitHub
Section titled “Import from GitHub”POST /api/projects/{namespace}/{slug}/import
See the Importing from GitHub guide for the available options, how to track an import’s progress, and keeping the project in sync with its source.
Delete Project
Section titled “Delete Project”DELETE /api/projects/{namespace}/{slug}
Permanently deletes a project and all associated data (repo + workspace forks, changes, issues, events, metrics, webhooks). Owner-only. The request body must confirm the exact path:
{ "confirm": "@namespace/slug" }Returns 202 Accepted with { "status": "deleting", "jobId": "del_…" } — the
cascade runs asynchronously and is idempotent/resumable. A mismatched confirm
returns 400; a non-owner returns 404.
List Branches
Section titled “List Branches”GET /api/projects/{namespace}/{slug}/branches
Returns { defaultBranch, branches: [{ name, oid }], truncated, totalBranchCount }.
Read from the remote’s ref advertisement, so the cost does not grow with the
branch count. Capped at 200 — truncated says so explicitly, and the default
branch is never the entry dropped.
Create Branch
Section titled “Create Branch”POST /api/projects/{namespace}/{slug}/branches
{ "name": "release/2.x", "startPoint": "trunk" }startPoint may be a branch name or a full 40-character commit sha, and
defaults to the default branch’s tip. Short shas and tag names are refused:
a tag can point at a non-commit, its peeled commit is not advertised on the push
path, and a tag may sit outside both the default branch’s history and the tag
set a backup captures — so a branch created from one could fail to push or
vanish on restore. The new ref can only point at an object the repository
already holds, so branch creation cannot introduce content that has not passed
the change gate.
Writers only (a non-writer gets 404). 400 for an invalid name or an
unresolvable start point. Three distinct 409s: BRANCH_EXISTS if the name is
taken, BRANCH_NAME_CONFLICT if it collides with an existing ref path (release
when release/2.x exists — git stores refs as paths, so one cannot be both a
file and a directory), and NO_DEFAULT_BRANCH if the configured default branch
is not advertised by the remote and there is therefore nothing to default to.
Delete Branch
Section titled “Delete Branch”DELETE /api/projects/{namespace}/{slug}/branches/{name}
Hierarchical names are passed as real path segments
(.../branches/release/2.x); a percent-encoded slash (release%2F2.x) names
the same branch, since each path segment is decoded individually.
Writers only. The default branch cannot be deleted —
409 DEFAULT_BRANCH_PROTECTED.
List Tags
Section titled “List Tags”GET /api/projects/{namespace}/{slug}/tags
Returns { tags, truncated, totalTagCount }, with tags in ascending name order.
Each tag is:
| Field | Meaning |
|---|---|
name | Tag name, without refs/tags/. |
oid | What the ref points at: the tag object for an annotated tag, the target itself for a lightweight one. |
targetSha | The commit the tag resolves to, or null when it could not be determined. |
annotated | true for an annotated tag. |
message, tagger, timestamp | Annotated tags only: the tag’s message, its tagger as Name <email>, and the tagger time in epoch seconds. |
unresolvable | true when the tag’s object or target could not be read. The tag is still listed. |
Tag names come from the remote’s ref advertisement, so a listing normally does
not clone the repository. The exception is a tag whose details are not stored
yet. The repository is cloned to read it, and the details are then remembered.
The first request after a new tag is pushed is therefore slower. A tag that could
not be resolved, or whose details come to more than 64 KB once stored (in
practice, a very long message), is not remembered. Every
request that lists such a tag clones the repository again, and unresolvable
can be true on any of those requests.
Capped at 200, keeping the highest-sorting names; truncated says so explicitly
and totalTagCount is the number the repository actually has. Readable by anyone
who can read the project.
Push mirror
Section titled “Push mirror”Keeps a GitHub repository a read-only, fast-forward-only copy of the project’s default branch and tags. The push mirror guide covers setup, the GitHub App permissions it needs, and recovery.
Every endpoint is for project admins: the project’s owner, or an owner or
admin of the organization that owns it. A writer who is not an admin gets 403,
anyone else 404, and an agent 401.
Get the mirror
Section titled “Get the mirror”GET /api/projects/{namespace}/{slug}/mirror
{ "mirror": { "repo": "acme/widgets", "url": "https://github.com/acme/widgets", "enabled": true, "state": "ok", "pending": false, "lastPushedSha": "9f2c1e7a…", "lastPushedAt": "2026-11-09T10:15:02.000Z", "lastAttemptAt": "2026-11-09T10:15:00.000Z", "lastError": null, "nextAttemptAt": null, "attempts": 0, "acceptPullRequests": false, "requireContributorAgreement": false }}mirror is null when the project has none. state is one of idle,
pushing, ok, retrying, failed, diverged. pending is true while a
push has been requested and has not completed.
The same object is the mirror field of
GET /api/projects/{namespace}/{slug}/sync/status, for anyone who can read the
project. Readers without write access do not get lastError, nextAttemptAt
or attempts.
Configure the mirror
Section titled “Configure the mirror”PUT /api/projects/{namespace}/{slug}/mirror
{ "repo": "acme/widgets", "enabled": true, "acceptPullRequests": true, "requireContributorAgreement": true}repo is owner/repository on GitHub. enabled defaults to true. POST to
the same path does the same thing.
acceptPullRequests brings pull requests opened against the mirror’s default
branch into the project as external changes, and requireContributorAgreement
makes importing one need a maintainer’s confirmation. Both are off for a new
mirror and are left unchanged when omitted. See
Pull requests on the mirror.
The target is checked against GitHub before it is saved, whether or not the
mirror is enabled; only disabling an existing mirror skips the check. Saving an
enabled mirror queues a push. Enabling a mirror also stops the project syncing from its source
and promoting changes to GitHub pull requests (409 PUSH_MIRROR_ENABLED on
those endpoints).
| Status | code | Meaning |
|---|---|---|
400 | invalid-repo | repo is not owner/repository |
403 | not-authorized | The App installation is not linked to the project’s owner |
403 | no-permission | The App lacks Contents: read and write on the repository |
409 | not-installed | The App is not installed on the repository |
409 | taken | The repository is connected to another Stratum project |
409 | deleting | The project is being deleted |
502 | github | GitHub could not be reached |
503 | not-configured | The GitHub App is not configured on this instance |
Resume the mirror
Section titled “Resume the mirror”POST /api/projects/{namespace}/{slug}/mirror/resume
Clears a failed or diverged state and queues a push. Returns 202 with the
mirror. It never forces: a repository that is still diverged is reported as
diverged again. On a healthy mirror it queues a push now.
Remove the mirror
Section titled “Remove the mirror”DELETE /api/projects/{namespace}/{slug}/mirror
Deletes the configuration and status. The GitHub repository is not changed.
Resync from GitHub (break-glass)
Section titled “Resync from GitHub (break-glass)”POST /api/projects/{namespace}/{slug}/resync
Fast-forwards the project’s default branch to the same branch on GitHub. This is the one exception to the read-only mirror, for a fix that had to land on GitHub while Stratum could not merge. The commits it brings in are not evaluated. Read the guide before you use it.
Project admins only, as above. In addition, an OAuth grant with write scope is
refused with 403 ADMIN_REQUIRES_DIRECT_CREDENTIAL: use a browser session or a
personal API token with the read_write scope. A read-only token or grant is
refused first, with 403 TOKEN_SCOPE_INSUFFICIENT. The organization’s second-factor policy and
IP allowlist apply.
The source is the project’s push mirror repository, or, for a project with no mirror, its linked GitHub repository. The request cannot choose it.
{ "expectedSha": "9f2c1e7a0b3d4c5e6f708192a3b4c5d6e7f80910" }The body is optional. expectedSha is the full 40-character SHA that GitHub’s
branch must be at; any other commit there is refused.
200 with "status": "fast-forwarded":
{ "status": "fast-forwarded", "branch": "main", "source": { "kind": "mirror", "repo": "acme/widgets" }, "oldSha": "4b825dc6…", "newSha": "9f2c1e7a…", "commits": [{ "sha": "9f2c1e7a…", "summary": "Fix the merge queue deadlock", "author": "Ada" }], "commitCount": 1, "commitsTruncated": false, "evaluated": false, "mirror": { "repo": "acme/widgets", "state": "ok", "pending": true }}200 with "status": "up-to-date" when the project already contains GitHub’s
commit. It carries branch, source, projectSha, upstreamSha and mirror.
The branch was not moved. A push mirror that was failed or diverged is
still resumed, with a mirror.resumed audit entry, as after a fast-forward.
source.kind is mirror or source. commits holds at most 50 entries,
newest first. mirror is the mirror after the resync, or null.
A refusal carries code, and projectSha and upstreamSha when it knows them.
Nothing was changed, except where the table says the outcome is unknown.
| Status | code | Meaning |
|---|---|---|
400 | RESYNC_INVALID_SHA | expectedSha is not a full 40-character SHA |
400 | RESYNC_INVALID_BODY | The body is present but is not a JSON object. An empty body is accepted and means no pin |
403 | ADMIN_REQUIRES_DIRECT_CREDENTIAL | An OAuth grant was used |
403 | GITHUB_APP_NOT_AUTHORIZED | The App installation is not linked to the project’s owner |
403 | GITHUB_APP_PERMISSION_DENIED | The App lacks Contents: read on the repository |
409 | RESYNC_NO_UPSTREAM | The project has no push mirror and no linked GitHub repository |
409 | RESYNC_DIVERGED | The two branches have diverged; the error names both commits |
409 | RESYNC_SHA_MISMATCH | GitHub’s branch is not at expectedSha |
409 | RESYNC_PROJECT_MOVED | A merge landed while the resync was running; run it again |
409 | RESYNC_UPSTREAM_BRANCH_MISSING | The GitHub repository has no branch with the default branch’s name |
409 | RESYNC_PROJECT_BRANCH_MISSING | The project has no commits; a resync does not populate it |
409 | GITHUB_APP_NOT_INSTALLED | The App is not installed on the repository |
409 | TARGET_DELETING | The project is being deleted |
502 | GITHUB_ACCESS_DENIED | GitHub refused the App’s token for the repository |
502 | RESYNC_UPSTREAM_UNAVAILABLE | GitHub could not be read |
502 | RESYNC_PROJECT_UNAVAILABLE | The project’s repository could not be read |
502 | RESYNC_HISTORY_INCOMPLETE | The history between the two commits could not be read completely |
502 | RESYNC_PUSH_REJECTED | The project’s repository refused the fast-forward |
502 | RESYNC_FAILED | The resync failed. The outcome may be unknown: check the branch before you retry |
503 | GITHUB_APP_NOT_CONFIGURED | The GitHub App is not configured on this instance |
504 | RESYNC_PUSH_TIMEOUT | The push did not finish in time. The outcome is unknown: check the branch before you retry |
A fast-forward writes branch.resync_requested and branch.resynced audit
entries and emits a branch.resynced event. The settings page posts a form to
the same path with confirm (the source owner/repository, typed out) and an
optional expected_sha; a form post is answered with a redirect.
Browsing a branch
Section titled “Browsing a branch”GET .../files, .../content, and .../log accept ?ref=<branch>, defaulting
to the project’s default branch. Branch names only: an unknown ref is a 404
(never a silent fall back to the default), and a name that is both a branch and
a tag is a 409 AMBIGUOUS_REF rather than a guess at which was meant. The
response echoes the ref actually read.
Workspaces API
Section titled “Workspaces API”List Workspaces
Section titled “List Workspaces”GET /api/workspaces/{namespace}/{slug}/workspaces
Create Workspace
Section titled “Create Workspace”POST /api/workspaces/{namespace}/{slug}/workspaces
Commit Changes
Section titled “Commit Changes”POST /api/workspaces/{name}/commit
Mint a Workspace Remote Credential
Section titled “Mint a Workspace Remote Credential”POST /api/workspaces/{namespace}/{slug}/workspaces/{name}/remote-credential
Returns the workspace’s git remote and a short-lived stratum_git_ credential
for it. Backs the MCP tool stratum_workspace_remote; see
Pushing from a local checkout.
curl -X POST https://stratum.example.com/api/workspaces/@acme/billing/workspaces/fix-retries/remote-credential \ -H "Authorization: Bearer $STRATUM_TOKEN" \ -H "Content-Type: application/json" \ -d '{"expiresInMinutes": 30}'# → 201 {"remote":"https://stratum.example.com/@acme/billing/workspaces/fix-retries.git",# "username":"stratum","token":"stratum_git_…","expiresAt":"…",# "credentialId":"tok_…","branches":["main","fix-retries"], …}- What it can do:
git fetchandgit pushon that one workspace, nothing else. It is refused on the project URL, on every other workspace, and on the whole API,/mcpincluded. - How long it lasts:
expiresInMinutes, 5 to 60, default 60. Never longer than the credential that minted it, and it stops working the moment that credential is revoked or expires (or, for the legacy key, is rotated or disabled; for an agent token, the agent is revoked). - Who may mint it: a
read_writeAPI token, anmcp:writeOAuth grant, an agent token, or the legacy key, held by someone who can push to the workspace (its creator or a project admin). A read-only credential gets403 TOKEN_SCOPE_INSUFFICIENT; a browser session gets403 TOKEN_REQUIRED; every other refusal is a404. - Limits: 20 live credentials per user (
409 TOKEN_LIMIT_REACHED). - Audit: each mint is recorded as
workspace_remote.credential_minted, with the workspace, the expiry and the kind of credential that minted it. A refused use of an expired or revoked credential is recorded asauth.failedwith methodworkspace_git_token. The secret itself is never logged or stored.
Changes API
Section titled “Changes API”A change is a reviewable, evaluation-gated proposal to move a project’s default branch. See the OpenAPI specification for exact schemas, and Reviews and Comments for the discussion layer on top of a change.
List Changes
Section titled “List Changes”GET /api/projects/{name}/changes
?status= filters by status. external lists the pull requests from the
project’s GitHub mirror that are waiting for a maintainer to
import them.
Create Change
Section titled “Create Change”POST /api/projects/{name}/changes
{ "workspace": "fix-retries", "title": "Retry on 5xx only", "description": "A 4xx is the caller's mistake and retrying it trips the circuit breaker.\n\nFixes #214."}Only workspace is required. title is one line of up to 200 characters, and
description is up to 20,000 characters of markdown. Give both: the title heads
the change page and the changes list, and both carry over to the pull request
when the change is promoted to GitHub. A change that has no title at the moment
is headed by the subject of its first commit.
Evaluation runs off the request where the instance has an evaluation queue
(the hosted instance does): the response is 202 with the change in status
evaluating and no verdict. Poll GET /api/changes/{id} until the status leaves
evaluating — it becomes accepted or needs_changes, with the evaluation runs
recorded exactly as an inline evaluation records them. A change cannot be merged
while it is evaluating, even with force.
Each evaluator runs under its own deadline, so one that hangs fails closed in
place (score 0, a reason naming the deadline) without holding up the others. A
run that cannot finish at all — retries exhausted, or a consumer that never
reported back, which the five-minute sweep detects — leaves the change
needs_changes with evalReason starting Evaluation did not complete.
Re-evaluate to try again.
On an instance with no evaluation queue bound, or when enqueueing fails,
evaluation runs inline and the response is 201 with the verdict, as it always
was. A workspace containing git submodules is refused with the explanatory
message — inline as a 400, queued as a needs_changes verdict.
Get Change
Section titled “Get Change”GET /api/changes/{id}
For a change that came from a pull request on the project’s GitHub mirror, the
response also carries externalPullRequest:
{ "repo": "acme/widgets", "number": 7, "url": "https://github.com/acme/widgets/pull/7", "author": "casey-c", "title": "Fix the widget", "headSha": "9f2c1e7a…", "importedHeadSha": null, "commits": 2, "changedFiles": 3, "state": "open", "refusal": null, "importedBy": null, "importedAt": null, "agreementConfirmedBy": null, "agreementConfirmedAt": null, "commitAuthors": [], "closure": { "state": "none", "error": null }}title, author and commitAuthors are text chosen by the pull request’s
author. Display them as text.
Import a pull request
Section titled “Import a pull request”POST /api/changes/{id}/import
Brings the commits of an external change’s pull request into a workspace and
starts the change’s evaluation. See
Pull requests on the mirror for the
whole flow and its trust model.
A person with write access to the project only. An agent gets 401.
{ "agreementConfirmed": true, "headSha": "9f2c1e7a…" }Both fields are optional. agreementConfirmed is required when the mirror sets
requireContributorAgreement. headSha is the head commit you looked at; send
it so that commits pushed since are not imported unseen.
Answers 202 with the change, its externalPullRequest, and
evaluation.mode (queued, or inline when the verdict is already in the
response).
| Status | code | Meaning |
|---|---|---|
409 | NOT_EXTERNAL | The change is not waiting to be imported |
409 | PR_HEAD_MOVED | The pull request has commits newer than headSha |
409 | PR_NOT_OPEN | The pull request is closed, or no longer targets the default branch |
409 | EXTERNAL_IMPORT_UNAVAILABLE | The mirror is disabled or no longer accepts pull requests |
422 | CONTRIBUTOR_AGREEMENT_REQUIRED | agreementConfirmed was not true |
502 | GITHUB_ACCESS_DENIED | GitHub refused the App’s token for the mirror repository. Always 502, whatever status GitHub gave |
422 | PR_TOO_MANY_COMMITS, PR_TOO_MANY_FILES, PR_TOO_LARGE | Over a limit |
422 | SUBMODULES_UNSUPPORTED, LFS_UNSUPPORTED | The pull request adds a submodule or a Git LFS pointer |
422 | PR_CONFLICTS, PR_UNRELATED_HISTORY, PR_EMPTY | It cannot be joined to the default branch, or adds nothing to it |
A 422 other than the first is also stored on the change, as
externalPullRequest.refusal, until the pull request gets new commits.
Update Change
Section titled “Update Change”PATCH /api/changes/{id}
Sets or clears the title and description. Send either or both; null or an
empty string clears a field, and a field left out is not touched. Needs write
access to the project. Agent tokens are accepted: the text is the author’s
account of the change and no gate reads it. Returns { "change": … }.
Re-evaluate
Section titled “Re-evaluate”POST /api/changes/{id}/evaluate
Users only. Merged, rejected, promoted and reverted changes cannot be
re-evaluated. An
external change answers 409 EXTERNAL_NOT_IMPORTED:
importing it is what starts its evaluation.
With an evaluation queue this re-enqueues and answers 202: the change
moves to evaluating under a new run, and any run still in flight is
superseded — its verdict is discarded when it finishes, so an older run can
never overwrite a newer revision’s result. Re-evaluating a change that is stuck
in evaluating is allowed, and is the manual way to recover it. Without the
queue the evaluation runs inline and answers 200 with the verdict.
An inline evaluation records its results, its verdict and any approval
dismissal together, or not at all. If the change was merged, rejected,
promoted or reverted while it ran, none of them is recorded, the change keeps that
decision, and the answer is 409 CHANGE_FINALIZED with the change’s status.
The evaluation’s cost is still recorded, since it was spent. A change deleted
while it ran answers 404.
Re-evaluation runs under the current evaluator defaults, so a change that passed under older limits may fail. Approvals are dismissed when the evaluated base moves, not only when the tip does.
Reject
Section titled “Reject”POST /api/changes/{id}/reject
Users only. Merged changes cannot be rejected.
POST /api/changes/{id}/merge
Runs the full merge gate. Common refusals (see Error codes for the full list and the response shapes):
| Code | Meaning |
|---|---|
EVALUATION_PENDING | The change is still evaluating; refused even with force |
EXTERNAL_NOT_IMPORTED | The change is external: a pull request nobody has imported; refused even with force |
PR_HEAD_MOVED | The change came from a pull request that now has commits newer than the ones imported; refused even with force — import them first |
EVALUATION_MISSING | The evaluation failed closed and pinned no revision; refused even with force — re-evaluate first |
STALE_BASE | Under merge.requireFreshBase: the recorded base is behind project HEAD, or the change has no recorded base |
BASE_UNVERIFIABLE (503) | Under merge.requireFreshBase: project HEAD could not be read, so freshness could not be verified. Nothing merged; retry |
STALE_WORKSPACE | The workspace advanced after evaluation |
WORKSPACE_UNVERIFIABLE | Workspace state could not be verified against what was evaluated |
PROTECTION_BLOCKED | Blocked by branch protection; the response lists reasons. A required check that is missing, queued, running, failed or errored for the evaluated revision appears here |
MERGE_CONFLICT | Conflicts; the response carries a conflict id |
Merge a Batch
Section titled “Merge a Batch”POST /api/projects/{name}/changes/merge-batch
Resolves and policy-gates every change, then merges the eligible ones onto the
project head with a single push (see
ADR 004). At most 80 changes per
request, and requires the RepoDO backend. force is deny-by-default and must be
allowed by project policy (merge.allowForce: true).
The 200 response has three lists, and a client must read all of them:
merged holds the ids that merged, conflicted the ids that hit a merge
conflict, and skipped each change that was not attempted, with a reason.
When nothing is eligible the answer is 400, and its body carries the
skipped list. One case is different: under
merge.requireFreshBase, if the project head could not be read and that
leaves nothing to merge, the answer is 503 BASE_UNVERIFIABLE with the
skipped list. That is a fault to retry, not an ineligible batch.
A change that came from a pull request on the mirror is skipped, so that its commits are kept. Merge it on its own.
Check runs
Section titled “Check runs”Per-job CI results a project’s runner reports back to a change, asynchronously. The policy block, the runner contract and the gate are described in Check runs; this is the HTTP surface.
A check run:
{ "id": "chk_51c0…", "changeId": "chg_8f2b…", "revision": "4a7d…", "baseSha": "9c1e…", "name": "test", "attempt": 1, "status": "running", "summary": "142 of 214 tests", "detailsUrl": "https://ci.example.com/runs/8841", "createdAt": "2026-11-09T12:00:00.000Z", "startedAt": "2026-11-09T12:00:04.000Z", "deadlineAt": "2026-11-09T12:30:00.000Z"}status is queued, running, passed, failed or errored. revision is
the evaluated head sha the run was dispatched for. attempt counts runs of the
same check on the same revision; completedAt is present once the status is
terminal.
List a change’s check runs
Section titled “List a change’s check runs”GET /api/changes/{id}/checks
Needs read access to the project. Returns the newest run of each check on
the change’s evaluated revision — the set merge.requiredChecks is checked
against:
{ "changeId": "chg_8f2b…", "revision": "4a7d…", "checks": [ … ] }revision is null, and checks empty, for a change that has not been
evaluated yet. ?all=true returns every run instead: all revisions and all
attempts, oldest first.
Re-run a check
Section titled “Re-run a check”POST /api/changes/{id}/checks/{checkId}/rerun
Users only, with write access to the project. Creates a new run of the same
check on the same revision and dispatches it to the runner; the run named
in the URL stops counting. Answers 202 with { "check": { … } } — the new
run, queued.
| Status | Code | Meaning |
|---|---|---|
404 | NOT_FOUND | No such check run on this change |
409 | EVALUATION_PENDING | The change is still evaluating; its checks are dispatched when that finishes |
409 | STALE_REVISION | The workspace has new commits, or the change is on another revision. Re-evaluate the change instead |
409 | CHECK_SUPERSEDED | A newer run of this check exists; re-run that one |
409 | CHECK_NOT_DECLARED | The policy on the default branch no longer declares this check |
409 | POLICY_INVALID | The project’s policy file is invalid |
409 | CONFLICT | The change is merged, rejected or reverted |
502 | CHECK_DISPATCH_FAILED | The new run was created but the runner could not be reached. The body carries it as check, already errored |
A first-party CI step is re-run as a whole job: every step in it gets a new run, and the response carries the one for the check named in the URL.
Read a CI step’s log
Section titled “Read a CI step’s log”GET /api/changes/{id}/checks/{checkId}/log
The output of one first-party CI step, as
text/plain. Needs read access to the project. This is the URL such a check’s
detailsUrl holds. A running step’s log grows between requests.
| Status | Code | Meaning |
|---|---|---|
404 | NOT_FOUND | No such change, or no such check run on it |
404 | CHECK_HAS_NO_LOG | The check was reported by a project’s own runner; follow its detailsUrl instead |
404 | CHECK_LOG_NOT_FOUND | The executor has no log for this run: not started yet, or expired |
502 / 503 | CI_EXECUTOR_UNAVAILABLE | 502: the executor could not be reached or refused the request. 503: the instance has no executor, or it is misconfigured; the error message names the setting |
Report a check run (runner callback)
Section titled “Report a check run (runner callback)”POST /api/checks/{checkRunId}
Called by the runner, not by an API client. It takes no bearer token and no
session: the request is authenticated by X-Stratum-Signature: sha256=<hex>,
the HMAC-SHA256 of the raw body under the project secret the policy’s checks
entry names — or, for a first-party CI step, under the
instance’s executor secret, which only the instance’s own executor holds. A token bound to one project or organization is refused before
routing.
{ "checkRunId": "chk_51c0…", "headSha": "4a7d…", "status": "passed", "sequence": 3, "summary": "214 tests passed", "detailsUrl": "https://ci.example.com/runs/8841"}checkRunId must equal the id in the URL and headSha the run’s revision.
status is running, passed, failed or errored. sequence is a
positive integer that increases with every report for the run. summary
(truncated to 4,000 characters) and detailsUrl (an http(s) URL without
credentials, at most 2,048 characters) are optional. The body may be at most
64 KB.
| Status | Code | Meaning |
|---|---|---|
200 | — | { "applied": true, "check": { … } } — recorded |
200 | — | { "applied": false, "check": { … } } — a redelivered or out-of-order report (sequence not above the last applied one); nothing changed |
400 | INVALID_REPORT | Signed, but not a valid report |
401 | INVALID_SIGNATURE | Missing or wrong signature, or no such check run — the same response either way, so the endpoint does not reveal which ids exist |
409 | STALE_REVISION | headSha is not the run’s revision, or the change has moved to a newer revision |
409 | CHECK_SUPERSEDED | A newer run of this check replaced this one |
409 | CHECK_TERMINAL | The run already finished; terminal states are final |
409 | CHECK_DEADLINE_EXCEEDED | The deadline passed first; the run is errored |
413 | PAYLOAD_TOO_LARGE | Body over 64 KB |
Every 409 carries the run’s current state as check. Unauthenticated
requests share the per-address anonymous rate limit.
Promote to a GitHub PR
Section titled “Promote to a GitHub PR”POST /api/changes/{id}/github-pr
Users and agents, with write access to the project. An agent may promote because
a change can only be promoted once its gates have passed, and whether the pull
request merges is still decided on GitHub; promotedBy records the agent’s id.
An agent can only open a draft: any draft other than true is refused with
403 PROMOTION_NEEDS_PERSON from an agent token, a scoped API token or an OAuth
grant, because asking for review is a person’s decision (see
Mark the PR ready for review). For the same
reason, when one of those credentials promotes a change whose pull request is
already open and ready, for example after a review asked for changes, the pull
request is first returned to draft, and then the new commits are pushed: new
code does not reach a pull request marked ready until a person marks it ready
again. The change records the pull request as a draft, so its page offers
Mark ready for review again. If GitHub refuses that, the answer is 502 GITHUB_ERROR and nothing is
pushed.
Two kinds of change have to be promoted by a person. For them, three kinds of
credential get 403 PROMOTION_NEEDS_PERSON: an agent token, a scoped API
token, and an OAuth grant (an MCP client, the CLI) acting for a user, since
those are the credentials an agent is handed. A signed-in browser session
counts as the person, and so does the legacy account-wide stratum_user_ key,
which is not scoped and predates delegation. All of this is about credentials
with write scope: a read-only API token or an mcp:read grant never gets this
far, and is refused with 403 TOKEN_SCOPE_INSUFFICIENT like any other write.
-
A workspace whose
.github/differs from the project’s. A pull request from a branch of the repository itself runs that branch’s workflow files with the repository’s secrets, so a changed workflow would run as written the moment the pull request opened. The whole directory is compared as git objects against the project’s current default branch, so nothing beneath it can differ unnoticed. A workspace that is behind the project can differ through no change of its own; bring it up to date and evaluate again. The same comparison is then made against the base branch on GitHub, because the project is a copy of the repository as of its last sync and the pull request runs on the repository as it is now: a project that has fallen behind is refused until it is synced and the workspace brought up to date. If GitHub cannot be asked, the answer is the same refusal.This rule covers the workflow files, not the code they run. A workflow that builds or tests a pull request runs the change’s own code, with whatever secrets that workflow is given. Stratum’s gates have passed on that code, but nobody has approved it. If agents promote on your project, keep secrets out of the workflows that run on pull requests from
stratum/**branches, or put those jobs behind a GitHub environment that needs approval. -
A change to the merge-protection config (
.stratum/policy.yaml,stratum.config.json), which needs a human approval to merge.
The same answer comes back if the repositories cannot be read to check, or the change has no evaluated revision on record. This guard covers workflow files only: your existing workflows still run on a promoted pull request, with whatever secrets they expose to pull requests, and they run the code the agent wrote. Scope those secrets with that in mind.
The change must be accepted (or already promoted), and the project
must be connected to GitHub with a configured token. Creates a PR — draft by
default — from branch stratum/{changeId} and marks the change promoted.
{ "title": "…", "body": "…", "draft": true }The PR base is always the project’s own recorded default branch and is not accepted from the request body: this endpoint acts with an instance GitHub credential, so honouring a caller-supplied base would let any caller aim it at a branch of its choosing.
The credential is the GitHub App’s installation token when the app is installed
on the repository and that installation is linked to the project’s owner
(see GitHub App installations), or an operator binding names
the project’s owner for the repository’s GitHub owner. The instance-wide
GITHUB_TOKEN is used only for such a binding. A project with neither gets
403, and a project that is not the repository’s canonical project gets
409 GITHUB_REPO_NOT_CANONICAL. When no App credential could be obtained and
GITHUB_TOKEN is unset, the answer is 400 GITHUB_NOT_CONFIGURED rather than
a refusal. That covers an instance with no App configured, a configured App
that is not installed on the repository, and a configured App whose
installation lookup or token minting failed. The last case is logged as a
“GitHub App token unavailable” warning; check for it before assuming the
configuration is missing.
Who the PR is opened as. The branch is always pushed with the credential
above. The PR itself is opened as the person promoting, or as the owner of the
agent promoting, when that person has
connected their GitHub account, so
that GitHub records them as its author, and with the instance’s own credential
otherwise (reported as app). The response
reports it under github:
| Field | Meaning |
|---|---|
pullRequestAuthor | The author’s GitHub login, as GitHub returned it. Absent when GitHub named none. |
openedAs | user or app: who this call opened the PR as. app means the instance’s own credential, which is the GitHub App’s installation token or, under an operator binding, GITHUB_TOKEN. Absent when the PR already existed, since its author was settled when it was first opened. |
openedAsAppBecause | Present with openedAs: "app" on an instance where accounts can be connected. not_connected: the promoter has no connection. connection_expired: their authorization lapsed or was revoked, and has been removed; they need to connect again. refresh_in_progress: another promotion of theirs was renewing the authorization at that moment. unavailable: the connection could not be read or renewed just now. github_refused: GitHub would not open the PR as them, for example because they cannot read the repository. |
None of these fails the promotion by itself: Stratum then creates the PR with
the instance credential, and that attempt succeeds or fails (502 GITHUB_ERROR) as it would have without a connection. A PR opened with the instance’s credential can be closed and the
change promoted again once the cause is fixed.
If a re-evaluation begins while the branch is being pushed, the response is
409 EVALUATION_PENDING: the PR exists and its link is recorded (github in
the body), but the change is not marked promoted. Promote again once the
evaluation finishes; that re-pushes to the same PR.
Mark the PR ready for review
Section titled “Mark the PR ready for review”POST /api/changes/{id}/github-pr/ready
Takes the change’s pull request out of draft, so promoting a change and asking
for its review stay two separate decisions. A person only, with write access to
the project; no body. A scoped API token or an OAuth grant (one acting as an agent
included) is refused with 403 READY_NEEDS_PERSON, and an agent token with
401: those act for a user
but are what an agent is handed, and on a repository whose workflows deploy or
test pull requests, marking one ready can be what lets its code run with
secrets. Use the change page, signed in, or GitHub. It acts on the pull request the change was promoted to, with
the instance credential that pushes a promoted branch, under the same rules. It
never uses a person’s connected GitHub account, whoever the pull request was
opened as.
{ "ready": true, "changeId": "chg_…", "alreadyReady": false, "github": { "owner": "acme", "repo": "api", "prNumber": 42 } }A pull request that is already ready succeeds with alreadyReady: true. A
change that was not promoted gets 409 NOT_PROMOTED. A pull request that turns
out to be closed on GitHub gets 409 PULL_REQUEST_CLOSED, and the change’s
githubPrState is corrected to closed. If GitHub refuses, the answer is 502 GITHUB_ERROR with
GitHub’s message.
A change carries githubPrDraft once this is known. Marking the pull request
ready or converting it back to a draft on GitHub updates it too.
Once a change has a linked PR, each evaluation posts the verdict to the PR as a
comment (edited in place on re-evaluation) and as a stratum/evaluation commit
status. Promotion posts the change’s latest verdict the same way, on the
revision it pushed, since the change was evaluated before the PR existed. That
post is best-effort and not retried: if it fails, the promotion still succeeds,
and promoting again re-posts it.
Reviews and Comments API
Section titled “Reviews and Comments API”Comment threads and human review verdicts on a change. See the Code Review user guide for the concepts, and the OpenAPI specification for exact schemas.
Add a Comment
Section titled “Add a Comment”POST /api/changes/{id}/comments
Read access to the project is enough — users and agents may comment.
body max 20,000 chars.
{ "body": "…", "file": "src/x.ts", "line": 214, "side": "new", "commitSha": "a1b2…" }fileandlinemust be passed together to anchor the comment to a diff line.lineis 1-based.side(old|new) andcommitShaare accepted only alongside afile+lineanchor.parentCommentIdposts a reply into an existing thread. The parent must belong to the same change, replies inherit the thread’s anchor (so anchor fields must be omitted), and a reply to a reply is flattened onto the thread root.
List Comments
Section titled “List Comments”GET /api/changes/{id}/comments
Resolve a Thread
Section titled “Resolve a Thread”POST /api/changes/{id}/comments/{commentId}/resolve
Unresolve a Thread
Section titled “Unresolve a Thread”POST /api/changes/{id}/comments/{commentId}/unresolve
Allowed for project writers or the comment’s author. Only a thread root can be resolved — resolving a reply is refused. Resolution is bookkeeping and does not gate a merge.
Submit a Review
Section titled “Submit a Review”POST /api/changes/{id}/reviews
Users only — agent tokens are refused, on every surface. Requires write
access to the project. Valid on changes in open, evaluating,
needs_changes, accepted, or approved.
While a change is evaluating, approve is refused with 409 EVALUATION_PENDING. Until the evaluation pins the revision it judged, an
approval cannot be tied to the code the reviewer actually saw. request_changes
and comment are accepted but do not change the status; the evaluation’s
verdict sets it — except that a request_changes made while it was pending
outranks a pass: the change lands on needs_changes, not accepted.
An approval is recorded only if the change is still exactly as it was loaded —
same status, evaluation run, evaluated revision and base. If it moved in
between, nothing is recorded and the response is 409 EVALUATION_PENDING (an
evaluation started) or 409 REVIEW_STALE (anything else); reload and review
again.
Approvals are made by a signed-in human. approve requires a browser
session (or the legacy user key). A scoped API token or an OAuth grant — what
MCP clients and the CLI hold, and what agents are handed — gets
403 SESSION_REQUIRED with an approveUrl (the change page) instead. Those
credentials can still send request_changes and comment, which can only
block a merge.
{ "verdict": "approve", "comment": "…" }verdict | Effect |
|---|---|
approve | Change → approved; counts toward requiredApprovals |
request_changes | Change → needs_changes |
comment | Comment-only; status untouched |
A comment verdict requires a non-empty comment (else 400). It never
counts toward required approvals, never blocks a merge, and never replaces an
existing approve/request_changes verdict by the same reviewer — a verdict
row is recorded only if that reviewer has none yet. Its text is written to the
change’s discussion and emits change.commented.
The response carries changeStatus: the new status after an
approve/request_changes, or the unchanged status after a comment.
The change author’s own approval never counts toward requiredApprovals;
for an agent-created change the excluded author is the agent’s owning user.
List Reviews
Section titled “List Reviews”GET /api/changes/{id}/reviews
Issues API
Section titled “Issues API”Issues are numbered per project and addressed by that number. See the Issues user guide for the concepts, and the OpenAPI specification for exact schemas.
Open an Issue
Section titled “Open an Issue”POST /api/projects/{namespace}/{slug}/issues
Read access is enough to open an issue. Also accepts form-encoded bodies, which redirect on success instead of returning JSON.
{ "title": "…", "body": "…", "linkedChangeId": "chg_123" }title max 200 chars, body max 20,000. linkedChangeId must reference a
change in the same project. 409 TARGET_DELETING if the project is being
deleted.
List Issues
Section titled “List Issues”GET /api/projects/{namespace}/{slug}/issues
Anonymous on public projects. Query parameters, all combinable:
| Parameter | Meaning |
|---|---|
status | open or closed |
label | Issues carrying this exact label |
assignee | Issues assigned to this user id |
q | Case-insensitive substring over title + body, max 200 chars (% and _ are literal) |
limit | Default 100, max 500 |
offset | Rows to skip |
Ordered newest-first by issue number.
Get an Issue
Section titled “Get an Issue”GET /api/projects/{namespace}/{slug}/issues/{number}
Update an Issue
Section titled “Update an Issue”PATCH /api/projects/{namespace}/{slug}/issues/{number}
Requires write access and a user identity — an agent token is refused
with 401. This is the editing and labelling path, so an agent can open an
issue and comment on it but cannot retitle, reassign, relabel, or close one.
Only the fields present in the body are written.
{ "title": "…", "body": "…", "status": "closed", "assignee": "usr_abc", "labels": ["bug"], "linkedChangeId": null }labels replaces the entire set (max 20 per issue, 50 chars each).
assignee and linkedChangeId accept null to clear.
Close an Issue
Section titled “Close an Issue”POST /api/projects/{namespace}/{slug}/issues/{number}/close
Requires write access and a user identity. No body. Despite the name it is
a toggle: it flips an open issue closed and a closed issue back open, and
answers with a 302 redirect (it backs the UI button). For an idempotent close
from a script, use PATCH {"status": "closed"} instead.
Issues linked to a change also close automatically when that change merges,
attributed to system.
Add a Comment
Section titled “Add a Comment”POST /api/projects/{namespace}/{slug}/issues/{number}/comments
Read access is enough. body max 20,000 chars.
List Comments
Section titled “List Comments”GET /api/projects/{namespace}/{slug}/issues/{number}/comments
Paginated with limit (default 100, max 500) and offset.
Import Issues from GitHub
Section titled “Import Issues from GitHub”POST /api/projects/{namespace}/{slug}/issues/import/github
Project admin, user identity. Queues a background import of the project’s GitHub
source repository’s issues (pull requests skipped) and answers 202 with
{ "run": … }. Idempotent: re-running updates previously imported issues and
comments instead of duplicating them. Form posts redirect to the settings page.
| Status | Code | Meaning |
|---|---|---|
400 | no-source | The project has no GitHub source |
403 | private | The GitHub repository is private |
403 | not-authorized | No GitHub credential may act for the project’s owner (no linked App installation and no operator binding) |
409 | active | An import is already queued or running |
409 | incomplete | The project’s code import has not completed |
409 | deleting | The project is being deleted |
502 | github | GitHub could not be reached to check the repository |
503 | not-configured | No GitHub credential is available on the instance |
503 | failed | The run could not be created or queued; nothing was imported |
GET on the same path returns { "run": … } for the latest run, or
{ "run": null }. Imported issues and comments carry externalUrl (the GitHub
original) and, when the author has no linked Stratum account, externalAuthor
(their GitHub login). See the
user guide.
Deployments and Deploy Secrets API
Section titled “Deployments and Deploy Secrets API”Post-merge deployments and the encrypted per-project secret store that feeds
the static targets. See the Deployments user guide
for the concepts — the deploys: policy block and its three targets, deploy
pipelines (the deploy: section of .stratum/ci.yaml), limits, and what each
status means — and the OpenAPI specification for exact schemas.
Two authorization rules here are stricter than the usual project read/write split:
- Every secret route refuses agent identities, even when the agent’s owner is a project admin. Deploy credentials are the one thing an agent token is never trusted with.
logTailis served to project writers only. It carries a redacted provider payload, and redaction is literal-substring matching.
No route on either router returns a secret value. There is no read path for a stored secret anywhere in the API.
An agent token gets 403 from a secret route and 401 from approve
Section titled “An agent token gets 403 from a secret route and 401 from approve”Both routes refuse an agent identity, but with different status codes, and the difference is deliberate rather than an inconsistency to be normalized away:
| Caller | Secret routes | POST /api/deployments/{id}/approve |
|---|---|---|
| Anonymous / no credential | 401 | 401 |
Agent token (stratum_agent_…) | 403 Agent credentials cannot manage deploy secrets | 401 Only authenticated users can approve a deployment |
| User without the required access | 403 | 403 Project access denied |
A secret route checks agentId first, so an agent is a recognized principal
being told what it may not do — “we know exactly who you are, and this is not
yours”: 403. Approve checks only for a userId, which an agent token never
sets, so an agent falls into the same branch as an unauthenticated caller —
“we do not know who you are as a user”: 401. Neither code is retryable with
the same credential; both mean “use a user identity”.
Deploy secrets
Section titled “Deploy secrets”List secret names
Section titled “List secret names”GET /api/projects/{namespace}/{slug}/secrets
Requires project admin and a non-agent identity: 403 for an agent token
(and for a user who is not an admin), 401 for a caller with no user identity
at all. Returns names and metadata only:
{ "secrets": [ { "name": "CLOUDFLARE_API_TOKEN", "createdBy": "usr_abc", "updatedBy": "usr_abc", "createdAt": "2026-09-01T10:00:00.000Z", "updatedAt": "2026-09-01T10:00:00.000Z" }] }Create or replace a secret
Section titled “Create or replace a secret”PUT /api/projects/{namespace}/{slug}/secrets/{name}
{ "value": "…" }name must match ^[A-Z][A-Z0-9_]{0,63}$; value is capped at 4096 bytes.
Writing an existing name replaces it. Audited as secret.written.
Answers 500 DEPLOY_SECRET_KEY_MISSING when the instance has no
DEPLOY_SECRET_KEY configured — secrets cannot be encrypted without it.
Create or replace a secret (form-friendly)
Section titled “Create or replace a secret (form-friendly)”POST /api/projects/{namespace}/{slug}/secrets
The browser’s way in to the PUT above, which an HTML form cannot issue. Takes
name and value in the body and runs the same authorization gate. A
form-encoded caller is redirected back to the project settings page with a
fixed error code in the query string; a JSON caller gets JSON.
Delete a secret
Section titled “Delete a secret”DELETE /api/projects/{namespace}/{slug}/secrets/{name}
404 if the project has no such name. Audited as secret.deleted.
Delete a secret (form-friendly)
Section titled “Delete a secret (form-friendly)”POST /api/projects/{namespace}/{slug}/secrets/{name}/delete
Browsers cannot issue DELETE. Same gate; a form caller lands back on the settings page, including when the name was already gone.
Deployments
Section titled “Deployments”List deployments
Section titled “List deployments”GET /api/projects/{namespace}/{slug}/deployments
Readable by anyone who can read the project (anonymously, for a public project). Newest first.
| Parameter | Meaning |
|---|---|
name | Only deployments for this deploys: entry or pipeline environment name |
status | One of pending_approval, queued, running, succeeded, failed, superseded, skipped |
limit | Default 50, max 200 |
offset | Rows to skip |
logTail is present only when the caller can write to the project.
Each deployment carries target — a static target’s name, or pipeline for
one run by the CI executor — and, when set, version (what it put live) and
rollbackOf (the deployment a rollback put back).
Get a deployment
Section titled “Get a deployment”GET /api/deployments/{id}
The URL carries no project; the row’s own project is what gets authorized. A
deployment in a project the caller cannot read answers 404, not 403, so an
id cannot be confirmed by probing.
Approve a deployment
Section titled “Approve a deployment”POST /api/deployments/{id}/approve
Releases a pending_approval deployment: the row moves to queued and is
enqueued. Requires project write access and a user identity — an agent
token is refused. This is the same guarantee (and the same limitation) as a
human review verdict: a user’s scoped API token and MCP OAuth grants are
accepted, so it means “not an agent”, not “a human at a keyboard”.
401— nouserIdon the request. This covers both an anonymous caller and an agent token, because an agent token setsagentIdand neveruserId; unlike the secret routes, this check does not look atagentIdat all. See the note above.403— a user identity that cannot write to the deployment’s project.409 DEPLOYMENT_NOT_PENDING— the row already leftpending_approval(a second approver lands here rather than deploying the commit twice).503 DEPLOY_QUEUE_UNAVAILABLE— the instance has noDEPLOY_QUEUEbinding. Checked before the status flip, since approval is not repeatable.
A failed enqueue is not an error. If the queue send is rejected after the
row has moved to queued, the request is written to the event outbox and the
call still succeeds — the five-minute sweep starts it. This is deliberate: the
row is already queued, so approve would refuse a second attempt and
retry only accepts terminal rows, which made the old “try again” advice
impossible to act on. A 500 now means the outbox write failed too, i.e.
nothing durable was recorded.
Audited as deployment.approved. A form-encoded caller gets a 302 back to
the deployment page.
Retry a deployment
Section titled “Retry a deployment”POST /api/deployments/{id}/retry
Creates a new attempt row for the same commit with attempt incremented,
and enqueues it. Requires project write access; unlike approve, an agent
identity is accepted. Answers 201 with the new row.
409 DEPLOYMENT_NOT_RETRYABLE— the deployment is not in a terminal status. Apending_approvalrow in particular cannot be retried, because the retry row would startqueuedand route around the approval gate.409 DEPLOYMENT_RETRY_EXISTS— someone else already created this attempt.503 DEPLOY_QUEUE_UNAVAILABLE— as above.
A failed enqueue is recorded to the outbox and still answers 201, for the
same reason as approve: the new attempt row already exists and is queued, so
a repeat call would only collide with the unique index on
(project, name, commit, attempt).
The originating change id is carried onto the retry, so the “was this change
reverted?” check still applies to it. Audited as deployment.retried.
A retry is not a way round a pipeline environment’s approval gate. For a
deployment with target: pipeline, a user’s retry is created queued with
that user as approvedBy. An agent’s retry carries no approval: where the
retried deployment was itself approved, the retry is created at
pending_approval and is not enqueued; otherwise it is created queued, and
is moved to pending_approval when it is about to run if its environment has
requiresApproval: true. Either way it answers 201, and the row waits for a
user to approve it. The environment’s setting is read from the pipeline at the
commit being retried. Static targets are unchanged.
Roll back to a deployment
Section titled “Roll back to a deployment”POST /api/deployments/{id}/rollback
Creates a new deployment of the same name and commit as {id}, with
rollbackOf set, and enqueues it. Answers 201 with the new row. {id} must
be succeeded.
A rollback redeploys an earlier version. It does not undo a database migration: migrations are forward-only, and the earlier version runs against the schema as it is now.
Requires project write access and a user identity, exactly as approve
does; the caller becomes the new row’s approvedBy, so it does not then wait
for approval.
401— nouserIdon the request (anonymous, or an agent token).403— a user who cannot write to the deployment’s project.409 DEPLOYMENT_NOT_ROLLBACKABLE—{id}is notsucceeded.409 DEPLOYMENT_RETRY_EXISTS— another retry or rollback took the attempt number at the same moment. Try again.503 DEPLOY_QUEUE_UNAVAILABLE— as above.
The rollback is an ordinary deployment from there on: it waits for the
environment, supersedes deployments of it that are still queued or
pending_approval, and never promotes to a later environment. Audited as
deployment.rolled_back, with the environment, commit, rollbackOf and
version.
A form-encoded caller must send confirm=yes. Without it the answer is a 302
to the confirmation page (/{namespace}/{slug}/deployments/{id}/rollback) and
nothing happens; with it, a 302 to the new deployment. JSON callers send no
confirmation.
Read a pipeline deployment’s log
Section titled “Read a pipeline deployment’s log”GET /api/deployments/{id}/log
The full output of every step the deployment has run, in order, as
text/plain. Project writers only. Available while the job runs and
afterwards.
404 LOG_NOT_AVAILABLE— not a pipeline deployment (a static target has onlylogTail).404 LOG_NOT_FOUND— nothing has been stored yet.503 CI_EXECUTOR_UNAVAILABLE— the instance has no CI executor, or it could not be reached.
Report a deployment (CI executor callback)
Section titled “Report a deployment (CI executor callback)”POST /api/deploy-reports/{id}
Called by the instance’s CI executor when a pipeline deployment’s job ends, not
by API clients. There is no bearer token: the request is authenticated by
X-Stratum-Signature, sha256= followed by the hex HMAC-SHA256 of the raw
body under CI_EXECUTOR_SECRET.
{ "deploymentId": "dep_…", "commitSha": "…", "environment": "staging", "status": "succeeded", "steps": [{ "name": "migrate", "status": "passed" }, { "name": "deploy", "status": "passed" }], "version": "0f1e2d3c-…", "url": "https://my-app-staging.example.workers.dev", "logTail": "…"}401 INVALID_SIGNATURE— missing or wrong signature. Checked before the deployment is looked up, so it does not reveal which ids exist.400 INVALID_REPORT— signed, but malformed, ordeploymentIdis not the id in the URL.409 DEPLOYMENT_NOT_RUNNING— no running pipeline deployment with this id for this commit: it already finished, was given up on, or was never dispatched. Not retryable.
version is stored only for a succeeded deployment and only if it is a short
label; url only if it is an https URL.
Events
Section titled “Events”Deployments emit deployment.requested, deployment.succeeded and
deployment.failed onto the project’s event stream; all three are subscribable
from a project webhook.
Agents API
Section titled “Agents API”An agent is a non-human contributor registered by a user. It authenticates with an agent token and inherits its owner’s project access. See Authentication for how agent tokens differ from a user’s scoped API tokens.
List Agents
Section titled “List Agents”GET /api/agents
Create Agent
Section titled “Create Agent”POST /api/agents
Returns the new agent alongside its token as token — the only time the
plaintext is ever returned. Neither GET /api/agents nor GET /api/agents/{id}
includes it, and there is no way to re-read it; a lost token means deleting the
agent and registering a new one.
Agent tokens do not expire and are not scoped. The only way to revoke one is to delete the agent.
This route therefore requires a browser session or the legacy API key. A scoped
API token or an OAuth grant is refused with 403 SESSION_REQUIRED: otherwise
revoking that credential would leave behind an agent token it minted. (A
read-only one never reaches that check; the scope check refuses it first with
403 TOKEN_SCOPE_INSUFFICIENT.)
Get Agent
Section titled “Get Agent”GET /api/agents/{id}
Delete Agent
Section titled “Delete Agent”DELETE /api/agents/{id}
Deletes the agent row, which is what revokes its token — the only revocation
path for a credential that never expires. Requires the owning user’s identity:
401 without a user identity (an agent token sets agentId and never userId,
so an agent cannot delete itself or any sibling), 403 for a user who is not
the owner, 404 for an unknown id. Audited as agent.revoked.
Deleting the owning user’s account revokes their agents too, as part of the account cascade (Delete Account).
Users API
Section titled “Users API”Token management is covered in full — scopes, expiry, limits, and the legacy credential — in Authentication.
Get Current User
Section titled “Get Current User”GET /api/users/me
Returns the authenticated user’s profile, with "actingAs": "user": id,
email, username (the caller’s personal namespace is @username) and
createdAt.
{ "id": "usr_…", "email": "alice@example.com", "username": "alice", "createdAt": "…", "actingAs": "user" }An MCP OAuth grant bound to an agent gets the agent and the owner it acts for instead. The owner’s email is not included:
{ "actingAs": "agent", "agent": { "id": "agt_…", "name": "Claude Code on my-laptop" }, "owner": { "id": "usr_…", "username": "alice" }}A bare agent token (stratum_agent_…) gets 401.
Get Current Usage
Section titled “Get Current Usage”GET /api/users/me/usage
The caller’s metered usage against their plan for the current billing period:
each meter’s consumption and limit, the rate ceilings, the period, and when it
resets. A limit of -1 is unlimited and 0 is a plan that forbids that meter
outright, so a client renders words rather than computing a percentage against
either.
Read-only, and deliberately the only billing surface a token can reach: there is no endpoint here to raise a limit, buy capacity, or attach a payment method. An agent token reports its owner’s allowance, because that is the account its evaluations are charged to.
Figures cover platform-billed usage only. Spend on a project’s own provider key
(BYOK) is reported separately and never counted against an allowance. On an
instance with no billing service configured — every self-hosted deployment —
metered is false and every limit is unlimited.
API tokens
Section titled “API tokens”Listing, creating, revoking, and disabling the legacy token accept the
browser session cookie only. An API token calling those gets
403 SESSION_REQUIRED, whatever its scope — a token that could mint or revoke
tokens would make revocation meaningless. rotate-token is the exception and
has its own rule, described with it below.
List Tokens
Section titled “List Tokens”GET /api/users/me/tokens
Shows each token’s name, scope, expiry, lastUsedAt, and non-secret prefix,
and — for a token bound to a project or organization — a binding object
(kind, the target’s id, and a readable label such as @alice/web). An
account-wide token has no binding. The plaintext is never listed again.
Create Token
Section titled “Create Token”POST /api/users/me/tokens
{ "name": "buildkite", "scope": "read", "expiresInDays": 90 }scope is read (default) or read_write. expiresInDays is 1–365; omit for
a token that never expires. The plaintext is returned exactly once, by this
call, with Cache-Control: no-store. 409 TOKEN_LIMIT_REACHED past 20 active
tokens.
To limit the token to one project or one organization’s projects, add one of:
{ "name": "deploy-bot", "scope": "read_write", "project": "@alice/web" }{ "name": "acme-ci", "scope": "read", "org": "acme" }You must be able to read the project, or be a member of the organization;
otherwise 404, exactly as for one that does not exist. Both at once is a
400. A bound token is refused (403 TOKEN_BINDING_EXCLUDES_ROUTE) on every
endpoint outside the project surfaces — see
Project and organization binding.
Revoke Token
Section titled “Revoke Token”DELETE /api/users/me/tokens/{id}
Revoked rows are kept, so the audit trail survives revocation, and they do not count toward the 20-token limit.
Disable the Legacy Token
Section titled “Disable the Legacy Token”POST /api/users/me/legacy-token/disable
Permanently disables the single unnamed credential every account carries on its
user row (minted at signup; revealed only by rotate-token). Named tokens are
unaffected. Cannot be undone — move anything still using it onto a named
token first.
Rotate the Legacy Token
Section titled “Rotate the Legacy Token”POST /api/users/me/rotate-token
Accepts a browser session or the legacy credential itself, but refuses a
scoped token with SESSION_REQUIRED. The key it mints never expires and
cannot be revoked individually, so letting a scoped token rotate it would mean
revoking that token contained nothing — it could have issued itself a permanent
replacement on the way out.
Passkeys
Section titled “Passkeys”Passkeys (WebAuthn) are the second factor of browser sign-in. See
Passkeys and two-factor sign-in. Every endpoint
below accepts the browser session cookie only (403 SESSION_REQUIRED for a
token). Registering, removing, and regenerating recovery codes also need a
session from the last 15 minutes that used the account’s existing passkey, if it
has one. Otherwise they return 403 REAUTHENTICATION_REQUIRED.
GET /api/users/me/passkeys— the passkeys (name, created, last used) andrecoveryCodesRemainingPOST /api/users/me/passkeys/registration/options— WebAuthn creation options fornavigator.credentials.create(); the challenge is single-use and expires after 5 minutesPOST /api/users/me/passkeys/registration/verify—{ "name": "Laptop", "response": <RegistrationResponseJSON> }; on the first passkey the201also carries ten one-timerecoveryCodes, shown oncePATCH /api/users/me/passkeys/{id}—{ "name": "…" }DELETE /api/users/me/passkeys/{id}— removing the last passkey also deletes the recovery codesPOST /api/users/me/passkeys/recovery-codes— replace the recovery codes
Delete Account
Section titled “Delete Account”DELETE /api/users/me
GDPR-grade account erasure. Deletes the caller’s account and all owned
projects, revokes all tokens/sessions (and the user’s agents), deletes the
GitHub authorization stored for a
connected GitHub account and asks
GitHub to revoke it, and anonymizes
the user’s contributions to other people’s projects (author set to a
deleted-user tombstone — the contribution stays, the identity is removed).
Audit log entries are kept, with the account’s id and email replaced by
deleted-user where they are the actor, the subject, or a complete string value
in the entry’s detail. An id or email inside longer free text is not rewritten,
and neither are usernames.
Requires confirmation with the caller’s own username:
{ "confirm": "<your-username>" }Setting deletion immediately invalidates the caller’s credentials (subsequent
requests return 401). Returns 202 Accepted with
{ "status": "deleting", "jobId": "del_…" }; the cascade runs asynchronously and
always completes (org sole-ownership is auto-resolved, never blocking erasure). A
mismatched confirm returns 400.
Organizations API
Section titled “Organizations API”List Organizations
Section titled “List Organizations”GET /api/orgs
Create Organization
Section titled “Create Organization”POST /api/orgs
SSO Connection (org admins/owner)
Section titled “SSO Connection (org admins/owner)”PUT /api/orgs/:slug/sso— create or replace the org’s OIDC connectionGET /api/orgs/:slug/sso— read the connection (secrets redacted)DELETE /api/orgs/:slug/sso— delete the connectionPOST /api/orgs/:slug/sso/verify-domains— verify email domains via DNS TXTPOST /api/orgs/:slug/sso/enable— enable (requires verified domains)POST /api/orgs/:slug/sso/disable— disablePOST /api/orgs/:slug/sso/scim-token— rotate the SCIM bearer token
See the OpenAPI specification for full request/response shapes, and Authentication for the SCIM token class.
Security policy
Section titled “Security policy”GET /api/orgs/:slug/security— read the policy (any member). For an admin or the owner, the response also carriessecondFactorImpact.PUT /api/orgs/:slug/security—{ "requireSecondFactor": true }(admins/owner). Either field (requireSecondFactor,ipAllowlist) may be sent alone.
With requireSecondFactor on, a member’s browser session reaches this org’s
projects and /api/orgs/:slug/ endpoints only if it passed a passkey check or
signed in through this org’s own SSO. Otherwise those requests return
403 SECOND_FACTOR_REQUIRED. The policy never affects members’ personal
projects, other orgs, or account settings. See
Passkeys and two-factor sign-in. Turning it on
returns 409 ADMIN_SECOND_FACTOR_REQUIRED until you have a passkey yourself.
API tokens, the legacy key, agent tokens, OAuth grants and workspace remote
credentials are held to the same policy when they are used, by how the
session that created them had signed in. Each credential records that. One
created from a session with a second factor meets every org’s policy; one
created from a session that signed in through this org’s SSO meets this org’s;
any other, including every credential created before this was recorded, meets
none. A credential that does not meet the policy gets
403 SECOND_FACTOR_REQUIRED on this org’s projects (including git clone and
push) and /api/orgs/:slug/ endpoints, and keeps all of its other access.
Creating it again from a session that meets the policy restores access. See
Using credentials.
secondFactorImpact counts the members’ live credentials the policy refuses:
{ members, apiTokens, agents, oauthGrants, accountKeys }. Read it before
turning the policy on. accountKeys is an upper bound, because a disabled
legacy key cannot be told from a live one.
The policy also applies when a credential is created: a session that has not
met it cannot mint an unbound API token, a token bound to this org or its
projects, an agent token, a rotated legacy key, or an OAuth grant (MCP/CLI
consent). Those requests return 403 SECOND_FACTOR_REQUIRED. Tokens bound to
other targets are unaffected. See
Creating credentials.
IP allowlist
Section titled “IP allowlist”PUT /api/orgs/:slug/security—{ "ipAllowlist": ["203.0.113.0/24", "2001:db8::/32"] }(admins/owner).[]removes the restriction.
When the list is non-empty, requests from outside it cannot use the access the
org grants. This covers its projects (including git clone and push), its
/api/orgs/:slug/ endpoints, and creating projects in it. Every credential is
covered: sessions, API tokens, agent tokens, and OAuth grants. Those requests
return 403 IP_NOT_ALLOWED, with org and the ip Stratum saw. A caller who is
not a member gets the usual 404 instead. Anonymous reads of public projects,
the SSO sign-in flow, SCIM, and leaving the org are not restricted. The client
address comes from CF-Connecting-IP only, and a request without it is refused.
Entries are IPv4 or IPv6 addresses or CIDR ranges, at most 100. They are returned
in canonical form. Saving a list that excludes your own current address returns
409 IP_ALLOWLIST_SELF_LOCKOUT; add "allowSelfLockout": true to save it
anyway. Changes are audited as org.ip_allowlist_changed. Refusals are audited
as org.ip_access_denied, at most once per member per org every 10 minutes. See
Organization IP allowlists.
Members and teams
Section titled “Members and teams”Any member can leave with DELETE /api/orgs/:slug/members/<own user id>, even
when the org’s second-factor policy or IP allowlist blocks them. The owner cannot leave
(409 OWNER_CANNOT_LEAVE). Removing anyone else requires an org admin.
Members and teams are managed under /api/orgs/{slug}/members and
/api/orgs/{slug}/teams — add and remove a member, create, list and delete a
team, and add and remove a team’s members. See the
OpenAPI specification for the exact routes and schemas.
Every add, removal, and role change of a member, and every team created, deleted, joined, or left, is recorded in the org’s audit log below.
Audit log (org admins/owner)
Section titled “Audit log (org admins/owner)”GET /api/orgs/:slug/audit— one page of the org’s audit trail, newest firstGET /api/orgs/:slug/audit/export— the same entries as an NDJSON download
Plain members get 403; non-members get the same 404 as a missing org.
A token bound to a project or organization is refused with 403 TOKEN_BINDING_EXCLUDES_ROUTE, even one bound to this org: reading the audit
log is org administration, so use a session or an unbound token.
What lands in an org’s trail. Events about the org itself (creation,
member added/removed, role changed, teams and team membership, SSO connection
and SCIM token administration, SCIM provisioning), failed SSO sign-ins against
the org’s connection, and events on projects the org owns (forced merges,
dismissed approvals, manual conflict resolutions, webhooks, branches, deploy
secrets, deployment approvals and retries, deletion requests). Account-level
events — a user’s own tokens, sessions, agents — belong to no org and appear
only in the instance-wide GET /api/admin/audit. Entries recorded before org
scoping shipped carry no org and are likewise instance-only.
Filters. action, actor (actor id), since (inclusive) and until
(exclusive, both ISO-8601). Malformed values are a 400, never silently
ignored.
Pagination. limit (1–500, default 100). The response is
{ "entries": [...], "nextCursor": "..." }; pass nextCursor back as
cursor for the next, older page. It is absent on the last page. Cursors are
keyset-based, so pages stay stable while new events are appended.
curl -H "Authorization: Bearer $STRATUM_TOKEN" \ "https://app.usestratum.dev/api/orgs/acme/audit?action=org.member.role_changed&limit=50"Export. GET /api/orgs/:slug/audit/export (or ?format=ndjson on the read
route) streams one JSON entry per line for the window [since, until).
until defaults to now and since to 30 days earlier; a window longer than
90 days is refused with 400, so export long periods in consecutive windows.
If storage fails partway through, the download is aborted rather than cut
short, so a file that completes is a complete window.
curl -H "Authorization: Bearer $STRATUM_TOKEN" -o acme-audit.ndjson \ "https://app.usestratum.dev/api/orgs/acme/audit/export?since=2026-10-01T00:00:00Z&until=2026-11-01T00:00:00Z"Failed sign-ins. An auth.failed entry is written only when the attempt
identifies something real — for an org, an SSO callback that reached its
connection with a valid sign-in state (bad or expired ID token, nonce
mismatch, email outside the verified domains, a disabled account). Repeats
for the same account or connection are collapsed to at most one entry per
minute.
Who an entry is about. An entry’s subject is the thing acted on, never a
person: member and role events carry the org id (team membership events the
team id), and SCIM provisioning events carry the SSO connection id. The member
or provisioned user is named in detail.userId. Entries written before this
change carried the user id in subject.
Immutability. The audit log is append-only: there is no API to edit or
delete an entry, and the database rejects updates and deletes. The single
exception is account erasure, which replaces the erased person’s id and email
with deleted-user — in the actor, the subject, and any complete value in
detail — and changes nothing else. The database accepts every such rewrite
only to the deleted-user sentinel, and the subject and detail rewrites only for
an account that is being deleted.
GitHub App installations
Section titled “GitHub App installations”When the instance runs a GitHub App, outbound GitHub calls for a project —
pushing a promoted change’s branch, sync, and evaluation comments and statuses
— use the app’s installation token for the repository only if that installation is linked to
the project’s owner, or an operator binding names that
owner for the repository’s GitHub owner. A project’s source URL is whatever
its owner typed, so without one of the two anyone could import another
organization’s repository and have Stratum push to it with that organization’s
installation. An installation that is neither linked nor covered by a binding
grants nothing, and a caller the installation refuses is not handed the
instance-wide GITHUB_TOKEN instead: that credential is reserved for owners the
operator binds explicitly.
One call at promotion is not always the app’s. The pull request itself is created with the promoting person’s own GitHub authorization when they have connected their GitHub account and it can be used, so that GitHub records them as its author, and with the installation token otherwise. See Promote to a GitHub PR for the rule.
A push mirror uses the app too, and only
the app: it never falls back to GITHUB_TOKEN. For each push it asks for an
installation token limited to the mirror repository, so the app needs the
Contents: read and write repository permission there, and Workflows: read
and write if the project has files under .github/workflows/. A project that
mirrors to a repository holds it as its canonical project, exactly as a project
imported from it does.
The same rule decides which project receives a repository’s webhook events
(push, pull request, review), and every repository has one canonical
project. The first authorized project to act on a repository, or to receive
an event for it, claims it. Another project naming the same repository can
neither receive its events nor push or report to it, until the holder is
deleted or loses its authorization. A promotion from a non-canonical project
answers 409.
Linking proves control on GitHub, not just in Stratum, and proves it at the moment of linking. Stratum sends you to GitHub to authorize the app, then asks GitHub what you manage right now:
- An installation on a GitHub organization can be linked by a current
owner of that organization: an active member whose role is
admin. - An installation on a personal GitHub account can be linked by that account.
GitHub must also list the installation as one you can reach. An installation on any other kind of account (an enterprise) cannot be linked; use an operator binding. Who installed the app is recorded for the audit trail and decides nothing: an owner who did not install it can link it, and someone who installed it and has since left the organization, or lost the owner role, cannot. The GitHub account that authorizes must be the one connected to your Stratum account; sign in with GitHub once to connect one.
The answer is used for that one request. Stratum does not store the GitHub user token a link round trip gives it, does not log it, and asks GitHub to revoke it before the request ends. (The only GitHub user token Stratum keeps is the one a person stores by connecting their account, which linking neither reads nor changes.) A link, once made, is not re-checked when someone later leaves the GitHub organization; unlink it, or suspend or uninstall the app on GitHub.
Linking is off until the operator sets GITHUB_APP_CLIENT_ID and
GITHUB_APP_CLIENT_SECRET (the GitHub App’s own client ID and secret, not the
sign-in OAuth app’s). Without both, every link attempt is refused with 501
NOT_CONFIGURED. There is no weaker rule to fall back to. Unlinking, and links
that already exist, keep working.
The setup page
Section titled “The setup page”/github/app/setup lists the installations linked to you or to an org you
administer, with a form to link, move, or unlink each. It needs no JavaScript.
- Find installations I can link asks GitHub which installations you manage and lists them (up to 30), for that browser session, for ten minutes. The list is a convenience: every link is still confirmed with GitHub when you make it, and an installation it leaves out can be linked by its number.
- Arriving with
?installation_id=N, as GitHub sends you after installing, offers that installation by number. Nothing about it is shown until GitHub confirms it is yours.
Each link is one round trip: the form posts to Stratum, Stratum redirects to
GitHub’s authorization page, and GitHub returns to /github/app/callback,
which lands you back on the setup page with the outcome. If the app is already
authorized for your GitHub account, GitHub returns at once without a prompt.
Users only. These endpoints are unreachable with a project- or org-bound token.
Acting on an organization (linking to it, unlinking from it, moving a link
away from it) takes an admin of that org whose session meets its
second-factor policy. Otherwise the request is refused with 403
SECOND_FACTOR_REQUIRED, and the org is not offered as a link target.
List installations
Section titled “List installations”GET /api/github/installations
Installations linked to you or to an org you administer. A browser session also sees the installations GitHub said it could link the last time it asked from the setup page, for ten minutes; an API token never does.
{ "githubLinked": true, "linkingConfigured": true, "installations": [ { "installationId": 777, "account": { "login": "acme", "type": "Organization" }, "suspended": false, "linkedTo": null, "canLink": true, "canUnlink": false } ]}linkingConfigured is false when the operator has not set the two variables
above. canLink means only that this caller may start a link (a browser
session, with a GitHub account connected, on a deployment where linking is
configured); GitHub is asked afresh every time. It is always false for an API
token.
Link an installation
Section titled “Link an installation”POST /api/github/installations/{installationId}/link
{ "org": "acme" }Starts the round trip; it links nothing by itself. Omit org (or send "") to
link the installation to your personal account. It needs a browser session:
an API token cannot be walked through GitHub’s authorization page.
A form post is answered with a 303 to GitHub. A JSON request is answered with
the URL to send the browser to:
{ "ok": true, "authorizeUrl": "https://github.com/login/oauth/authorize?client_id=…&redirect_uri=…&state=…" }Refused before anyone is sent to GitHub (a form post gets a 303 back to the
setup page carrying the same code as ?notice=, in lower case):
| Status | code | Meaning |
|---|---|---|
501 | NOT_CONFIGURED | The operator has not set GITHUB_APP_CLIENT_ID and GITHUB_APP_CLIENT_SECRET |
403 | BROWSER_REQUIRED | The request was authenticated by a token, not a browser session |
403 | GITHUB_ACCOUNT_REQUIRED | Your Stratum account has no GitHub account connected |
400 | BAD_TARGET | org is not an org you administer |
403 | SECOND_FACTOR_REQUIRED / IP_NOT_ALLOWED | The target org’s policy is not met by this session |
This request says nothing about the installation itself, so an installation id cannot be probed with it: an id that does not exist is answered the same as one that does.
The callback
Section titled “The callback”GET /github/app/callback
The GitHub App’s Callback URL. GitHub returns here with a code and the
state Stratum issued. The state is single-use, expires after ten minutes,
and is bound to the browser session that started the link: presented twice, or
in any other session, it is refused and nothing changes. Stratum then exchanges
the code, checks your current access as described above, and redirects (303)
to /github/app/setup?notice=<code>:
notice | Meaning |
|---|---|
linked | The installation is linked |
access_checked | (From Find installations I can link) the list was refreshed |
not_found | GitHub does not list that installation for you, or it does not exist. The two are deliberately indistinguishable |
not_authorized | You do not manage the account it is installed on right now: GitHub lists it for you but you are not an owner of that organization (or are not that personal account), or you hold its Stratum link and GitHub no longer lists it for you |
linked_elsewhere | It is linked to a Stratum owner you do not hold. Moving a link takes the current owner, or an admin of the current owner’s org, as well as control on GitHub |
bad_target | You stopped administering the target org while at GitHub |
second_factor_required / ip_not_allowed | An org policy on the target, or on the org the link is being moved away from, is not met |
github_account_mismatch | You authorized as a different GitHub account than the one connected to your Stratum account |
authorization_denied | You cancelled on GitHub |
state_invalid | The state was missing from this session, expired, or already used |
github_unavailable | GitHub could not be asked. Nothing is linked on a guess; try again |
not_configured | The operator removed the credentials mid-flight |
Stratum reads at most 10 pages of 100 from each of the two GitHub lists it
consults: the installations GitHub lists for you, and your organization
memberships. Past that it stops. An installation beyond the first 1,000 that
GitHub lists for you is answered not_found, and an organization beyond your
first 1,000 active memberships is answered not_authorized, exactly as if
GitHub had not listed it.
Each installation serves one Stratum owner. Controlling the GitHub account never lets you take a link away from the Stratum account its admins chose: they unlink it first.
A callback that carries a code but no state is the redirect GitHub makes
straight after an install. Stratum does not redeem that code. It sends you to
the setup page for that installation, where you link it with a round trip of
your own.
Unlink an installation
Section titled “Unlink an installation”POST /api/github/installations/{installationId}/unlink
Allowed for the linked user, or an admin of the linked org. The installation’s repositories then serve no project until it is linked again (or an operator binding covers them).
Connect a GitHub account
Section titled “Connect a GitHub account”Separate from installations: this is one person letting Stratum open the pull requests they promote as them, so that GitHub records them as the author and not the app. See Who the pull request is opened as.
POST /github/app/connect
A browser session only. Redirects to GitHub to authorize the app, and GitHub
returns to the same callback as linking. The account that
authorizes must be the GitHub account the Stratum account signs in with;
anything else is refused and the authorization revoked. On success Stratum
stores the user access token, and the refresh token when the app issues expiring
tokens, encrypted with GITHUB_USER_TOKEN_SECRET. This is the only GitHub user
token Stratum keeps: the token a link round trip uses is still revoked before
that request ends.
POST /github/app/disconnect
A browser session only. Deletes the stored authorization and asks GitHub to
revoke the token. The same happens when the account is deleted. The stored
authorization is also deleted, with nothing left to revoke, when GitHub reports
that the person revoked the app (github_app_authorization webhook), when
GitHub refuses to renew it, and when GitHub answers 401 for it at a
promotion.
Both end with a redirect to /settings#github carrying a fixed notice code.
There is no JSON form of either. They need GITHUB_APP_CLIENT_ID,
GITHUB_APP_CLIENT_SECRET and GITHUB_USER_TOKEN_SECRET; without all three
the settings card is not shown, connecting is refused, and every pull request
is opened with the instance’s own credential.
Stored authorizations are deliberately left out of database backups. After a restore, people connect again.
Operator bindings
Section titled “Operator bindings”GITHUB_ALLOWED_OWNERS binds a GitHub owner to the Stratum owner allowed to
act on its repositories without an installation link. It is a comma-separated
list of entries naming the Stratum owner by id:
GITHUB_ALLOWED_OWNERS = "acme=org:org_0123abcd,acme-labs=user:usr_4567ef01"An entry admits only projects owned by that org or user, or by an agent whose
owner is that user. It covers the GitHub App on those repositories and is the
only way a project can use the instance GITHUB_TOKEN.
Ids are used rather than @namespace names because a namespace can be renamed
or deleted and then claimed by someone else, who must not inherit the binding.
Any other entry, including githubOwner=@namespace, is ignored, with a warning
in the logs. It does not admit every project. Members can read an org’s id
from GET /api/orgs/{slug} (org.id), and their own from GET /api/users/me.
The former name, GITHUB_APP_ALLOWED_OWNERS, is still read, and the two lists
combine.