Concepts

API

Lelu exposes two HTTP APIs: the Engine API for runtime authorization and tokens, and the Platform API for policies and audit operations.

Base URLs

Use the Engine API for agent and human authorization decisions, and the Platform API for policy and audit management.

Engine APIDefault: http://localhost:8082
Runtime endpoints for authorization, queue approvals, token lifecycle, and health.
Platform APIDefault: http://localhost:9090
Control-plane endpoints for policy CRUD, audit queries, and ingest.

Authentication

Most endpoints require Authorization: Bearer <API_KEY>. Health endpoints are public.

Engine authorize example
curl -X POST http://localhost:8082/v1/authorize   -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": "default",
    "user_id": "user_123",
    "action": "view_invoices",
    "resource": {"type": "invoice", "id": "42"}
  }'

Engine Routes

MethodPathPurpose
POST/v1/authorizeAuthorize human user action.
POST/v1/agent/authorizeAuthorize AI agent action with confidence gates.
POST/v1/tokens/mintMint short-lived scoped token.
DELETE/v1/tokens/{tokenID}Revoke token by ID.
GET/v1/queue/pendingList pending human-review items.
GET/v1/queue/{id}Get one queue item.
POST/v1/queue/{id}/approveApprove queued action.
POST/v1/queue/{id}/denyDeny queued action.
GET/healthzEngine health check.
GET/metricsPrometheus metrics.

Platform Routes

MethodPathPurpose
GET/api/v1/policiesList policies.
GET/api/v1/policies/{name}Get one policy.
PUT/api/v1/policies/{name}Create or update policy.
DELETE/api/v1/policies/{name}Delete policy.
GET/api/v1/auditQuery audit events.
GET/api/v1/audit/trace/{traceID}Get events by trace ID.
POST/api/v1/audit/ingestAppend audit event (engine ingestion).
GET/healthzPlatform health check.

Standard Response Format

Lelu APIs return JSON responses. Successful requests return 2xx. Errors return 4xx/5xx with an error payload.

Error Response (400 Bad Request)
{
  "error": "confidence: confidence out of range"
}