Skip to main content

API Reference

AgentFlow exposes a comprehensive REST API with SSE streaming support. All endpoints require Bearer token authentication unless noted otherwise.

Base URL

https://your-instance.agentflow.ai

Authentication

Include your AgentFlow-issued bearer token in the Authorization header:
curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://your-instance.agentflow.ai/api/v1/agents

Interactive documentation

Interactive API documentation is available on every AgentFlow deployment:
FormatURLDescription
Swagger UI/docsInteractive API explorer with try-it-out
ReDoc/redocClean, readable API reference
OpenAPI spec/openapi.jsonMachine-readable spec for code generation

Endpoint groups

System

MethodPathDescription
GET/Health check (API status)
GET/healthDetailed health check (API + memory)
GET/readyReadiness probe (verifies database)
GET/api/v1/agents/statsAgent registry statistics
GET/api/v1/modelsList available LLM models with capabilities and pricing

Usage and budgets

These routes require an authenticated human admin principal. Configure accepted scopes with AGENTFLOW_ADMIN_SCOPES.
MethodPathDescription
GET/api/v1/admin/usage/summary?range=7dAggregate tenant usage for 7d, 30d, 90d, or all
GET/api/v1/admin/budgetGet tenant monthly LLM budget override, effective cap, and reset timestamp
PUT/api/v1/admin/budgetSet or clear the tenant monthly LLM budget override
GET/api/v1/admin/budget/usersGet per-user monthly budget caps and current-month spend
PUT/api/v1/admin/budget/usersSet or clear a user’s monthly budget override

Agents

MethodPathDescription
GET/api/v1/agentsList all agents
GET/api/v1/agent/{id}Get agent details
GET/api/v1/agent/{id}/configGet agent configuration
PATCH/api/v1/agent/{id}/configUpdate agent configuration
DELETE/api/v1/agent/{id}Delete an agent
Agent discovery uses the plural /api/v1/agents route. Agent-specific management and execution routes keep the singular /api/v1/agent/{id} prefix.

Agent execution

MethodPathDescription
POST/api/v1/agent/{id}/chatChat with an agent (streaming or non-streaming)
POST/api/v1/agent/{id}/tools/{tool}/runExecute a specific tool
POST/api/v1/agent/{id}/subagents/{sub_id}/runRun a sub-agent directly
POST/api/v1/agent/{id}/context/preloadPreload cacheable context blocks for one agent

Sub-agents

MethodPathDescription
GET/api/v1/agent/{id}/subagentsList sub-agents
POST/api/v1/agent/{id}/subagentsCreate a sub-agent
GET/api/v1/agent/{id}/subagents/{sub_id}Get sub-agent details
GET/api/v1/agent/{id}/subagents/{sub_id}/configGet sub-agent configuration
PATCH/api/v1/agent/{id}/subagents/{sub_id}Update sub-agent
DELETE/api/v1/agent/{id}/subagents/{sub_id}Delete sub-agent
GET/api/v1/agent/{id}/subagents/{sub_id}/toolsList sub-agent tools
POST/api/v1/agent/{id}/subagents/{sub_id}/toolsAssign tool to sub-agent
DELETE/api/v1/agent/{id}/subagents/{sub_id}/tools/{tool}Remove tool from sub-agent
GET/api/v1/agent/{id}/subagents/{sub_id}/available-toolsList available tools for assignment

Tools

MethodPathDescription
GET/api/v1/agent/{id}/toolsList agent tools
GET/api/v1/agent/{id}/tools/{tool}Get tool details
POST/api/v1/agent/{id}/toolsRegister a new tool
PATCH/api/v1/agent/{id}/tools/{tool}Update a persisted tool
POST/api/v1/agent/{id}/tools/generateGenerate tool code from description
POST/api/v1/agent/{id}/tools/dry-runTest tool execution in sandbox
POST/api/v1/agent/{id}/tools/persistSave generated tool permanently
PUT/api/v1/agent/{id}/tools/{tool}/approvalConfigure tool approval
DELETE/api/v1/agent/{id}/tools/{tool}Remove a tool

Capabilities

MethodPathDescription
POST/api/v1/agent/{id}/capability/retrieveInvoke retrieval capability
POST/api/v1/agent/{id}/capability/planInvoke planning capability
POST/api/v1/agent/{id}/capability/reflectInvoke reflection capability

Prompt blocks

MethodPathDescription
GET/api/v1/prompt-blocksList registered static and local dynamic prompt blocks
POST/api/v1/prompt-blocksCreate a DB-backed static prompt block
GET/api/v1/prompt-blocks/{name}Get prompt block metadata and static body when available
PATCH/api/v1/prompt-blocks/{name}Update static body or dynamic metadata overrides
DELETE/api/v1/prompt-blocks/{name}Delete DB-backed static blocks or dynamic metadata overrides
POST/api/v1/prompt-blocks/{name}/previewPreview one wrapped prompt block
POST/api/v1/prompt-blocks/{name}/invalidate-cacheClear cached output for a dynamic block

Context blocks

MethodPathDescription
GET/api/v1/agent/{id}/context/blocksList registered context blocks for an agent
POST/api/v1/agent/{id}/context/blocks/buildBuild and return rendered context block content
POST/api/v1/agent/{id}/context/preloadPreload cacheable context blocks for one agent

Skills

MethodPathDescription
GET/api/v1/skillsList all discovered skills
GET/api/v1/skills/{name}Get skill by name (includes full playbook body)
GET/api/v1/skills/{name}/contentGet skill content or support file
GET/api/v1/agent/{id}/skillsList skills assigned to a specific agent

Knowledge bases

MethodPathDescription
GET/api/v1/knowledge-basesList all knowledge bases
GET/api/v1/knowledge-bases/{id}Get KB details
POST/api/v1/knowledge-bases/create-from-urlCreate KB from URL
POST/api/v1/knowledge-basesCreate KB from uploaded files
POST/api/v1/knowledge-bases/searchSearch across multiple knowledge bases
POST/api/v1/knowledge-bases/{id}/searchSearch a knowledge base
POST/api/v1/knowledge-bases/{id}/documentsAdd documents to KB
POST/api/v1/knowledge-bases/{id}/documents/filterFilter documents by metadata
GET/api/v1/knowledge-bases/{id}/filesList files in KB
GET/api/v1/knowledge-bases/{id}/documentsList documents (chunks)
GET/api/v1/knowledge-bases/{id}/summaryGet KB summary
GET/api/v1/knowledge-bases/{id}/metadata-schemaGet KB metadata schema
GET/api/v1/knowledge-bases/{id}/contentBrowse KB content
GET/api/v1/knowledge-bases/{id}/chunks/{chunk_id}Get chunk details
GET/api/v1/knowledge-bases/search-defaultsGet search parameter defaults
PUT/api/v1/knowledge-bases/{id}Update KB metadata
POST/api/v1/knowledge-bases/{id}/refreshRe-index KB
POST/api/v1/knowledge-bases/{id}/documents/{doc_id}/refreshRefresh a specific document
POST/api/v1/knowledge-bases/previewPreview chunking (SSE supported)
DELETE/api/v1/knowledge-bases/{id}Delete KB
DELETE/api/v1/knowledge-bases/{id}/documents/{doc_id}Delete document

Agent-scoped knowledge bases

MethodPathDescription
GET/api/v1/agents/{id}/knowledge-basesList KBs bound to agent
POST/api/v1/agents/{id}/knowledge-bases/{kb_id}Bind KB to agent
DELETE/api/v1/agents/{id}/knowledge-bases/{kb_id}Unbind KB from agent
POST/api/v1/agents/{id}/knowledge-bases/{kb_id}/searchSearch KB through agent

Documents

MethodPathDescription
GET/api/v1/documents/viewerFetch parsed text for an attachment or KB document

Conversations

MethodPathDescription
POST/api/v1/conversationsCreate a conversation
GET/api/v1/conversationsList conversations
GET/api/v1/conversations/searchSearch conversation titles and chat history
GET/api/v1/conversations/{id}Get conversation metadata
GET/api/v1/conversations/{id}/messagesList flat chat messages
POST/api/v1/conversations/{id}/messagesAdd a user message
GET/api/v1/conversations/{id}/cached-results/{cache_id}Retrieve a cached tool result payload
GET/api/v1/conversations/{id}/cached-results/{cache_id}/itemsRetrieve cached tool result items
GET/api/v1/conversations/{id}/timelineGet UI-ready conversation timeline
GET/api/v1/conversations/{id}/streamStream durable conversation snapshots
GET/api/v1/conversations/{id}/runsList execution runs
GET/api/v1/conversations/{id}/markersList conversation markers
GET/api/v1/conversations/{id}/llm-formatExport in LLM format
PUT/api/v1/conversations/{id}Update conversation metadata
DELETE/api/v1/conversations/{id}Delete conversation
GET/api/v1/agent/conversations/{id}/titleGet conversation title
PUT/api/v1/agent/conversations/{id}/titleUpdate title
POST/api/v1/agent/conversations/{id}/title/generateGenerate title from content
POST/api/v1/agent/{id}/conversations/{conv_id}/compressCompact chat history

Approvals

MethodPathDescription
GET/api/v1/approvals/pendingList pending approvals
GET/api/v1/approvals/{id}Get approval details
POST/api/v1/approvals/{id}/respondApprove, deny, or approve with modified arguments
DELETE/api/v1/approvals/{id}Cancel approval
POST/api/v1/approvals/bulk-respondBulk approve/deny
GET/api/v1/approvals/tools/{tool_id}/statsTool approval statistics
GET/api/v1/approvals/dashboard/summaryDashboard summary
POST/api/v1/approvals/cleanup-expiredClean up expired requests

Questions

MethodPathDescription
POST/api/v1/questions/{question_id}/respondRespond to an agent question

Artifacts

MethodPathDescription
GET/api/v1/artifacts/typesList registered artifact types with UI metadata
GET/api/v1/artifacts/{artifact_id}Get artifact content and state
GET/api/v1/artifacts/conversation/{conversation_id}List artifacts in a conversation
PATCH/api/v1/artifacts/{artifact_id}/stateUpdate artifact state (sent, scheduled, etc.)
PATCH/api/v1/artifacts/{artifact_id}/contentEdit artifact content inline
POST/api/v1/artifacts/{artifact_id}/create-taskCreate a task from a draft artifact
POST/api/v1/artifacts/{artifact_id}/schedule-meetingSchedule meeting via Google Calendar
POST/api/v1/artifacts/{artifact_id}/scheduled-taskCreate/update scheduled agent task
POST/api/v1/artifacts/{artifact_id}/scheduled-task/activeToggle scheduled task active/inactive
DELETE/api/v1/artifacts/{artifact_id}/scheduled-taskDelete scheduled task
POST/api/v1/artifacts/{artifact_id}/interactionRecord user interaction with artifact
GET/api/v1/artifacts/{artifact_id}/downloadDownload artifact as DOCX

Cancellation

MethodPathDescription
GET/api/v1/cancel/active-callsList active executions
POST/api/v1/cancel/{call_id}Cancel specific execution
POST/api/v1/cancel/allCancel all executions
POST/api/v1/cancel/background-task/{task_id}Cancel a background task

LLM

MethodPathDescription
POST/api/v1/llm/chatDirect LLM chat (SSE supported)
POST/api/v1/llm/autocompleteText autocomplete
POST/api/v1/llm/recommendContent recommendations
GET/api/v1/llm/configGet tenant LLM mode, provider configs, allowlist, and default map
POST/api/v1/llm/configSave one encrypted BYO provider key and model policy
PUT/api/v1/llm/config/modeSwitch tenant between platform and BYO keys
GET/api/v1/llm/config/model-optionsList models and backend use cases admins can map
POST/api/v1/llm/config/test-keyValidate a provider key without storing it
DELETE/api/v1/llm/config/{config_uuid}Delete one BYO provider configuration

Email

MethodPathDescription
POST/api/v1/emails/draftDraft an email
POST/api/v1/emails/draft-replyDraft a reply email
POST/api/v1/emails/draft-emailDraft a new email
POST/api/v1/emails/sendSend an email
POST/api/v1/emails/querySearch emails

Meetings

MethodPathDescription
POST/api/v1/meetings/summarize-transcriptSummarize a meeting transcript

Tasks

MethodPathDescription
GET/api/v1/tasksList tasks
POST/api/v1/tasksCreate a task
GET/api/v1/tasks/{uuid}Get task details
PATCH/api/v1/tasks/{uuid}Update a task
POST/api/v1/tasks/{uuid}/toggleToggle task active/inactive
DELETE/api/v1/tasks/{uuid}Delete a task

Activity timeline

MethodPathDescription
POST/api/v1/activity/timelineCross-domain communication timeline for accounts/contacts

Files & attachments

MethodPathDescription
POST/api/v1/attachmentsUpload an attachment
GET/api/v1/attachmentsList attachments
GET/api/v1/attachments/{file_id}Get attachment metadata
GET/api/v1/attachments/{file_id}/contentGet attachment content
GET/api/v1/attachments/{file_id}/downloadDownload attachment
DELETE/api/v1/attachments/{file_id}Delete an attachment
POST/api/v1/s3/uploadUpload file to S3
POST/api/v1/filesUpload file for batch processing (CSV/JSON, up to 100MB)

Completions (sync)

MethodPathDescription
POST/api/v1/completions/runRun batch operation (up to 50 items)
POST/api/v1/completions/labelClassify items against categories
POST/api/v1/completions/extractExtract structured data
POST/api/v1/completions/summarizeSummarize content
POST/api/v1/completions/enrichEnrich data with computed fields
POST/api/v1/completions/chatDirect LLM chat
POST/api/v1/completions/recommendContent recommendations
POST/api/v1/completions/autocompleteText autocomplete

Batches (async)

MethodPathDescription
POST/api/v1/batchesSubmit async batch job
GET/api/v1/batches/{batch_id}Get batch status and progress
GET/api/v1/batches/{batch_id}/outputRead paginated output as JSON, JSONL, or CSV
POST/api/v1/batches/{batch_id}/cancelCancel a running batch

User settings & personalization

MethodPathDescription
GET/api/v1/settingsGet merged user settings
PATCH/api/v1/settingsUpdate user settings (deep merge)
POST/api/v1/settings/resetReset to platform defaults
GET/api/v1/settings/defaultsGet platform default settings

Memory

MethodPathDescription
GET/api/v1/memory/blocksList all memory blocks
GET/api/v1/memory/blocks/{type}Get a specific memory block
PUT/api/v1/memory/blocks/{type}Compare-and-set update a memory block
DELETE/api/v1/memory/blocks/{type}Delete a memory block
POST/api/v1/memory/recallSearch archival memory

Voice (Vapi)

MethodPathDescription
POST/api/vapi/webhookVapi webhook receiver (status, transcripts, end-of-call reports)
GET/api/calls/lookup/by-phoneLook up active call by phone number
GET/api/calls/{vapi_call_id}Get live call state