camelAI Documentation

API Reference

camelRun v2 REST and WebSocket API reference

Complete reference for every camelRun v2 HTTP and WebSocket endpoint under /v2/*: tenants, providers, definitions, CamelFS repos, agents, runs, voice, channels, media, and webhooks.

View as Markdown

Base URL: https://run.camelai.com (all API routes live under /v2/*).

All JSON responses use application/json. Errors use the standard envelope:

json
{ "error": { "code": "...", "message": "..." } }

Health and discovery

Method and pathAuthDescription
GET /healthzNoneWorker health check ({ ok: true, service: "camelrun-worker-v2" })
GET /v2Nonev2 root health check ({ ok: true, service: "camelrun-worker-v2" })
GET /v2/healthNonev2 health check ({ ok: true, service: "camelrun-worker-v2" })
GET /v2/.well-known/jwks.jsonNonePublic Ed25519 JWKS for verifying runtime MCP tool JWTs (Cache-Control: public, max-age=60)

Tenants, tokens, providers, models, and billing

Method and pathAuthDescription
POST /v2/tenantsAdmin (X-Admin-Key)Provision a tenant ({ name, initialCreditsUsd?, tier?, monthlyCapUsd?, concurrencyLimit?, rateLimitRpm? }) -> 201 { tenantId, name, apiKey, balanceUsd }
GET /v2/meTenantTenant profile, balance, tier, and busyAgents: { active, limit }
POST /v2/tokensTenantCreate API key ({ name?, scopes? }) -> 201 { id, name, token, prefix, scopes, createdAt }
GET /v2/tokensTenantList API keys ({ tokens })
DELETE /v2/tokens/:idTenantRevoke API key ({ deleted: true })
PUT /v2/providers/:providerTenantSeal provider credentials ({ apiKey?, baseUrl?, modelAliases?, headers?, apiStyle? })
GET /v2/providersTenantList configured providers (metadata only, no secrets)
DELETE /v2/providers/:providerTenantRemove a provider credential
PUT /v2/key-scopes/:scope/providers/:providerTenantSeal provider credentials inside a named key scope (1..100 chars)
GET /v2/key-scopes/:scope/providersTenantList providers in a key scope ({ scope, providers })
DELETE /v2/key-scopes/:scope/providers/:providerTenantDelete one provider from a key scope
DELETE /v2/key-scopes/:scopeTenantDelete an entire key scope
GET /v2/modelsTenantList catalog and alias models (?provider=&available=true&keyScope=)
GET /v2/usageTenantDaily usage rows (?days=30, clamped 1..365) -> { days: [...] }
GET /v2/billingTenant{ balanceUsd, monthlyCapUsd, busyAgents, usage }
POST /v2/billing/creditsAdmin (X-Admin-Key)Idempotently grant credits ({ tenantId?, amountUsd, refId, note? })

Definitions

Method and pathAuthDescription
PUT /v2/definitions/:slugTenantCreate or update a reusable agent definition
GET /v2/definitionsTenantList all definitions ({ definitions })
GET /v2/definitions/:slugTenantGet a single definition (404 if missing)
DELETE /v2/definitions/:slugTenantDelete a definition ({ deleted: true })

CamelFS repositories (/v2/repos)

Method and pathAuthDescription
POST /v2/reposTenantCreate repo ({ name? }) -> 201 { repoId, name, lineage, defaultRef, commit, ... }
GET /v2/reposTenantList tenant repos ({ repos })
GET /v2/repos/:repoIdTenantGet repo metadata and refs
DELETE /v2/repos/:repoIdTenantStop active VMs and delete repo
GET /v2/repos/:repoId/filesTenantRead one file (?path=<required>&at=&offset=&limit=)
GET /v2/repos/:repoId/read-allTenantRead all files under optional ?path= at ?at= (max 1,000 files / 16 MiB) -> { commit, files }
POST /v2/repos/:repoId/writeTenantAtomic write ({ ref?, expectedCommit?, holder?, author?, message?, puts?, deletes?, moves? }) -> { commit, tree, changed, totalBytes }
GET /v2/repos/:repoId/lsTenantList entries (?at=&path=&recursive=1|0&glob=) -> { commit, entries }
POST /v2/repos/:repoId/grepTenantRegex search ({ pattern, at?, pathPrefix?, maxMatches? }) -> { commit, matches }
GET /v2/repos/:repoId/historyTenantCommit log (?ref=&limit=20) -> { commits }
POST /v2/repos/:repoId/forkTenantFork repo ({ name?, sourceRef?, atCommit? }) -> 201 new repo
POST /v2/repos/:repoId/restoreTenantRestore branch ({ targetCommit, ref?, message? }) -> { commit, tree }

Durable keyed agents (/v2/agents)

:idOrKey accepts either the agent's key or its ID (agt_...).

Method and pathAuthDescription
PUT /v2/agents/:keyTenantUpsert agent config (201 created, 200 updated). Optional prompt starts an initial run in the same request. Returns { id, key, agentToken, repoId, branch, model, created, run? }.
GET /v2/agentsTenantList tenant agents ({ agents })
GET /v2/agents/:idOrKeyTenant or AgentFull AgentConfig plus status, activeRunId, messageCount, lastRun
PATCH /v2/agents/:idOrKey/modelTenantCompare-and-swap idle model update ({ model, expectedModel, keyScope? })
PATCH /v2/agents/:idOrKey/spend-limitTenantCompare-and-swap idle spend limit update ({ spendLimitUsd, expectedSpendLimitUsd })
PUT /v2/agents/:idOrKey/repoTenantEnsure a repository is provisioned for the agent
DELETE /v2/agents/:idOrKeyTenantDestroy agent Durable Object and index entry ({ deleted: true })
POST /v2/agents/:idOrKey/runsTenant or AgentStart a run ({ prompt, actor?, keyScope?, files?, idempotencyKey?, whileRunning?, wait?, outputSchema?, maxSteps?, spendLimitUsd? }). Note: actor requires Tenant auth; spendLimitUsd requires whileRunning: "queue".
GET /v2/agents/:idOrKey/runsTenant or Agent{ cursor, activeRunId, runs }
GET /v2/agents/:idOrKey/runs/:runIdTenant or AgentGet a RunRecord (add ?by=idempotency-key to look up by idempotencyKey)
POST /v2/agents/:idOrKey/abortTenant or AgentAbort active run and optionally keep queued runs ({ keepQueued?: boolean }) -> { aborted: true, cancelledRunIds }
GET /v2/agents/:idOrKey/eventsTenant or Agent (or ?token=)SSE stream when Accept: text/event-stream (?after=0&runId=&follow=1, supports Last-Event-ID), or JSON page (?after=0|latest&runId=)
GET /v2/agents/:idOrKey/wsTenant or Agent (or ?token=)Hibernatable WebSocket for live events and bidirectional local tool calls (register_tools, tool_call, tool_result, ping/pong)
GET /v2/agents/:idOrKey/historyTenant or AgentConversation history (?after=0&limit=50 or ?before=latest|<seq>&limit=50) -> { messages, compaction, nextAfter, nextBefore? }
GET /v2/agents/:idOrKey/history/importTenantRead v1 history import proof (Cache-Control: no-store)
PUT /v2/agents/:idOrKey/history/importTenantImport v1 conversation history into a fresh agent
PUT /v2/agents/:idOrKey/history/import/chunkTenantAppend a chunked v1 history import (max 1 MiB per chunk)
POST /v2/agents/:idOrKey/compactTenant or AgentCompact history ({ summary?, keepLast? }) -> { summary, upToSeq, compactedCount }
POST /v2/agents/:idOrKey/reset-contextTenant or AgentReset active context ({ summary?, keepLast? }) -> { ok: true, upToSeq, summary }
POST /v2/agents/:idOrKey/forkTenantFork agent and CamelFS repo ({ key?, atSeq? })
GET /v2/agents/:idOrKey/inputsTenant or AgentList runs with pending inputs ({ runs })
POST /v2/agents/:idOrKey/inputs/:inputIdTenant or AgentRespond to a pending input ({ approved?, answer?, wait?, actor? }). Signed MCP inputs and actor-bound runs require Tenant auth.
POST /v2/agents/:idOrKey/schedulesTenantCreate schedule ({ prompt, intervalSeconds?, cronExpr? | cron? }) -> 201
GET /v2/agents/:idOrKey/schedulesTenant or AgentList schedules ({ schedules })
DELETE /v2/agents/:idOrKey/schedules/:scheduleIdTenantDelete schedule ({ deleted: true })
POST /v2/agents/:idOrKey/workflowsTenant or AgentExecute replay workflow ({ code, idempotencyKey?, wait? }) -> 200 (completed) or 422 (failed)
POST /v2/agents/:idOrKey/dreamTenant or AgentRun memory consolidation to /workspace/MEMORY.md

PUT /v2/agents/:key request body

json
{
  "model": "azure/gpt-6.2-sol",
  "keyScope": null,
  "instructions": "Be concise.",
  "definition": "optional-slug",
  "tools": [
    {
      "name": "lookupOrder",
      "description": "Look up an order",
      "parameters": { "type": "object", "properties": { "orderId": { "type": "string" } }, "required": ["orderId"] },
      "url": "https://app.example.com/tools/lookup-order",
      "headers": { "X-Secret": "..." },
      "requiresApproval": false
    }
  ],
  "mcpServers": [
    {
      "name": "app",
      "url": "https://app.example.com/mcp",
      "auth": { "type": "runtime" },
      "audience": "https://app.example.com/mcp",
      "allowTools": ["read_project"]
    }
  ],
  "toolIdentity": { "subject": "user_42", "context": { "orgId": "org_1" } },
  "builtins": ["files", "images", "bash", "codemode", "delegate", "workflows", "web_search", "web_fetch", "human"],
  "queue": { "mode": "each", "windowMs": 0 },
  "repoId": "repo_...",
  "branch": "refs/heads/main",
  "spendLimitUsd": 10,
  "idleTtlSeconds": 86400,
  "dreaming": { "enabled": false, "idleSeconds": 3600 }
}

Stateless runs and decisions

Method and pathAuthDescription
POST /v2/runsTenantOne-shot stateless run ({ input, model?, instructions?, outputSchema?, tools?, maxSteps? })
POST /v2/decisionsTenantCalibrated classification ({ input, choices, instructions?, model? }) -> { choice, confidence, scores, costUsd }

Voice calls and sessions

Method and pathAuthDescription
POST /v2/voice/callsTenant or AgentStart a managed OpenAI or ElevenLabs voice call -> 201 with connect
GET /v2/voice/callsTenantList calls (?state=live|ended&limit=50) -> { calls, next }
GET /v2/voice/calls/:idTenant or AgentGet call details
PATCH /v2/voice/calls/:idTenant or AgentUpdate speakers or metadata
POST /v2/voice/calls/:id/transcriptTenant or AgentRecord a transcript utterance (202)
POST /v2/voice/calls/:id/endTenant or AgentEnd a call ({ reason? })
DELETE /v2/voice/calls/:idTenant or AgentEnd a call
POST /v2/voice/providers/elevenlabs/post-callElevenLabs HMACElevenLabs post-call callback
POST /v2/voice/providers/elevenlabs/tools/:toolTool secretElevenLabs tool bridge (ask_agent or stay_silent)
POST /v2/voice/sessionsTenant or AgentCreate an agent realtime voice session ({ agentIdOrKey, provider?, voice?, instructions? })
GET /v2/voice/sessions/:idTenant or AgentGet voice session info
POST /v2/voice/sessions/:id/toolTenant or AgentExecute an agent tool from a voice session ({ name, args?, callId? })
GET /v2/voice/sessions/:id/wsTenant or Agent (or ?token=)WebSocket bridge for voice session tool execution

Channels, media, and webhooks

Method and pathAuthDescription
POST /v2/channelsTenantCreate a slack, email, or http channel (201)
GET /v2/channelsTenantList channels ({ channels })
DELETE /v2/channels/:idTenantDelete channel ({ deleted: true })
POST /v2/channels/:id/inboundTenant or Channel HMACDeliver inbound message to thread-keyed agent
POST /v2/transcriptionsTenantSpeech-to-text (multipart file or JSON audioBase64)
POST /v2/speechTenantText-to-speech ({ input, voice?, model?, format? }) -> audio bytes + X-Media-Id
GET /v2/voices/searchTenantSearch voices (?provider=elevenlabs|openai|grok|gemini&q=&category=&limit=10)
POST /v2/imagesTenantGenerate image ({ prompt, model?, size? }) -> { id, url, contentType, sizeBytes, costUsd }
POST /v2/images/renderTenantRender SVG to PNG ({ svg, files?, format?: "png" }) -> { contentType, width, height, data }
GET /v2/images/:idOptional TenantFetch stored image bytes
POST /v2/moderations/imagesTenantModerate raw image/jpeg or image/png (up to 5 MiB)
POST /v2/webhooksTenantRegister webhook endpoint ({ url, events?, secret? }) -> 201
GET /v2/webhooksTenantList webhooks ({ webhooks })
DELETE /v2/webhooks/:idTenantDelete webhook ({ deleted: true })