Decide whether a pull request may merge (viewer or above, or an integration token with checks:read)
const url = 'http://127.0.0.1:8080/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/merge-check';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"head_ref":"example","head_sha":"example","base_ref":"example","pull_request":1,"files":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:8080/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/merge-check \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "head_ref": "example", "head_sha": "example", "base_ref": "example", "pull_request": 1, "files": [ "example" ] }'The caller sends the branch and the changed files. Everything else comes from the coordinator’s own state, read in one snapshot. The call writes nothing. Session tokens are refused, so an agent cannot probe its own gate.
A head_ref of zentri/<slug>-<id8> names the project session
whose ID ends in <id8>, ended sessions included. A leading
refs/heads/ is dropped. The check fails when any rule holds:
session: a ref underzentri/names no session, more than one, or does not have that shape.unclaimed: a changed file has no claim row of the branch’s session. Released and expired claims count.held: another session holds a live claim on a changed file.duplicate: the session’s intent was registered asactive_duplicatewithrun_anyway, and the intent it matched is still active.decision: the session has a high-risk decision that isproposed, orrejectedand not superseded by an accepted decision of the same session (ADR-0009).
Any other branch is checked for held only, and the summary says so.
A path that cannot be normalized for claims, such as one over 1024
bytes, can never be claimed, so it is unclaimed on a session
branch.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The pull request’s branch. Untrusted. It must be a valid git branch name.
The commit checked. Only echoed by callers; the verdict does not read it.
The branch the pull request merges into. It must be a valid git branch name.
Changed paths, relative to the repository root. A rename lists its old and its new path. Each is valid UTF-8 without control characters, with no empty, ., or .. segment.
Example generated
{ "head_ref": "example", "head_sha": "example", "base_ref": "example", "pull_request": 1, "files": [ "example" ]}Responses
Section titled “Responses”The verdict. A failure is still a 200.
object
Failure exactly when findings is not empty.
Markdown for a check run or a job summary. Paths are shown as code spans.
The session the branch names, or null.
object
The changed file as sent. Null for session, duplicate, and decision.
The branch’s session for unclaimed and decision, the holder for held, and the session running the matched intent for duplicate.
That session’s intent, or the matched intent for duplicate.
Decision only: the high-risk decision that blocks the merge.
Findings left out of findings.
Example
{ "conclusion": "success", "findings": [ { "rule": "session" } ]}The request is malformed.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}No valid bearer token.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The token may not do this.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}No such resource in the caller’s org.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The body is over 1 MiB.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}A rate limit or quota stopped the request. Retry-After gives seconds to wait.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}