API Reference
camelRun v2 authentication: API keys, agent tokens, and runtime JWTs
How to authenticate to camelRun v2 with tenant API keys (cr_live_), scoped agent tokens (agt_tok_), admin keys, and runtime tool identity JWTs.
camelRun v2 uses three credential types, each formatted to route directly to the target tenant or agent Durable Object without a central database lookup.
1. Tenant API keys (cr_live_...)
Format: cr_live_<tenantId>.<id>_<secret>
Send as an HTTP Bearer header:
Authorization: Bearer cr_live_tnt_0123456789abcdef.a1b2c3d4e5f6_...Tenant API keys grant full access to all tenant routes: managing tokens, providers, key scopes, definitions, repos, agents, stateless runs, decisions, channels, media, voice calls, webhooks, billing, and usage. Keep them strictly on your server.
Manage tenant API keys (/v2/tokens)
// Create an additional key
const created = await client.tokens.create({ name: "ci-worker", scopes: ["*"] });
console.log(created.token); // shown once
// List keys (returns prefixes and metadata, never full secrets)
const keys = await client.tokens.list();
// Revoke a key
await client.tokens.delete(created.id);| Endpoint | Description |
|---|---|
POST /v2/tokens | Mint a new tenant API key ({ name?, scopes? }), returns 201 with token shown once |
GET /v2/tokens | List active tenant API keys ({ tokens }) |
DELETE /v2/tokens/:id | Revoke a tenant API key |
GET /v2/me | Verify the key and inspect tenant ID, name, balance, tier, and concurrency |
2. Scoped agent tokens (agt_tok_...)
Format: agt_tok_<tenantId>.<agentId>.<secret>
Returned as agentToken when you upsert (PUT /v2/agents/:key) or fork (POST /v2/agents/:idOrKey/fork) an agent. Send via Authorization: Bearer agt_tok_... or via ?token=agt_tok_... on SSE (GET /v2/agents/:idOrKey/events) and WebSocket (GET /v2/agents/:idOrKey/ws, GET /v2/voice/sessions/:id/ws) endpoints.
What an agent token can do (for that one agent only):
- Read agent state (
GET /v2/agents/:idOrKey), runs, history, events, schedules, and pending inputs - Start runs (
POST /v2/agents/:idOrKey/runswithoutactor), abort runs, compact/reset context, run workflows, trigger dreaming - Open WebSocket tool/event sessions (
/v2/agents/:idOrKey/ws) and voice sessions (/v2/voice/sessions) - Answer standard
ask_humanandrequiresApprovalinputs (POST /v2/agents/:idOrKey/inputs/:inputId) on non-actor runs
What an agent token cannot do (returns 403 forbidden):
- Access any other agent (
403 forbidden) - Modify agent configuration (
PUT /v2/agents/:key,PATCH /v2/agents/:idOrKey/model,PATCH /v2/agents/:idOrKey/spend-limit,PUT /v2/agents/:idOrKey/repo), fork, delete, or import history - Create or delete schedules
- Set
actoron runs or respond to actor-bound runs or signed MCP tool approvals/elicitations - Access tenant management routes (
/v2/tokens,/v2/providers,/v2/definitions,/v2/repos,/v2/billing,/v2/usage,/v2/webhooks,/v2/channels,/v2/runs,/v2/decisions, media endpoints)
3. Operator admin key (X-Admin-Key)
Self-hosted and platform operators supply X-Admin-Key: <ADMIN_SECRET> on bootstrap and credit-grant routes:
POST /v2/tenants: Create a new tenant ({ name, initialCreditsUsd?, tier?, monthlyCapUsd?, concurrencyLimit?, rateLimitRpm? }), returning201 { tenantId, name, apiKey, balanceUsd }.POST /v2/billing/credits: Add credits idempotently ({ tenantId?, amountUsd, refId, note? }).
4. Runtime tool identity JWTs (GET /v2/.well-known/jwks.json)
When an agent calls a remote MCP server configured with auth: { type: "runtime" }, camelRun signs a 2-minute EdDSA (Ed25519) JWT in Authorization: Bearer <jwt>. Your MCP server verifies it using the public JWK set published at:
curl -s "https://run.camelai.com/v2/.well-known/jwks.json"See Tools for the full list of JWT claims and verification guidance.