Skip to main content

API reference

Every REST endpoint the API serves, grouped the way .spec/plan/03-api.md specifies them.

Base URL and auth

Every path below is relative to https://api.burnratesurgeon.io/api/v1. The version is in the path, not a header — /api/v1/ stays stable while the API grows. A request authenticates with either an Auth0 JWT (the browser session) or a brs_ API token scoped to replay:write or corpus:read (the CLI and the PR-gate GitHub Action). See Webhooks for the one endpoint that authenticates differently, and MCP server for the corpus served to AI agents over JSON-RPC rather than plain REST.

Terminal
curl https://api.burnratesurgeon.io/api/v1/corpus/stats

Identity

PLAN-API-01

MethodPathAuthWhat it does
GET/users/meJWTThe signed-in user and their org memberships.
POST/users/syncJWTCreate or update the local user row on the first call after an Auth0 login.
GET/users/me/exportJWTGDPR Art. 15/20 export: account, memberships and API token metadata.

Organizations

PLAN-API-02

MethodPathAuthWhat it does
GET/orgsJWTOrganizations the caller is a member of.
POST/orgsJWTCreate an organization; the creator becomes its owner.
GET/orgs/:orgIdJWT · memberOne organization.
PATCH/orgs/:orgIdJWT · owner|adminUpdate the name or the corpus consent level.
GET/orgs/:orgId/membersJWT · memberList the organization’s members.
POST/orgs/:orgId/membersJWT · owner|adminInvite a member by email and role.

API tokens

PLAN-API-03

MethodPathAuthWhat it does
GET/orgs/:orgId/tokensJWT · owner|adminList tokens by prefix only — the plaintext is never stored.
POST/orgs/:orgId/tokensJWT · owner|adminMint a brs_ token; the plaintext is shown exactly once.
DELETE/orgs/:orgId/tokens/:tokenIdJWT · owner|adminRevoke a token (sets revoked_at).

TSDB snapshots

PLAN-API-04

MethodPathAuthWhat it does
POST/orgs/:orgId/snapshotsJWT or brs_ token · replay:writeRegister a snapshot and get a signed R2 upload URL.
POST/orgs/:orgId/snapshots/:snapshotId/completereplay:writeMark the upload done and trigger indexing.
GET/orgs/:orgId/snapshotsJWT · memberList snapshots, filterable by vendor and status.
GET/orgs/:orgId/snapshots/:snapshotIdJWT · memberOne snapshot.

Rule sets

PLAN-API-05

MethodPathAuthWhat it does
POST/orgs/:orgId/rule-setsreplay:writeSubmit rules.yml (+ alertmanager.yml); idempotent by checksum, PromQL-validated.
GET/orgs/:orgId/rule-sets/:ruleSetIdJWT · memberOne rule set.

Replay runs

PLAN-API-06

MethodPathAuthWhat it does
POST/orgs/:orgId/replaysreplay:writeQueue a replay (one_shot | shadow_continuous | pr_gate); idempotent by input checksum.
GET/orgs/:orgId/replaysJWT · memberList replay runs, filterable by status and mode.
GET/orgs/:orgId/replays/:replayIdJWT · memberThe run plus its classifications.
GET/orgs/:orgId/replays/:replayId/alertsJWT · memberSimulated alerts: alertname, labels, fireTime, wouldPage, silencedBy.
GET/orgs/:orgId/replays/:replayId/reportJWT · memberClassified report; `Accept: text/markdown` returns the same report the CLI and PR comment use.

Classifier

PLAN-API-07

MethodPathAuthWhat it does
POST/orgs/:orgId/replays/:replayId/classifyreplay:writeRe-run the hybrid classifier (rule-based + corpus nearest-signature) synchronously.

Corpus

PLAN-API-08

MethodPathAuthWhat it does
GET/corpus/signaturesoptionalPublic signatures unless authenticated; filterable by class and vendor.
GET/corpus/signatures/:signatureKeyoptionalOne signature; 404 when private and the caller does not own it.
POST/corpus/searchoptionalSemantic search over signatures (Vectorize) — the same contract `search_signatures` uses over MCP.
GET/corpus/statsnoneAnonymous counters over public signatures only — cacheable, never scoped by session.

Payments & billing

PLAN-API-BILLING

MethodPathAuthWhat it does
POST/payments/checkoutJWTStart a billing-gateway checkout for a plan.
POST/payments/portalJWTOpen the billing-gateway customer portal.
GET/orgs/:orgId/billingJWTPlan, subscription and invoices; degrades to plan-only if the gateway is down.
GET/orgs/:orgId/billing/invoices/:id/pdfJWTOne invoice as a PDF.

Dashboard

PLAN-API-10

MethodPathAuthWhat it does
GET/orgs/:orgId/dashboard/statsJWT · memberNorth-star and supporting counts: replays, correctly predicted critical alerts, classification breakdown.

Error shape

Every error response — from any endpoint above — has the same shape:

Error response
{
  "error": {
    "code": "ERR_NOT_FOUND",
    "message": "Replay run not found",
    "field": null,
    "details": {}
  }
}