Skip to content

REST API Reference

Base URL: http://localhost:3000 (or your server address)

Authentication: Authorization: Bearer <token> (API token or OIDC JWT), unless noted otherwise.


Create a new SQL execution or migration request. The server classifies the SQL, resolves the applicable workflow, and determines approval requirements.

Permission: request.create or request.create_select

List requests with optional filtering by status, user, or pending-for-me.

ParamDefaultDescription
limit50Max results
offset0Pagination offset
statusFilter by request status
userFilter by requester subject ID
pending_for_meOnly show requests the caller can approve

Permission: request.view

Get full request details including approval progress, decision trace, and context. Supports long-polling with ?wait=<seconds> (max 120s) to wait for status changes.

Permission: request.view

Approve a pending request. If multi-step, advances to the next step. Accepts an optional comment.

Permission: request.approve

Reject a pending request. Accepts an optional comment or reason.

Permission: request.approve

Cancel a request. Only the requester or an admin can cancel. Accepts an optional reason.

Permission: request.cancel

Resume an approved request, triggering agent dispatch. The client should then call the stream endpoint to receive the result.

Permission: request.resume

Long-poll for execution result. Returns the result when the agent completes, or 204 if not yet available.

Permission: result.view

Download the stored result as binary content. Only available if the result was persisted to storage.

Permission: result.view + result policy access check


List stored results accessible to the current user (filtered by result policy access rules).

Permission: Any authenticated user


Get the agent-collected schema snapshot for a database. The server auto-resolves the best available environment unless explicitly specified.

ParamDefaultDescription
summarytrueWhen true, returns table names and row counts only
tableFilter to a single table (supports schema.table format)
environmentExplicit environment (auto-resolved if omitted)

Permission: request.view (scoped to the resolved database/environment)


Get the current authenticated user’s profile, resolved roles, and group memberships.

Permission: Any authenticated user


List all registered users with their status and roles.

Permission: user.manage

Update a user’s profile fields. Currently only slack_user_id can be set or cleared.

Permission: Self-update allowed; otherwise user.manage

Suspend a user. Revokes all active tokens and cancels pending requests.

For config-managed users ([[users]] in server.toml), the response includes a warning field: status will revert to the config value on next server restart or reload. To permanently suspend, set status = "suspended" in server.toml.

Permission: user.manage

Reactivate a previously suspended user.

For config-managed users, same caveat applies: status reverts to config on restart.

Permission: user.manage


Create a new API token. The token value is returned only once in the response — store it securely.

Permission: token.manage

List all tokens with their metadata, status, and expiration.

Permission: token.manage

Revoke a token immediately. The token becomes invalid for all future requests.

Permission: token.manage or token.revoke_own (for own tokens)


Webhooks are config-managed. Define webhooks in [[webhooks]] in server.toml.

List all registered webhooks.

Permission: webhook.manage

Get a webhook’s configuration and delivery statistics.

Permission: webhook.manage

List webhook delivery attempts with status and retry information.

ParamDefaultDescription
statusFilter: pending, in_progress, delivered, dead
limit50Max results (max: 100)
offset0Pagination offset

Permission: metrics.view


Custom roles are config-managed. Define roles in [[auth.roles]] in server.toml.

List all roles (built-in and custom) with their permissions.

Permission: role.manage

Delete a custom role. Built-in roles (admin, developer, readonly, agent-default) cannot be deleted.

Response: 204

Permission: role.manage


Policies are config-managed. Define policies in [[workflows]], [[execution_policies]], [[result_policies]], [[notification_policies]] in server.toml.

List all configured workflows.

Permission: workflow.manage

DELETE /api/execution-policies/{id} → 405

Section titled “DELETE /api/execution-policies/{id} → 405”

List all execution policies.

Permission: policy.manage

List all result policies.

Permission: policy.manage

Get a specific result policy.

Permission: policy.manage

PUT /api/notification-policies/{id} → 405

Section titled “PUT /api/notification-policies/{id} → 405”

DELETE /api/notification-policies/{id} → 405

Section titled “DELETE /api/notification-policies/{id} → 405”

List all notification policies.

Permission: policy.manage

Get a specific notification policy.

Permission: policy.manage

Resolve the effective policy for a database/environment. Shows which workflow matches, auto-approve rules, and the predicted decision.

ParamRequiredDescription
databaseDatabase name
environmentEnvironment name
operationSpecific operation (omit for all)

Permission: request.view (scoped)


Search audit log events with filtering.

ParamDefaultDescription
actor_idFilter by user
event_typeFilter by event type
event_categoryFilter by category
outcomeFilter by outcome
databaseFilter by database
environmentFilter by environment
sinceStart time (ISO 8601)
untilEnd time (ISO 8601)
limit50Max results (max: 200)
offset0Pagination offset

Permission: audit.view

Verify the audit log hash chain integrity. Returns whether the chain is valid and the first broken event ID if not.

Permission: audit.view


Agent reports capabilities and polls for pending jobs. Returns available jobs and dry-run requests.

Permission: agent.poll

Agent claims a specific job for execution. Returns the execution token, SQL, timeout, and lease expiry.

Permission: agent.claim

Agent extends its lease on a running job. Returns whether the job has been cancelled.

Permission: agent.heartbeat

Agent submits execution result (success/failure, data, rows affected, duration).

Body limit: ~12 MB

Permission: agent.submit_result

List connected agents with their status, capabilities, and active jobs.

Permission: metrics.view

Agent reports a database schema snapshot (tables, columns, row estimates) used for risk scoring.

Body limit: 10 MB

Permission: Agent token required

Agent claims a dry-run job to execute EXPLAIN for impact preview.

Permission: Agent token required

Agent submits EXPLAIN output for a dry-run job.

Permission: Agent token required


List all registered databases and their environments.

Permission: request.view


Health check. Always returns 200 if the server process is running.

Readiness check. Returns 200 when all subsystems (SQLite, result store) are operational, 503 otherwise.

Receives Slack interaction payloads (button clicks, modal submissions). Verified by Slack signing secret — no Bearer token required.

Receives Slack Slash Command payloads (/dbward execute, /dbward help). Verified by Slack signing secret — no Bearer token required.


Prometheus metrics in text format.

Permission: * (admin only)

Ed25519 public key used by agents to verify execution tokens.

Permission: Agent token required


All errors return:

{"error": {"code": "validation_error", "message": "subject_id is required"}}
HTTP StatusMeaning
400Validation error
401Not authenticated
403Not authorized
404Resource not found
409Conflict (idempotency key race)
422Business logic error