Approvals
Runs waiting for approval, and approving or rejecting them.
Every path is under /api/v1; see the API for authenticating, errors and rate
limits, and the schemas for the bodies.
Runs that wait to deploy, across the projects the caller can read runs of (org:read)
GET /api/v1/orgs/{org}/approvals
| Parameter | In | Description |
|---|---|---|
org |
path | ID |
mine |
query | boolean: true keeps the runs the caller may approve or reject now. |
Answers:
200: OK, WaitingDeployList
Errors: 401, 404 (how errors look).
Follow how many runs wait to deploy (org:read)
GET /api/v1/orgs/{org}/approvals/stream
Server-sent events. A count event, its data {"waiting": N, "mine": M} (all the runs that wait to deploy that the caller can see, and those the caller may decide now), comes
first and whenever a number changes. An error event means reading failed; reconnect.
Streams close after 30 minutes and are authorized again on reconnect. Comments (: ping)
keep idle streams open.
| Parameter | In | Description |
|---|---|---|
org |
path | ID |
Answers:
200: An event stream, string
Errors: 404 (how errors look).
The project's runs that wait to deploy (run:read)
GET /api/v1/projects/{project}/approvals
| Parameter | In | Description |
|---|---|---|
project |
path | ID |
mine |
query | boolean: true keeps the runs the caller may approve or reject now. |
Answers:
200: OK, WaitingDeployList
Errors: 401, 403, 404 (how errors look).
The reviewers' decisions on a run that deploys to an environment (project:read)
GET /api/v1/runs/{run}/approvals
| Parameter | In | Description |
|---|---|---|
run |
path | ID |
Answers:
200: Oldest first, object with the fields below
| Field | Type | Description |
|---|---|---|
approvals |
array of RunApproval, required |
Errors: 404 (how errors look).
Approve or reject a run that waits for a deploy approval
POST /api/v1/runs/{run}/approvals
The run must be waiting_approval and not yet approved (409 not_waiting_approval). The
caller needs environment:approve in the project and, when the environment lists required
reviewers, must be one of them or hold one of their roles (403). With prevent_self_review
whoever started the run can't approve it (403 self_review). Each reviewer decides once (409
already_decided). A reject rejects the run at once; min_approvals approvals start its wait
timer, or queue it. Audited as environment.approve / environment.reject.
| Parameter | In | Description |
|---|---|---|
run |
path | ID |
Body (application/json): object.
| Field | Type | Description |
|---|---|---|
comment |
string | |
decision |
one of approved, rejected, required |
Answers:
200: The run after the decision, Run
Errors: 403, 404, 409, 422 (how errors look).
Approve the commit of a run from a fork (git:approve)
POST /api/v1/runs/{run}/approve
The run must be awaiting_approval. Its commit is approved in the project: the run and the
project's other runs of the commit that await approval are queued, and later runs of the
commit (other triggers, retries, re-runs) don't wait. They still get no secrets. 409
not_awaiting_approval when the run doesn't wait, quota_exceeded when the organization
has too many queued runs.
| Parameter | In | Description |
|---|---|---|
run |
path | ID |
Answers:
200: The run after the approval, Run
Errors: 403, 404, 409 (how errors look).