Skip to main content
Your scripts, CI jobs and coding agents can read decisions through the Kontext management API. They can manage policies, API keys and directory sync. Use this base URL for the documented paths:
Workspace owners and admins manage API access under Settings → Agent access.

Choose how to connect

Use service accounts for CI and automation. Use the skill for Claude Code or Codex.

Service accounts

  1. Open Settings → Agent access and click Create service account.
  2. Give it a name, then pick an access preset or check individual scopes.
  3. Copy the Client ID, Client secret, and Terminal environment block. The dashboard shows the secret once.
The Terminal environment block sets KONTEXT_CLIENT_ID, KONTEXT_CLIENT_SECRET, and KONTEXT_SCOPES. Request an access token with the OAuth client credentials grant:
Send the returned access_token on every call:
Open a service account to view its scopes, Rotate secret, or Revoke it. Kontext rejects the old secret immediately after rotation. Service accounts use their own scopes independently of connected agent settings. You can create, rotate or revoke service accounts only in the dashboard.
A service account acts as the admin who created it and inherits that person’s role. If that admin leaves the workspace, the service account stops authenticating. Create long-lived automation from an account you plan to keep.

Connected agents

Follow the two steps in Connect an agent. First, install the skill:
Ask your agent to “Connect to Kontext and show me my policies.” Approve access once in your browser. The agent acts as you within What a connected agent can do. Set each area to Off, Read, or Read & write, or choose a preset. The dashboard saves each change on click. Kontext applies it to the agent’s next request.

Scopes and routes

Each area in Settings → Agent access maps to a read scope and a write scope. A write scope also grants read. You can apply these presets: Kontext checks the role of the person the caller acts as. Policy, directory, settings and API key routes require an owner or admin.

First request

Set KONTEXT_ACCESS_TOKEN to your token. With management:logs:read, you can list the five latest decisions through this read-only request.
Kontext returns an items array and nextCursor. Pass nextCursor as cursor for the next page. Filter with sessionId, from, and to.

Errors

If the caller lacks a required scope, Kontext names it in the response body and WWW-Authenticate header.