Skip to content
bucker

API reference

governance-presets

4 operations. Shapes are sketches of the declared schemas, bounded in depth — the authoritative document is linked from the index.

GET/orgs/{orgSlug}/governance-presets

Requires bearerAuth

The three governance presets (Watch, Assist, Delegate), the one in force and the one waiting in its shadow week. Applying one is policy_preset.apply, a CRITICAL human-only act.

Parameters

Parameters for GET /orgs/{orgSlug}/governance-presets
NameInTypeNotes
orgSlugrequiredpathstringmin length 1

Response 200

{
  presets: {
    id: "watch" | "assist" | "delegate"
    label: string
    summary: string
    allowedActs: integer
    autonomyStop: "rca" | "proposal" | "pr"
    rungCeiling: "RCA_ONLY" | "DRAFT_PR" | "AUTO_ATTEMPT"
    selectors: {
      id: string
      label: string
    }[]
  }[]
  shadowDays: integer
  replayDays: integer
  active: {
    id: string
    preset: "watch" | "assist" | "delegate"
    status: "shadow" | "due" | "enforced" | "reverted"
    appliedAt: string
    shadowUntil: string | null
    revertedAt: string | null
    replayDigest: string
    appliedByPrincipalId: string
    supersedes: string | null
    enforcement: {
      created: integer
      modified: integer
      deleted: integer
    } | null
  } | null
  pending: {
    id: string
    preset: "watch" | "assist" | "delegate"
    status: "shadow" | "due" | "enforced" | "reverted"
    appliedAt: string
    shadowUntil: string | null
    revertedAt: string | null
    replayDigest: string
    appliedByPrincipalId: string
    supersedes: string | null
    enforcement: {
      created: integer
      modified: integer
      deleted: integer
    } | null
  } | null
  history: {
    id: string
    preset: "watch" | "assist" | "delegate"
    status: "shadow" | "due" | "enforced" | "reverted"
    appliedAt: string
    shadowUntil: string | null
    revertedAt: string | null
    replayDigest: string
    appliedByPrincipalId: string
    supersedes: string | null
    enforcement: {
      created: integer
      modified: integer
      deleted: integer
    } | null
  }[]
}

Response 400 · `bad_request` — the path, query or body failed validation. `details` carries the Zod issues, one per offending field.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 401 · `unauthorized` — no credential, or one that is expired, revoked or not valid for this resource. `mfa_required` when the credential is good but a second factor is owed.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 403 · `forbidden` — the credential is valid and its scopes or this principal’s membership do not reach this resource. Scopes are re-intersected with live memberships on every request, so this can appear for a token that worked yesterday.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 404 · `not_found` — no such resource, OR one this principal cannot see. The two are deliberately one answer: a 403 would confirm the existence of something whose identifier is guessable.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 429 · `rate_limited` or `quota_exceeded` — over a ceiling. `Retry-After` says when to come back, and `x-ratelimit-limit` / `-remaining` / `-reset` describe the bucket.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 500 · `internal_error` — an unhandled failure on this side. The message is always generic; `requestId` is the part worth quoting.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Request

curl https://api.bucker.io/orgs/{orgSlug}/governance-presets \
  -H "authorization: Bearer $BUCKER_TOKEN"

POST/orgs/{orgSlug}/governance-presets/{preset}/replay

Requires bearerAuth

Replay the organization’s last 30 days of approval requests under a preset: what would have been allowed, asked or denied, with counts per family and the inverse of everything allowed. Reads only; the digest it returns is what an apply must carry.

Parameters

Parameters for POST /orgs/{orgSlug}/governance-presets/{preset}/replay
NameInTypeNotes
orgSlugrequiredpathstringmin length 1
presetrequiredpath"watch" | "assist" | "delegate"one of "watch" | "assist" | "delegate"

Response 200

{
  preset: "watch" | "assist" | "delegate"
  asOf: string
  since: string
  days: integer
  requestsReplayed: integer
  skipped: integer
  heldActs: integer
  truncated: boolean
  totals: {
    current: {
      ALLOW: integer
      ASK: integer
      DENY: integer
    }
    preset: {
      ALLOW: integer
      ASK: integer
      DENY: integer
    }
  }
  asksAvoided: integer
  askReductionPct: number
  perFamily: {
    family: string
    requests: integer
    current: {
      ALLOW: integer
      ASK: integer
      DENY: integer
    }
    preset: {
      ALLOW: integer
      ASK: integer
      DENY: integer
    }
  }[]
  allowedWithInverse: {
    action: string
    count: integer
    inverse: string | null
    reversibility: string | null
  }[]
  fidelity: {
    compared: integer
    reproduced: integer
    notReproduced: integer
    pct: number
  }
  coverage: string
  plan: {
    create: integer
    modify: integer
    kept: integer
    suppressed: integer
    shadowClash: integer
    suppressedActs: {
      action: string
      floorRowId: string
      floorAction: string
      floorDecision: "ALLOW" | "NOTICE" | "ASK" | "DENY"
    }[]
  }
  scenarios: {
    action: string
    selector: string
    current: "ALLOW" | "ASK" | "DENY"
    preset: "ALLOW" | "ASK" | "DENY"
  }[] | null
  digest: string
}

Response 400 · `bad_request` — the path, query or body failed validation. `details` carries the Zod issues, one per offending field.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 401 · `unauthorized` — no credential, or one that is expired, revoked or not valid for this resource. `mfa_required` when the credential is good but a second factor is owed.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 403 · `forbidden` — the credential is valid and its scopes or this principal’s membership do not reach this resource. Scopes are re-intersected with live memberships on every request, so this can appear for a token that worked yesterday.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 404 · `not_found` — no such resource, OR one this principal cannot see. The two are deliberately one answer: a 403 would confirm the existence of something whose identifier is guessable.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 429 · `rate_limited` or `quota_exceeded` — over a ceiling. `Retry-After` says when to come back, and `x-ratelimit-limit` / `-remaining` / `-reset` describe the bucket.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 500 · `internal_error` — an unhandled failure on this side. The message is always generic; `requestId` is the part worth quoting.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Request

curl -X POST https://api.bucker.io/orgs/{orgSlug}/governance-presets/{preset}/replay \
  -H "authorization: Bearer $BUCKER_TOKEN"

PUT/orgs/{orgSlug}/governance-presets/active

Requires bearerAuth

File policy_preset.apply (CRITICAL, human-only, dual control) for one preset, carrying the digest of the replay that was shown. Needs a person on their own session. It writes no policy: a second person approves, the hold runs, the requester confirms, and then the preset starts a seven-day shadow before it is enforced. 202 while it waits.

Parameters

Parameters for PUT /orgs/{orgSlug}/governance-presets/active
NameInTypeNotes
orgSlugrequiredpathstringmin length 1

Request body (required) · application/json

{
  preset: "watch" | "assist" | "delegate"
  replayDigest: string
  asOf: string (date-time)
  reason: string
  stepUp?: {
    kind: "webauthn"
    nonce: string
    assertion: {
      credentialId: string
      clientDataJSON: string
      authenticatorData: string
      signature: string
    }
  } | {
    kind: "totp"
    code: string
  }
  channel?: "dashboard" | "api" | "mcp" | "slack" | "push" | "chat" | "email"
}

Response 200

{
  status: "step_up_required" | "held" | "applied"
  operationId: string
  requestId: string
  holdUntil: string | null
  independentVotesNeeded: integer | null
  decisionUrl: string
}

Response 202

{
  status: "step_up_required" | "held" | "applied"
  operationId: string
  requestId: string
  holdUntil: string | null
  independentVotesNeeded: integer | null
  decisionUrl: string
}

Response 400 · `bad_request` — the path, query or body failed validation. `details` carries the Zod issues, one per offending field.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 401 · `unauthorized` — no credential, or one that is expired, revoked or not valid for this resource. `mfa_required` when the credential is good but a second factor is owed.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 403 · `forbidden` — the credential is valid and its scopes or this principal’s membership do not reach this resource. Scopes are re-intersected with live memberships on every request, so this can appear for a token that worked yesterday.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 404 · `not_found` — no such resource, OR one this principal cannot see. The two are deliberately one answer: a 403 would confirm the existence of something whose identifier is guessable.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 429 · `rate_limited` or `quota_exceeded` — over a ceiling. `Retry-After` says when to come back, and `x-ratelimit-limit` / `-remaining` / `-reset` describe the bucket.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 500 · `internal_error` — an unhandled failure on this side. The message is always generic; `requestId` is the part worth quoting.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Request

curl -X PUT https://api.bucker.io/orgs/{orgSlug}/governance-presets/active \
  -H "authorization: Bearer $BUCKER_TOKEN" \
  -H 'content-type: application/json' \
  -d '{ … }'

POST/orgs/{orgSlug}/governance-presets/applications/{id}/restore

Requires bearerAuth

File the inverse of policy_preset.apply: restore the snapshot taken at apply (cancel a preset still in shadow, or undo an enforced one row by row). Dual control, like the apply.

Parameters

Parameters for POST /orgs/{orgSlug}/governance-presets/applications/{id}/restore
NameInTypeNotes
orgSlugrequiredpathstringmin length 1
idrequiredpathstringmin length 1, max length 100

Request body (required) · application/json

{
  reason: string
  stepUp?: {
    kind: "webauthn"
    nonce: string
    assertion: {
      credentialId: string
      clientDataJSON: string
      authenticatorData: string
      signature: string
    }
  } | {
    kind: "totp"
    code: string
  }
  channel?: "dashboard" | "api" | "mcp" | "slack" | "push" | "chat" | "email"
}

Response 200

{
  status: "step_up_required" | "held" | "applied"
  operationId: string
  requestId: string
  holdUntil: string | null
  independentVotesNeeded: integer | null
  decisionUrl: string
}

Response 202

{
  status: "step_up_required" | "held" | "applied"
  operationId: string
  requestId: string
  holdUntil: string | null
  independentVotesNeeded: integer | null
  decisionUrl: string
}

Response 400 · `bad_request` — the path, query or body failed validation. `details` carries the Zod issues, one per offending field.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 401 · `unauthorized` — no credential, or one that is expired, revoked or not valid for this resource. `mfa_required` when the credential is good but a second factor is owed.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 403 · `forbidden` — the credential is valid and its scopes or this principal’s membership do not reach this resource. Scopes are re-intersected with live memberships on every request, so this can appear for a token that worked yesterday.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 404 · `not_found` — no such resource, OR one this principal cannot see. The two are deliberately one answer: a 403 would confirm the existence of something whose identifier is guessable.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 429 · `rate_limited` or `quota_exceeded` — over a ceiling. `Retry-After` says when to come back, and `x-ratelimit-limit` / `-remaining` / `-reset` describe the bucket.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Response 500 · `internal_error` — an unhandled failure on this side. The message is always generic; `requestId` is the part worth quoting.

{
  error: {
    code: "bad_request" | "conflict" | "forbidden" | "internal_error" | "mfa_required" | "not_found" | "payload_too_large" | "quota_exceeded" | … 6 more
    message: string
    details?: unknown
    requestId?: string
  }
}

Request

curl -X POST https://api.bucker.io/orgs/{orgSlug}/governance-presets/applications/{id}/restore \
  -H "authorization: Bearer $BUCKER_TOKEN" \
  -H 'content-type: application/json' \
  -d '{ … }'