Skip to content

REST API

The Agentcy HTTP API is served by agentcy-api (Axum 0.8). All routes live under the /api/v1 prefix.

  • Base URL (self-hosted default): http://localhost:8080/api/v1
  • Auth: JWT (Bearer token) for user routes. Local provider signs with JWT_SECRET (HS256). OIDC provider verifies via JWKS (RS256). Some routes use other auth (worker tokens, webhook HMAC, pipeline JWT) — noted below.
  • Content type: application/json unless otherwise noted.
  • Streaming: chat uses Server-Sent Events (SSE). WebSocket updates (graph changes, task runs) go through a separate endpoint exposed by agentcy-ws.

Quickstart — authenticate and chat

bash
# 1. Log in
TOKEN=$(curl -s http://localhost:8080/api/v1/auth/login \
  -H 'content-type: application/json' \
  -d '{"email":"admin@localhost","password":"admin"}' \
  | jq -r .token)

# 2. List connectors
curl -s http://localhost:8080/api/v1/sources \
  -H "authorization: Bearer $TOKEN" | jq

# 3. Create a conversation and send a message (SSE stream)
CONV=$(curl -s http://localhost:8080/api/v1/chat/conversations \
  -H "authorization: Bearer $TOKEN" \
  -H 'content-type: application/json' \
  -d '{"title":"hello"}' | jq -r .id)

curl -N http://localhost:8080/api/v1/chat/conversations/$CONV/messages \
  -H "authorization: Bearer $TOKEN" \
  -H 'content-type: application/json' \
  -d '{"content":"list my kubernetes pods"}'

Route groups

All paths below are relative to /api/v1. Columns: path prefix · auth · purpose · source file.

Public (no JWT)

PrefixAuthPurposeFile
/healthnoneReadiness + feature flags + DB reachability.routes/health.rs
/authnonePOST /login, POST /register, GET /me, OIDC callbacks.routes/auth.rs
/sources/oauth/*noneOAuth callback receivers (GitHub, Google, Read.ai, ...).routes/sources.rs::public_router
/hooks/*HMACInbound webhook receiver. Signature in X-Agentcy-Signature.routes/webhook_receiver.rs
/chat/incoming/*shared secretInbound chat webhooks (channels, forms).routes/chat.rs::incoming_webhook_router
/pipeline-agent/*pipeline JWTAgent run inside a pipeline execution.routes/pipeline_agent.rs
/cli/*noneCLI binary download + install script.routes/cli_download.rs::public_router
/sandbox/preview/*?token=Sandbox preview proxy, self-auth via query token for iframe use.routes/sandbox_preview.rs::preview_router
/workers (worker routes)worker tokenWorker daemon registration + heartbeat.routes/workers.rs::worker_auth_routes

JWT-protected (user session)

PrefixPurposeFile
/graphNode search, subgraph expansion, Cypher, stats.routes/graph.rs
/sourcesConnector CRUD, validate, sync, jobs, sync history.routes/sources.rs
/ingestionRun ingestion jobs, monitor pipelines.routes/ingestion.rs
/chatConversations, messages (SSE), tool calls, approvals.routes/chat.rs
/agentsRegistered agents, execution.routes/agents.rs
/settingsOrg settings, LLM config, feature flags.routes/settings.rs
/api-keysAPI key CRUD + rotation.routes/api_keys.rs
/activityActivity feed, audit log.routes/activity.rs
/webhooksWebhook CRUD, delivery log.routes/webhooks.rs
/webhook-samplesCanned payloads for triggering test webhooks.routes/webhook_samples.rs
/tasksScheduled tasks, manual triggers, run history.routes/tasks.rs
/task-recommendationsSuggested tasks from graph analysis.routes/task_recommendations.rs
/channelsChannel catalog, configure, QR flow, bindings, test, reload.routes/channels.rs
/cron-channelsCron-triggered channel messages.routes/tasks.rs
/platformPlatform admin — orgs, invites, users.routes/platform_admin.rs
/skillsCustom skill CRUD, approval workflow.routes/skills.rs
/artifactsArtifact metadata + download links.routes/artifacts.rs
/sandboxesSandbox port mappings, session lookup.routes/sandbox_preview.rs::ports_router
/pipelinesPipeline definitions, runs, revert.routes/pipelines.rs
/notificationsNotifications history + mark-read.routes/notifications.rs
/usersCurrent user profile, org membership.routes/users.rs
/memoryOrg memory CRUD, recall, graph sync.routes/memory.rs
/realmsRealm CRUD, list available.routes/realms.rs
/ciab-nativeCIAB coding-agent tools (local + EC2 runtimes).routes/ciab_native.rs

Feature-gated (JWT)

PrefixFlagFile
/ragfeatures.ragroutes/rag.rs
/workers (user endpoints)features.workersroutes/workers.rs::worker_user_routes
/orchestratorfeatures.orchestratorroutes/orchestration_gateway
/voicefeatures.voiceroutes/voice.rs
/ciabCargo feature connectors-devagentcy_source_ciab::proxy::router
/policiesfeatures.policiesroutes/policies.rs (adds policy middleware)

Auth

Local

http
POST /api/v1/auth/login
{
  "email": "admin@localhost",
  "password": "admin"
}
json
{
  "token": "eyJ...",
  "expires_at": "2026-04-25T12:00:00Z",
  "user": { "id": "...", "email": "admin@localhost", "role": "owner" }
}

OIDC

Configure at boot:

env
AUTH_PROVIDER=oidc
JWKS_URL=https://your-issuer/.well-known/jwks.json
JWT_ISSUER=https://your-issuer
JWT_AUDIENCE=agentcy

The API then accepts bearer tokens issued by the configured IdP.

API keys

Long-lived programmatic access, scoped per org. Create via POST /api-keys. Pass as Authorization: Bearer <key> — the auth middleware accepts both JWTs and API keys.

Worker tokens

Worker daemons authenticate with a separate token (set via WORKER_TOKEN) on /workers endpoints — not user-facing.

Webhook signatures

Inbound webhooks on /hooks/* are HMAC-signed. Header: X-Agentcy-Signature: sha256=<hex>. Secret is per-webhook, returned at creation.

Chat streaming

http
POST /api/v1/chat/conversations/:id/messages
Content-Type: application/json
Authorization: Bearer <jwt>

{ "content": "how many pods are down?" }

Response is SSE. Each chunk is one of:

event: message_start
data: {"message_id":"..."}

event: content_delta
data: {"delta":"I'll check the cluster..."}

event: tool_call_start
data: {"tool_call_id":"...","name":"execute_connector_tool","connector":"kubernetes"}

event: approval_required
data: {"approval_id":"...","tool":"execute_connector_tool","args":{...}}

event: tool_result
data: {"tool_call_id":"...","result":{...}}

event: message_end
data: {"finish_reason":"end_turn","usage":{...}}

Respond to an approval:

http
POST /api/v1/chat/conversations/:id/approvals/:approval_id
{ "approved": true }

See Tool Calling & the Catalog and Approval Flows for the full flow.

Health check

http
GET /api/v1/health
json
{
  "status": "ok",
  "features": {
    "rag": true, "workers": true, "orchestrator": false,
    "voice": false, "policies": false
  },
  "dependencies": {
    "postgres": "ok",
    "neo4j":    "ok",
    "redis":    "ok",
    "llm":      "ok"
  }
}

Errors

All error responses use a consistent shape:

json
{
  "error": {
    "code": "source_validation_failed",
    "message": "GitHub token is missing required scopes",
    "details": { "missing_scopes": ["repo"] }
  }
}

Common status codes:

CodeMeaning
400Validation error (bad payload).
401Missing or invalid auth.
403Policy deny (audited).
404Resource not found / wrong org.
409Conflict (e.g. duplicate name, sync in progress).
422Upstream provider rejected (e.g. invalid credentials).
429Rate limited.
503Sidecar unavailable (OpenFang off, worker down, etc.).

Pagination

Collection endpoints take ?limit (default 50, max 200) and ?cursor. Responses include:

json
{
  "items": [...],
  "next_cursor": "eyJ...",
  "total": 127
}

Idempotency

Mutating endpoints that create records accept Idempotency-Key: <uuid>. Safe to retry — duplicates return the original resource.

Clients

  • Official SDKs — internal agentcy-sdk crate for Rust; Next.js client in frontend/lib/api/client.ts for the web UI.
  • OpenAPI — the server exposes an OpenAPI 3.1 document at GET /api/v1/openapi.json (when the feature is built with --features openapi-schema). Use it to generate clients.
  • curl — all examples on this page are copy-pasteable.

Next steps

Built by AgentcyLabs. For in-house deployment or Agentcy Cloud (PaaS) access, visit agentcylabs.com.