{"openapi":"3.1.0","info":{"title":"ChangeBox Client API","version":"1.0.0","description":"Read and work an organization's change queue from your own tools. Authenticate with an org API token (`Authorization: Bearer cbk_…`). Scopes: `read` (list/inspect), `operator` (claim, comment, status, PR, agent), `approve` (decide gates), `admin` (also manage tokens and integrations). Errors are `{ error, code }`; every response is `cache-control: no-store`."},"servers":[{"url":"https://changebox.ai"}],"security":[{"bearer":[]}],"tags":[{"name":"me"},{"name":"apps"},{"name":"changes"},{"name":"audit"},{"name":"baseline"},{"name":"tokens"},{"name":"integrations"},{"name":"failures"},{"name":"intake"}],"paths":{"/api/v1/approvals":{"get":{"tags":["changes"],"summary":"Open gates (approval queue)","description":"Scope: read. Every pending Build and Ship gate in the organization, newest first, each with its change. The feed for Slack cards, the widget's Approvals tab, or an approver working from Cursor.","parameters":[{"name":"gate","in":"query","schema":{"type":"string","enum":["build","ship"]}},{"name":"app","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":200}}],"responses":{"200":{"description":"{ approvals: (Approval & { change: Change })[] }. Build gates include `plan` when the agent has drafted one."}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/apps":{"get":{"tags":["apps"],"summary":"List apps","description":"Scope: read.","responses":{"200":{"description":"Apps with repositories and environments.","content":{"application/json":{"schema":{"type":"object","properties":{"apps":{"type":"array","items":{"$ref":"#/components/schemas/App"}}}}}}}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/apps/{appId}/config":{"get":{"tags":["apps"],"summary":"App configuration","description":"Scope: read. The app's configuration as JSON-LD. Without `doc`, the whole graph; with it, one standalone document. Read-only; no secrets.","parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}},{"name":"doc","in":"query","schema":{"type":"string","enum":["app","policy","agents","review","verify","people","integrations","signals"]}}],"responses":{"200":{"description":"JSON-LD graph or document.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/audit":{"get":{"tags":["audit"],"summary":"Append-only audit log","description":"Scope: read. Every change event, gate decision, settings / secret / membership / token change and integration delivery in the organization, newest first, with actor (user, external id), channel (`via`), before/after and the change it concerns. `action` may be exact or a prefix ending in a dot (`gate.`). `format=csv` returns the page as a file; walk `page.nextCursor` for the rest.","parameters":[{"name":"app","in":"query","schema":{"type":"string"}},{"name":"change","in":"query","schema":{"type":"string"}},{"name":"action","in":"query","schema":{"type":"string"},"example":"gate.ship."},{"name":"actor","in":"query","description":"ChangeBox user id.","schema":{"type":"string"}},{"name":"via","in":"query","schema":{"type":"string","enum":["console","widget","slack","email","api","mcp","policy","webhook","cron","system"]}},{"name":"from","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"q","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":1000}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv"],"default":"json"}}],"responses":{"200":{"description":"{ events: AuditEvent[], page: { hasMore, nextCursor } } or text/csv"},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/baselines":{"post":{"tags":["baseline"],"summary":"Start the Baseline this organization paid for","description":"Scope: operator. Spends the organization's open Baseline order on its app: the audit runs on ChangeBox capacity under the order's cap. 409 when one is running or no order is left; 422 when no repository is connected.","responses":{"201":{"description":"{ baseline } — see GET /api/v1/baselines/{id}."},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/baselines/{id}":{"get":{"tags":["baseline"],"summary":"One Baseline","description":"Scope: read. Status (queued, mapping, auditing, synthesizing, done, error), created and finished times, scores, finding count, and how many of its agent runs are queued, running, done or failed. Another organization's id is a 404.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ baseline: { id, status, depth, createdAt, finishedAt, scores, findingCount, summary, error, runs } }"},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/changes":{"get":{"tags":["changes"],"summary":"List changes","description":"Scope: read. Defaults to every open change, newest activity first. `counts` honours `app` and `impact`.","parameters":[{"name":"status","in":"query","description":"Repeatable or CSV. `open` and `closed` are aliases.","schema":{"type":"string"},"example":"reported,in_progress"},{"name":"app","in":"query","schema":{"type":"string"}},{"name":"impact","in":"query","description":"Repeatable or CSV: broken, confusing, polish. Legacy words `blocking` → broken and `idea` → polish are accepted.","schema":{"type":"string"}},{"name":"q","in":"query","description":"Matches public id, description, expected, pathname, reporter email.","schema":{"type":"string"}},{"name":"since","in":"query","description":"ISO timestamp; only changes updated after it.","schema":{"type":"string","format":"date-time"}},{"name":"sort","in":"query","schema":{"type":"string","enum":["updated","reported","impact"],"default":"updated"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"cursor","in":"query","description":"`page.nextCursor` from the previous response. Not available with `sort=impact`.","schema":{"type":"string"}},{"name":"assignee","in":"query","description":"A member's user id, or `unassigned`.","schema":{"type":"string"}},{"name":"gate","in":"query","description":"Only changes waiting on a gate: `pending` (any), `build`, or `ship`.","schema":{"type":"string","enum":["pending","build","ship"]}}],"responses":{"200":{"description":"One page.","content":{"application/json":{"schema":{"type":"object","required":["changes","counts","page"],"properties":{"changes":{"type":"array","items":{"$ref":"#/components/schemas/QueueItem"}},"counts":{"$ref":"#/components/schemas/Counts"},"page":{"$ref":"#/components/schemas/Page"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"read"},"post":{"tags":["changes"],"summary":"File a change","description":"Scope: operator. File a change without the widget. A personal token files as its person when `reporter` is omitted.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"app":{"type":"string","description":"App id, name, or repository."},"description":{"type":"string"},"expected":{"type":"string"},"impact":{"$ref":"#/components/schemas/Impact"},"url":{"type":"string"},"context":{"type":"object","additionalProperties":true},"repository":{"type":"string"},"reporter":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"required":["email"]}},"required":["app","description"]}}}},"responses":{"201":{"description":"The new change.","content":{"application/json":{"schema":{"type":"object","properties":{"change":{"$ref":"#/components/schemas/QueueItem"}}}}}},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}":{"get":{"tags":["changes"],"summary":"One change with timeline, comments and screenshots","description":"Scope: read.","parameters":[{"$ref":"#/components/parameters/Ref"},{"name":"fileTtl","in":"query","description":"Seconds the signed screenshot URLs stay valid (60–86400, default 3600).","schema":{"type":"integer"}}],"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/changes/{ref}/agent":{"post":{"tags":["changes"],"summary":"Hand to a Cursor Cloud Agent","description":"Scope: operator. Optional `model` is a Cursor model id or alias from GET /api/v1/models; omitted uses the account default. 400 before intake when the id is not in this org's catalog (the error lists the available ids). 412 if the org has no Cursor key; 409 if the change is not open or no agent started.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","properties":{"model":{"type":"string","maxLength":80,"description":"Cursor model id or alias from GET /api/v1/models. Omit for the account default."}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/approvals":{"get":{"tags":["changes"],"summary":"Gate history","description":"Scope: read. Every Build and Ship gate on the change, oldest first: who decided it, through which channel (console, widget, slack, email, api, policy), and the note. `openGate` is the one waiting, if any.","parameters":[{"$ref":"#/components/parameters/Ref"}],"responses":{"200":{"description":"{ approvals: Approval[], openGate: Approval | null }. A Build gate carries `plan` and `planHash` (sha256) once the agent's Plan-mode run has finished — the text the approver is agreeing to."}},"security":[{"bearer":[]}],"x-scope":"read"},"post":{"tags":["changes"],"summary":"Decide a gate","description":"Scope: approve. Approving Build starts the agent — or, when a Plan-mode run already drafted a plan on the gate, tells that same agent to implement it. Approving Ship lets the change be marked live (required when the app's ship policy is `approver`). Rejecting Build closes the change as won't fix. Rejecting Ship sends it back to in progress and, when an agent built it, the note becomes its follow-up run. Every decision is a change_approvals row with decidedVia=api.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","required":["gate","decision"],"properties":{"gate":{"type":"string","enum":["build","ship"]},"decision":{"type":"string","enum":["approve","reject"]},"note":{"type":"string","description":"Required when rejecting Ship."}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"approve"}},"/api/v1/changes/{ref}/approve":{"post":{"tags":["changes"],"summary":"Approve the Build gate (alias)","description":"Scope: approve. Same as POST …/approvals with gate=build, decision=approve. Starts the Cursor agent if the organization has a key, the environment allows agents, and caps permit. Recorded as change.build_approved and a change_approvals row.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","properties":{"note":{"type":"string"}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"approve"}},"/api/v1/changes/{ref}/assign":{"post":{"tags":["changes"],"summary":"Assign to a person","description":"Scope: operator. Sets who is working the change without changing its status. Send `assignee: null` (or neither field) to clear.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"assignee":{"type":["string","null"],"description":"Display name of the person."},"userId":{"type":"string","description":"Console member id, when known."},"actor":{"type":"string","description":"Who is doing the assigning; defaults to the token name."}}}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/block":{"post":{"tags":["changes"],"summary":"Block","description":"Scope: operator. `note` is required.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteBody"}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/claim":{"post":{"tags":["changes"],"summary":"Claim → in_progress","description":"Scope: operator. Idempotent when already in progress. The claimer becomes the assignee unless someone already is.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActorBody"}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"409":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/comment":{"post":{"tags":["changes"],"summary":"Add a timeline comment","description":"Scope: operator.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","required":["message"],"properties":{"message":{"type":"string","maxLength":4000}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"400":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/evidence":{"get":{"tags":["audit"],"summary":"Evidence packet for one change","description":"Scope: read. Request as filed (with signed screenshot URLs), spec versions, policy decisions, approvals (who, when, via, note), agent runs, PR, release, reporter verification, plain-language timeline, the change's audit rows, and a `controls` summary (authorized, approvedToShip, selfApproved, reporterVerified). `integrity.hash` is sha256 over the canonical JSON (sorted keys, no whitespace) of every other field, so a saved packet can be checked against a fresh export.","parameters":[{"$ref":"#/components/parameters/Ref"}],"responses":{"200":{"description":"EvidencePacket"},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/changes/{ref}/intent":{"post":{"tags":["changes"],"summary":"Rewrite the intent","description":"Scope: operator. Any field omitted keeps its value. An approval already given no longer covers the change: the next gate action answers 409 until the gate is approved again.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","properties":{"goal":{"type":"string"},"constraints":{"type":"array","items":{"type":"string"}},"criteria":{"type":"array","items":{"type":"string"}},"allowedActions":{"type":"array","items":{"type":"string"}}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/links":{"get":{"tags":["changes"],"summary":"External records","description":"Scope: read. External records (issues, tickets) this change maps to.","parameters":[{"$ref":"#/components/parameters/Ref"}],"responses":{"200":{"description":"Links.","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"$ref":"#/components/schemas/ExternalLink"}}},"required":["links"]}}}},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/changes/{ref}/live":{"post":{"tags":["changes"],"summary":"Mark live","description":"Scope: operator. Legal from in_progress, in_review and pr_ready. From in_progress / in_review the change passes through pr_ready first (a `pr.ready` event is recorded, noting the PR or that none was linked) so every live change has a ship-gate row. Under an `approver` ship policy the Ship gate must already be approved, or the token needs the approve scope; otherwise 409 with code `gate`. The reporter is asked to confirm.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","properties":{"note":{"type":"string"},"prUrl":{"type":"string","format":"uri"}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"409":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/pr":{"post":{"tags":["changes"],"summary":"Link a pull request → pr_ready","description":"Scope: operator. Walks reported/reopened/failed/blocked → in_progress → pr_ready.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","required":["prUrl"],"properties":{"prUrl":{"type":"string","format":"uri"}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"400":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/review":{"post":{"tags":["changes"],"summary":"Send review findings to the builder","description":"Scope: operator. Hand the builder a follow-up. `instructions` (or `findings`) is used even when the stored review is clean.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","properties":{"instructions":{"type":"string","maxLength":4000},"findings":{"type":"string","maxLength":4000}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"409":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/status":{"post":{"tags":["changes"],"summary":"Set any legal status","description":"Scope: operator.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","required":["status"],"properties":{"status":{"$ref":"#/components/schemas/Status"},"note":{"type":"string"},"prUrl":{"type":"string","format":"uri"}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/verify":{"post":{"tags":["changes"],"summary":"Point or send the Verifier","description":"Scope: operator. `url` points the Verifier at a production page other than the one reported (must be on one of the app's known origins; an empty string clears it). `ask: true` sends the Verifier now. Either or both.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","properties":{"url":{"type":"string"},"ask":{"type":"boolean"}}}]}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/{ref}/wontfix":{"post":{"tags":["changes"],"summary":"Won't fix","description":"Scope: operator. `note` is required and shown to the reporter.","parameters":[{"$ref":"#/components/parameters/Ref"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteBody"}}}},"responses":{"200":{"$ref":"#/components/responses/ChangeEnvelope"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/changes/counts":{"get":{"tags":["changes"],"summary":"Per-status counts","description":"Scope: read.","parameters":[{"name":"app","in":"query","schema":{"type":"string"}},{"name":"impact","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Counts.","content":{"application/json":{"schema":{"type":"object","properties":{"counts":{"$ref":"#/components/schemas/Counts"}}}}}}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/failures":{"post":{"tags":["failures"],"summary":"Report a failure","description":"Scope: operator. An app, or an agent with an operator token, reports a structured failure; same body as the `changebox_report_failure` tool. `outcome: success` counts a successful run of that step and files nothing. 201 when a change is filed, 200 otherwise.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"app":{"type":"string"},"environment":{"type":"string"},"step":{"type":"string"},"errorClass":{"type":"string"},"message":{"type":"string"},"stack":{"type":"string"},"subjects":{"type":"object","additionalProperties":true},"occurredAt":{"type":"string","format":"date-time"},"severity":{"type":"string"},"kind":{"type":"string"},"outcome":{"type":"string"},"buildSha":{"type":"string"},"surface":{"type":"string"}},"required":["app","environment","step"]}}}},"responses":{"200":{"description":"Counted, nothing filed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureResult"}}}},"201":{"description":"A change was filed or is awaiting release.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureResult"}}}},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/intake":{"post":{"tags":["intake"],"summary":"Assistant protocol","description":"Scope: operator. The same assistant protocol as `/api/intake`, for a bearer token (MCP and server-side assistants). `identity` is the host-signed user.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["report","answer","status"]},"app":{"type":"string","description":"App id, name, or repository."},"changeId":{"type":"string"},"text":{"type":"string"},"draft":{"type":"object","additionalProperties":true},"capture":{"type":"object","additionalProperties":true},"reporterToken":{"type":"string"},"identity":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"signature":{"type":"string"},"exp":{"type":"integer"}}}},"required":["action","app"]}}}},"responses":{"200":{"description":"Answer or status.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"201":{"description":"Reported.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/integrations":{"get":{"tags":["integrations"],"summary":"List integrations","description":"Scope: admin. Connections (never secrets) and the catalog of kinds.","parameters":[{"name":"app","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Connections and catalog.","content":{"application/json":{"schema":{"type":"object","properties":{"integrations":{"type":"array","items":{"$ref":"#/components/schemas/Integration"}},"catalog":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}}},"security":[{"bearer":[]}],"x-scope":"admin"},"post":{"tags":["integrations"],"summary":"Connect an integration","description":"Scope: admin. Generated secrets are returned exactly once.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string"},"name":{"type":"string","maxLength":120},"appId":{"type":"string"},"config":{"type":"object","additionalProperties":true},"secret":{"type":"string"},"events":{"type":"array","items":{"type":"string"}}},"required":["kind"]}}}},"responses":{"201":{"description":"The connection.","content":{"application/json":{"schema":{"type":"object","properties":{"integration":{"$ref":"#/components/schemas/Integration"},"secret":{"type":"string"},"inboundSecret":{"type":"string"}},"required":["integration"]}}}},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"admin"}},"/api/v1/integrations/{id}":{"get":{"tags":["integrations"],"summary":"One integration","description":"Scope: admin.","parameters":[{"name":"id","in":"path","required":true,"description":"Integration id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The connection.","content":{"application/json":{"schema":{"type":"object","properties":{"integration":{"$ref":"#/components/schemas/Integration"}},"required":["integration"]}}}},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"admin"},"patch":{"tags":["integrations"],"summary":"Pause or resume an integration","description":"Scope: admin.","parameters":[{"name":"id","in":"path","required":true,"description":"Integration id.","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","paused"]}},"required":["status"]}}}},"responses":{"200":{"description":"The connection.","content":{"application/json":{"schema":{"type":"object","properties":{"integration":{"$ref":"#/components/schemas/Integration"}}}}}},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"admin"},"delete":{"tags":["integrations"],"summary":"Remove an integration","description":"Scope: admin. Deliveries and links go with it.","parameters":[{"name":"id","in":"path","required":true,"description":"Integration id.","schema":{"type":"string"}}],"responses":{"200":{"description":"Removed.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}},"security":[{"bearer":[]}],"x-scope":"admin"}},"/api/v1/integrations/{id}/deliveries":{"get":{"tags":["integrations"],"summary":"Delivery log","description":"Scope: admin. Newest first.","parameters":[{"name":"id","in":"path","required":true,"description":"Integration id.","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"Deliveries.","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":["deliveries"]}}}},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"admin"},"post":{"tags":["integrations"],"summary":"Send a test delivery","description":"Scope: admin. Uses the org's most recent change.","parameters":[{"name":"id","in":"path","required":true,"description":"Integration id.","schema":{"type":"string"}}],"responses":{"202":{"description":"Queued.","content":{"application/json":{"schema":{"type":"object","properties":{"deliveryId":{"type":"string"}},"required":["deliveryId"]}}}}},"security":[{"bearer":[]}],"x-scope":"admin"}},"/api/v1/me":{"get":{"tags":["me"],"summary":"Who am I","description":"Scope: read.","responses":{"200":{"description":"Org, token, apps and org-wide counts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"read"}},"/api/v1/meta":{"get":{"tags":["me"],"summary":"Vocabulary","description":"No auth. Statuses with labels and groups (open / verify / closed), legal transitions, impacts with legacy aliases, event types. Import these instead of hardcoding them.","responses":{"200":{"description":"Statuses, transitions, impacts, events.","content":{"application/json":{"schema":{"type":"object"}}}}},"security":[],"x-scope":"public"}},"/api/v1/models":{"get":{"tags":["me"],"summary":"Cursor models for this org","description":"Scope: operator (same as launching an agent). The catalog the organization's Cursor key can pass as `model` on POST /api/v1/changes/{ref}/agent: id, displayName, aliases, and variants with params. `unavailable` is true when Cursor could not be asked; a launch then proceeds without a catalog check. Free.","responses":{"200":{"description":"Catalog, or unavailable.","content":{"application/json":{"schema":{"type":"object","required":["models","unavailable"],"properties":{"unavailable":{"type":"boolean"},"models":{"type":["array","null"],"items":{"type":"object","required":["id","displayName","aliases","variants"],"properties":{"id":{"type":"string"},"displayName":{"type":["string","null"]},"aliases":{"type":"array","items":{"type":"string"}},"variants":{"type":"array","items":{"type":"object","properties":{"displayName":{"type":"string"},"isDefault":{"type":"boolean"},"params":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"value":{"type":"string"}}}}}}}}}}}}}}},"403":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"operator"}},"/api/v1/tokens":{"get":{"tags":["tokens"],"summary":"List API tokens","description":"Scope: admin. Plaintext is never returned.","responses":{"200":{"description":"Tokens.","content":{"application/json":{"schema":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/TokenRecord"}}}}}}},"403":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"admin"},"post":{"tags":["tokens"],"summary":"Create an API token","description":"Scope: admin. The plaintext `token` is returned exactly once.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":80},"scopes":{"type":"array","items":{"type":"string","enum":["read","operator","admin"]},"default":["operator","read"]}}}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"record":{"$ref":"#/components/schemas/TokenRecord"}}}}}},"422":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"admin"}},"/api/v1/tokens/{id}":{"delete":{"tags":["tokens"],"summary":"Revoke an API token","description":"Scope: admin.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean"},"id":{"type":"string"}}}}}},"404":{"$ref":"#/components/responses/Error"}},"security":[{"bearer":[]}],"x-scope":"admin"}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Org API token, `cbk_` + 40 hex."}},"parameters":{"Ref":{"name":"ref","in":"path","required":true,"description":"Change id (`chg_…`) or public id (`CB-12`, case-insensitive).","schema":{"type":"string"}}},"responses":{"Error":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ChangeEnvelope":{"description":"The change.","content":{"application/json":{"schema":{"type":"object","properties":{"change":{"$ref":"#/components/schemas/ChangeDetail"}}}}}}},"schemas":{"Error":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string"},"code":{"type":"string","enum":["unauthorized","forbidden","not_found","conflict","precondition_failed","invalid","bad_request","server_error"]}}},"Status":{"type":"string","enum":["reported","in_progress","in_review","pr_ready","live","confirmed","reopened","blocked","wontfix","failed"]},"Impact":{"type":"string","enum":["broken","confusing","polish"]},"ActorBody":{"type":"object","properties":{"actor":{"type":"string","maxLength":80,"description":"Who to attribute this to on the timeline. Defaults to the token name."}}},"NoteBody":{"allOf":[{"$ref":"#/components/schemas/ActorBody"},{"type":"object","required":["note"],"properties":{"note":{"type":"string","maxLength":4000}}}]},"Counts":{"type":"object","description":"One key per status plus `open`.","additionalProperties":{"type":"integer"}},"Page":{"type":"object","required":["limit","total","nextCursor","hasMore"],"properties":{"limit":{"type":"integer"},"total":{"type":"integer"},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}}},"Me":{"type":"object","properties":{"org":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"}}},"token":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}}},"apps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"productionUrl":{"type":["string","null"]}}}},"counts":{"$ref":"#/components/schemas/Counts"}}},"App":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"productionUrl":{"type":["string","null"]},"allowedOrigins":{"type":"array","items":{"type":"string"}},"repositories":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"defaultBranch":{"type":["string","null"]},"isPrimary":{"type":"boolean"}}}},"environments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"origins":{"type":"array","items":{"type":"string"}},"baseBranch":{"type":["string","null"]},"agentsEnabled":{"type":"boolean"}}}}}},"QueueItem":{"type":"object","properties":{"id":{"type":"string"},"publicId":{"type":"string"},"app":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"status":{"$ref":"#/components/schemas/Status"},"impact":{"$ref":"#/components/schemas/Impact"},"description":{"type":"string"},"expected":{"type":["string","null"]},"url":{"type":["string","null"]},"pathname":{"type":["string","null"]},"pageTitle":{"type":["string","null"]},"environment":{"type":["string","null"]},"reporter":{"type":"object","properties":{"name":{"type":["string","null"]},"email":{"type":["string","null"]}}},"assignee":{"type":["object","null"],"properties":{"userId":{"type":["string","null"]},"name":{"type":["string","null"]}}},"context":{"type":["object","null"],"additionalProperties":true},"prUrl":{"type":["string","null"]},"prNumber":{"type":["integer","null"]},"agentUrl":{"type":["string","null"]},"screenshotUrl":{"type":["string","null"]},"reportedAt":{"type":"string","format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"liveAt":{"type":["string","null"],"format":"date-time"}}},"ChangeDetail":{"allOf":[{"$ref":"#/components/schemas/QueueItem"},{"type":"object","properties":{"statusLabel":{"type":"string"},"ticketPath":{"type":"string"},"userAgent":{"type":["string","null"]},"viewport":{"type":["string","null"]},"sdkVersion":{"type":["string","null"]},"screenshotUrls":{"type":"array","items":{"type":"string"}},"screenshots":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"mimeType":{"type":"string"},"url":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"actorName":{"type":["string","null"]},"actorType":{"type":"string"},"message":{"type":"string"}}}},"events":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"message":{"type":"string"},"actorName":{"type":["string","null"]},"actorType":{"type":"string"},"note":{"type":["string","null"]}}}},"repository":{"type":["object","null"],"properties":{"url":{"type":"string"},"baseBranch":{"type":"string"},"additional":{"type":"array","items":{"type":"string"}}}},"environmentName":{"type":["string","null"]},"suggestedBranch":{"type":"string"},"prReadyAt":{"type":["string","null"],"format":"date-time"},"confirmedAt":{"type":["string","null"],"format":"date-time"}}}]},"TokenRecord":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tokenPrefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}},"ExternalLink":{"type":"object","properties":{"provider":{"type":"string"},"connectionId":{"type":"string"},"externalId":{"type":"string"},"externalKey":{"type":["string","null"]},"externalUrl":{"type":["string","null"]},"externalStatus":{"type":["string","null"]},"lastSyncedAt":{"type":["string","null"],"format":"date-time"}}},"Integration":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused"]},"appId":{"type":["string","null"]},"config":{"type":"object","additionalProperties":true},"events":{"type":"array","items":{"type":"string"}},"lastDeliveryAt":{"type":["string","null"],"format":"date-time"},"lastError":{"type":["string","null"]},"inboundUrl":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}}},"FailureResult":{"type":"object","properties":{"action":{"type":"string"},"fingerprint":{"type":"string"},"changeId":{"type":["string","null"]},"publicId":{"type":["string","null"]},"seen":{"type":"integer"},"occurrences":{"type":"integer"},"subjects":{"type":"object","additionalProperties":true}},"required":["action"]}}}}