Skip to main content
All REST endpoints are mounted by the framework adapter (Hono, Express, Next.js, etc.). The base path defaults to / unless you configure baseUrl.
All endpoints require a valid Bearer token unless noted as public. Obtain a token through the MCP OAuth 2.1 flow or by creating an agent with kavach.agent.create().

Agent endpoints

Create agent

Creates a new agent identity. Request body
Response 201 Created

List agents

Returns all agents for the authenticated user. Supports query parameters for filtering. Query parameters Response 200 OK - Array of agent objects.

Get agent

Returns a single agent by ID. Response 200 OK - Agent object. 404 when not found.

Update agent

Updates name, permissions, expiry, or metadata. Request body
All fields are optional. Response 200 OK - Updated agent object.

Revoke agent

Permanently revokes an agent. Revoked agents cannot be reactivated. Response 204 No Content

Rotate agent token

Issues a new token and invalidates the previous one. Use this for credential rotation. Response 200 OK - Agent object with a new token value.

Authorization endpoints

Authorize a request

Checks whether an agent has permission to perform an action on a resource. Request body
Response 200 OK
On denial:

Delegation endpoints

Create delegation

Delegates a subset of permissions from one agent to another. Request body
Response 201 Created

List delegations

Returns all active delegation chains for the authenticated user. Query parameters Response 200 OK - Array of delegation objects.

Revoke delegation

Revokes a delegation chain immediately. Response 204 No Content

Audit endpoints

Query audit log

Returns audit log entries matching the specified filters. Query parameters Response 200 OK

Export audit log

Exports the audit log as JSON or CSV for compliance reporting. Query parameters Response 200 OK - File download with Content-Disposition: attachment.

MCP endpoints

These endpoints implement the MCP OAuth 2.1 specification.

Authorization Server Metadata

Returns OAuth 2.0 Authorization Server Metadata (RFC 8414). Public endpoint, no auth required.

Protected Resource Metadata

Returns Protected Resource Metadata (RFC 9728). Public endpoint, no auth required.

Dynamic Client Registration

Registers a new OAuth client (RFC 7591). No auth required (open registration) unless restricted by configuration. Request body - See RFC 7591 for the full schema. Minimum:
Response 201 Created - Client credentials including client_id and client_secret.

Authorization request

Starts the OAuth authorization code flow. Requires PKCE (code_challenge + code_challenge_method=S256). Redirects to loginPage if the user is not authenticated, or to consentPage for scope approval.

Token exchange

Exchanges an authorization code or refresh token for an access token. Request body (application/x-www-form-urlencoded) For authorization_code grant:
For refresh_token grant:
Response 200 OK

Dashboard endpoints

Stats overview

Returns aggregate statistics for the admin dashboard. Response 200 OK

Adapters overview

Framework adapters that mount these endpoints on your server.

Agent identity

Core concepts behind the agent endpoints and token lifecycle.

Audit

Querying and exporting audit logs via the REST API.

Errors

Error codes and HTTP status reference for all endpoints.
Last modified on April 29, 2026