Skip to Content
SDKsHTTP (Raw)

HTTP API

Use the REST API directly when an official SDK is not available for your language.

Base URL

https://api.kaplaix.com

Authentication

All requests require a Bearer token in the Authorization header:

Authorization: Bearer al_live_your_key_here

Endpoints summary

MethodPathDescription
POST/v1/eventsIngest an event
GET/v1/sessionsList sessions
GET/v1/sessions/:idGet session detail
GET/v1/sessions/:id/riskCompute risk score
GET/v1/sessions/:id/export.jsonExport session as JSON
POST/v1/agentsRegister agent
GET/v1/agentsList agents
GET/v1/agents/:idGet agent
PATCH/v1/agents/:idUpdate agent
GET/v1/agents/:id/sessionsList agent sessions
POST/v1/policiesCreate policy
GET/v1/policiesList policies
GET/v1/policies/:idGet policy
PATCH/v1/policies/:idUpdate policy
DELETE/v1/policies/:idArchive policy
POST/v1/policies/checkCheck action against policy
GET/v1/guardian/pending-actionsList pending actions
POST/v1/guardian/pending-actions/:id/decideDecide pending action
POST/v1/notification-channelsCreate webhook
GET/v1/notification-channelsList webhooks

Sending an event

curl -X POST https://api.kaplaix.com/v1/events \ -H "Authorization: Bearer al_live_..." \ -H "Content-Type: application/json" \ -d '{ "eventId": "550e8400-e29b-41d4-a716-446655440000", "agentId": "my-agent", "sessionId": "session-001", "sourceTimestamp": "2025-01-15T10:30:00Z", "category": "tool_api", "schemaVersion": "1.0", "payload": { "toolName": "web_search", "argumentsHash": "sha256-of-args", "responseStatus": 200 } }'

Error format

All errors follow the same envelope:

{ "error": { "code": "VALIDATION_ERROR", "message": "Human-readable message", "details": [...] } }

See Error Codes for the full list.

Pagination

List endpoints use cursor-based pagination:

# First page curl "https://api.kaplaix.com/v1/sessions?limit=20" # Next page curl "https://api.kaplaix.com/v1/sessions?limit=20&cursor=eyJsYXN0..."

The nextCursor field is null when there are no more results.

When building a custom integration, set these headers for better observability:

HeaderExamplePurpose
x-kaplaix-sdkcustom/1.0Identify your integration
x-kaplaix-frameworklangchainAI framework name
x-kaplaix-agent-version2.1.0Your agent version

Retry strategy

For production use, implement retries on these status codes:

StatusMeaningAction
429Rate limitedRetry after Retry-After header
502Bad gatewayRetry with backoff
503Service unavailableRetry with backoff
504Gateway timeoutRetry with backoff

Use exponential backoff with jitter. The official SDKs default to 3 retries.

Last updated on