Skip to content

API overview

The OpenCrane control plane exposes a versioned HTTP API at /api/v1.

Looking for the endpoint list?

This page covers authentication, error envelopes, and pagination conventions. For the full, browsable endpoint and schema reference, see the interactive API reference.

A machine-readable OpenAPI 3.1 description is emitted from the build and served at runtime:

GET /api/v1/openapi.json

Use the OpenAPI document as the authoritative contract. This reference provides a human-readable overview and authentication guide.


Authentication

All endpoints (except the auth and OpenAPI routes listed below) require a bearer token.

Header format:

Authorization: Bearer <token>

Current paths:

  • Bearer token — set OPENCRANE_TOKEN or pass --token to the CLI. This is the automation and break-glass path.
  • OIDC — human operators authenticate via GET /api/v1/auth/login → callback → session cookie. See the Auth section below.

Projected ServiceAccount tokens will replace static bearer tokens once Kubernetes workload identity support lands.


Base URL

All API routes are prefixed with /api/v1. Infrastructure routes (/healthz, /prom) are unprefixed.


Endpoints

Tenants

MethodPathDescription
GET/tenantsList all tenants
POST/tenantsCreate a tenant
GET/tenants/{name}Get a tenant by name
PUT/tenants/{name}Update a tenant
DELETE/tenants/{name}Delete a tenant
POST/tenants/{name}/suspendSuspend a tenant pod
POST/tenants/{name}/resumeResume a suspended tenant
GET/tenants/{name}/datasetsGet tenant dataset memberships
PUT/tenants/{name}/datasetsUpdate tenant dataset memberships
GET/tenants/{name}/effective-contractGet the compiled runtime contract for a tenant
GET/tenants/driftReport projection drift between CRDs and PostgreSQL
POST/tenants/repairRepair drifted tenant projections (dry-run by default; append ?dryRun=false to apply)

Access Policies

MethodPathDescription
GET/policiesList all access policies
POST/policiesCreate a policy
GET/policies/{name}Get a policy by name
PUT/policies/{name}Update a policy
DELETE/policies/{name}Delete a policy
GET/policies/driftReport drift for policy projections
POST/policies/repairRepair drifted policy projections

MCP Servers

MethodPathDescription
GET/mcp-serversList MCP server registrations
POST/mcp-serversRegister an MCP server
GET/mcp-servers/{id}Get an MCP server
PUT/mcp-servers/{id}Update an MCP server
DELETE/mcp-servers/{id}Delete an MCP server

Groups

MethodPathDescription
GET/groupsList groups
POST/groupsCreate a group
GET/groups/{id}Get a group
PUT/groups/{id}Update a group
DELETE/groups/{id}Delete a group

Skills Catalogue

MethodPathDescription
GET/skills/catalogList skill bundles
POST/skills/catalogPublish a skill bundle
GET/skills/catalog/{id}Get a skill bundle
PUT/skills/catalog/{id}Update a skill bundle
DELETE/skills/catalog/{id}Remove a skill bundle

Third-Party Sources

MethodPathDescription
GET/third-party-sourcesList registered third-party sources
POST/third-party-sourcesRegister a third-party source
GET/third-party-sources/{id}Get a source
PUT/third-party-sources/{id}Update a source
DELETE/third-party-sources/{id}Remove a source

Access Tokens

MethodPathDescription
GET/access-tokensList access tokens
POST/access-tokensCreate an access token
DELETE/access-tokens/{id}Revoke an access token

Provider Keys

MethodPathDescription
GET/providers/keysList configured provider API keys
PUT/providers/keysSet a provider API key
DELETE/providers/keys/{provider}Remove a provider key

AI Budget

MethodPathDescription
GET/ai-budget/globalGet global budget settings
PUT/ai-budget/globalUpdate global budget settings
GET/ai-budget/accountsList per-user account budgets
PUT/ai-budget/accounts/{userId}Set a user account budget
DELETE/ai-budget/accounts/{userId}Remove a user account budget
GET/ai-budget/{tenantName}/spendGet current spend for a tenant
GET/ai-budget/{tenantName}/litellm-keyGet a tenant's LiteLLM virtual key
POST/ai-budget/{tenantName}/litellm-key/revokeRevoke a tenant's LiteLLM virtual key

Audit

MethodPathDescription
GET/auditQuery audit log entries with optional tenant filter and cursor pagination

Query parameters: tenant, limit (default 100), cursor.

Responses include { data, pagination: { limit, hasMore, nextCursor? } }.

Token Usage

MethodPathDescription
GET/token-usageQuery token usage records

Metrics

MethodPathDescription
GET/metrics/serverServer health and aggregate platform metrics
GET/metrics/projection-driftTenant and AccessPolicy CRD-to-PostgreSQL drift counts, lag, and alert state

Prometheus-format metrics are also available at /prom (unprefixed).

Auth

These endpoints do not require a bearer token.

MethodPathDescription
GET/auth/loginInitiate OIDC login; redirects to the identity provider
GET/auth/callbackOIDC callback; establishes a session
POST/auth/logoutEnd the current session
GET/auth/meReturn the current session principal

Error Envelopes

All 4xx and 5xx responses return a consistent envelope:

json
{
  "error": "Human-readable message",
  "code": "MACHINE_READABLE_CODE"
}

Common codes: TENANT_NOT_FOUND, POLICY_NOT_FOUND, VALIDATION_ERROR, UPSTREAM_ERROR, INTERNAL_ERROR, DATASET_DENIED, UNAUTHORIZED.


Pagination

Endpoints that return collections use cursor-based keyset pagination:

json
{
  "data": [ ... ],
  "pagination": {
    "limit": 100,
    "hasMore": true,
    "nextCursor": "eyJ..."
  }
}

Pass ?cursor=<nextCursor> to fetch the next page.


Infrastructure Routes

These are served without the /api/v1 prefix and require no auth:

RouteDescription
GET /healthzLiveness probe
GET /promPrometheus metrics
GET /api/v1/openapi.jsonOpenAPI 3.1 spec

Released under the AGPL-3.0-or-later License.