Keel API Reference v0.2.4
Authentication
All tenant endpoints require a Bearer token in the Authorization header. This is the API key returned at registration.
Two auth levels exist:
| Level | Access | Header |
|---|---|---|
| Public | Registration, health check | None required |
| Tenant | All /api/v1/ endpoints | Bearer {tenant_api_key} |
Base URL
All tenant-facing endpoints are prefixed with /api/v1/. Webhooks use /webhooks/.
Error Handling
Errors return JSON with a detail field describing the issue.
Register
Create a new tenant account. Returns the API key exactly once. The tenant starts with pending billing status -- subscribe via the billing endpoints to activate full API access.
Request body
| Field | Type | Description |
|---|---|---|
| email required | string | Account email address |
| name optional | string | Display name or organisation |
Example
Response
Billing
Billing endpoints bypass the entitlement gate -- tenants with pending or cancelled status can access these to subscribe or manage their subscription.
Returns the tenant's current billing state.
Response
Creates a Stripe Checkout session. Redirect the user to the returned URL to complete payment.
Request body
| Field | Type | Description |
|---|---|---|
| plan required | string | "starter" (Pro, €29/mo) or "professional" (Team, €149/mo) |
Response
Creates a Stripe Customer Portal session for managing subscription, payment methods, and invoices. Requires an existing Stripe customer ID (set after first payment).
Response
Status
Returns the tenant's current system state: policy count, WAL event count, snapshot hash.
Response
Policies
Returns all policies for the tenant.
Response
Create a new policy.
Request body
| Field | Type | Description |
|---|---|---|
| id required | string | Unique policy identifier |
| content required | string | Plain-language rule description |
| scope required | string | global, gmail, gcal, github, or filesystem |
| type required | string | constraint, permission, limit, or preference |
| priority required | integer | 0 (highest) to 2 (lowest) |
| source required | string | user_explicit or user_inferred |
Example
Returns a single policy by ID.
Deactivates a policy. Sets deactivated_at and active to false.
Evaluate an action against all active policies. Returns whether the action is allowed, the risk level, and any violations.
Request body
Response
Returns the current policy store snapshot hash for integrity verification.
Write-Ahead Log (WAL)
Returns all WAL events for the tenant. Each event is cryptographically chained to the previous via SHA-256 hashes.
Response
Append a new event to the WAL. The server computes the hash chain automatically.
Request body
| Field | Type | Description |
|---|---|---|
| event_type required | string | Event classification (e.g. PROPOSED, APPROVED, BLOCKED) |
| payload required | object | Event data -- action details, results, metadata |
| session_id optional | string | Agent session identifier (default: "default") |
Verify the integrity of the entire WAL hash chain. Returns whether the chain is valid, the event count, and the chain tip hash.
Response
Returns the latest WAL event hash without verifying the full chain. Useful for quick sync checks.
Agents
Returns all agent sessions that have interacted with this tenant's workspace.
Update metadata for an agent session.
Quarantine
Returns all quarantined items.
Quarantine an item (move to safe holding instead of deletion).
Release an item from quarantine.
Export
Download a compliance-ready audit export. Set the Accept header to application/json or text/csv to control format.
Example
Webhooks
Receives Stripe webhook events. Validates the Stripe-Signature header against the configured webhook secret. Handles checkout.session.completed (activates tenant), customer.subscription.updated (status changes), and customer.subscription.deleted (cancellation). Events are deduplicated by event ID.
Plans and Pricing
| Plan | API Name | Price | Features |
|---|---|---|---|
| Local | -- | Free | CLI and SKILL.md only. No Cloud API access. |
| Pro | starter | €29/month | 1 workspace, 10 agents, policy sync, dashboard, WAL, 90-day retention |
| Team | professional | €149/month | Shared workspace, 3 seats, shared policies, exports, 365-day retention |
| Business | -- | Contact | Multiple workspaces, RBAC, DPA, custom retention. Contact sales |
Rate Limits
API requests are rate-limited per tenant. Current limits are generous for launch. If you encounter 429 responses, reduce request frequency. Specific limits will be published as usage patterns stabilise.
SDKs and Integrations
The threshold-keel CLI (PyPI) wraps this API. Install with:
The CLI handles authentication, local WAL caching, cloud sync, and policy evaluation. Set KEEL_CLOUD_API_KEY in your environment to enable Cloud mode.
For agent integration, see the SKILL.md in the Keel repository.