API Reference
All endpoints are available at https://app.fleetrun.app. Two authentication methods are supported: session cookies (browser) and API key Bearer tokens (programmatic access).
Authentication
Cookie-based (browser / SSR)
Log in via POST /api/auth/login. On success the server sets anfr_session cookie that is included automatically on subsequent requests from the same browser. No extra headers are required.
curl -X POST https://app.fleetrun.app/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"••••••••"}' \
-c cookies.txt
# Subsequent requests use the saved cookie
curl https://app.fleetrun.app/api/me -b cookies.txtAPI key (programmatic)
Create a key at Settings → API Keys (or via POST /api/keys). Keys have the prefix fr_ and are org-scoped. Pass the key in the Authorization header:
Authorization: Bearer fr_xxxxxxxxxxxxxxxxxxxxxxxx# List agents using an API key
curl https://app.fleetrun.app/api/agents \
-H "Authorization: Bearer fr_xxxxxxxxxxxxxxxxxxxxxxxx"
# Create a task
curl -X POST https://app.fleetrun.app/api/tasks \
-H "Authorization: Bearer fr_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"title":"Summarise report","input":"...","assignee":"agt_abc123"}'API keys are only shown once at creation. Store them in a secret manager. Revoke a key at any time via DELETE /api/keys/[id].
Rate Limiting
Rate limits apply to mutating methods (POST, PATCH, PUT, DELETE) only. GET and HEAD requests are not rate-limited. Limits are enforced per authenticated identity (user or API key) within a 60-second sliding window.
/api/tasks/api/agents/api/messagesAll other mutating routesWhen a limit is exceeded the API returns 429 Too Many Requests with a Retry-After header containing the number of seconds to wait before retrying:
HTTP/2 429
Retry-After: 14
Content-Type: application/json
{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Please slow down.",
"retryable": true
}
}Error Codes
All error responses share this shape:
{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Please slow down.",
"retryable": true
}
}The retryable flag indicates whether repeating the identical request after a delay is likely to succeed.
UNAUTHORIZEDFORBIDDENNOT_FOUNDRATE_LIMITEDTASK_LIMIT_REACHEDVALIDATION_ERRORDB_ERROREndpoints
/api/agents/api/agents/api/agents/[id]/api/agents/[id]/api/agents/[id]/api/tasks/api/tasks/api/tasks/[id]/api/tasks/[id]/api/run/api/messages/api/secrets/api/secrets/api/secrets/api/mcps/api/mcps/api/usage/api/me/api/search/api/export/tasks/api/export/agents/api/export/audit/api/keys/api/keys/api/keys/[id]/api/audit/api/workspaces/api/workspaces/[id]/api/workspaces/[id]/api/workspaces/[id]/members/api/health/agentsDetailed reference
/api/agentsList all agents in the org.
Returns
Array of Agent objects.
/api/agentsCreate a new agent.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Display name. |
role | string | yes | System prompt / role description. |
model | string | yes | Model ID (e.g. claude-sonnet-4-5). |
provider | string | yes | Provider key (anthropic | openai | openrouter). |
glyph | string | yes | Single emoji used as the agent avatar. |
manager | string | no | Agent ID of this agent's supervisor. |
team | string | no | Team name to assign the agent to. |
Returns
Created Agent object.
/api/agents/[id]Get a single agent by ID.
Returns
Agent object.
/api/agents/[id]Update agent fields (name, role, model, status, etc.).
Returns
Updated Agent object.
/api/agents/[id]Archive an agent (soft delete).
Returns
{ ok: true }
/api/tasksList tasks. Supports filtering by status and assignee.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
status | string | no | Filter by status (pending | running | done | error | waiting). |
assignee | string | no | Filter by agent ID. |
Returns
Array of Task objects, most recent first.
/api/tasksCreate a new task.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
title | string | yes | Short label for the task. |
input | string | yes | Full prompt / payload sent to the agent. |
assignee | string | yes | Agent ID to assign the task to. |
requester | string | no | Agent ID that created the task. |
priority | string | no | low | normal | high. Defaults to normal. |
epic_id | string | no | Associate with an epic. |
Returns
Created Task object.
/api/tasks/[id]Get a single task by ID.
Returns
Task object with full log history.
/api/tasks/[id]Update task fields (status, priority, assignee).
Returns
Updated Task object.
/api/runExecute a task. Returns a Server-Sent Events stream of execution events.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
taskId | string | yes | ID of the task to run. |
Returns
SSE stream. Events: { type, text } — types include thinking, tool_call, tool_result, output, error.
/api/messagesList messages on the bus. Supports filtering by agent, type, and time range.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
agent | string | no | Filter by agent ID (sender or receiver). |
type | string | no | Filter by message type. |
limit | number | no | Max results. Default 100, max 500. |
Returns
Array of Message objects.
/api/secretsList secret keys (values are never returned).
Request body
| Field | Type | Required | Description |
|---|---|---|---|
scope | string | no | org | agent. Defaults to org. |
agent | string | no | Agent ID for agent-scoped secrets. |
Returns
Array of { key, scope, agentId, updatedAt }.
/api/secretsCreate or update a secret.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
key | string | yes | Secret key name (uppercase, underscores). |
value | string | yes | Secret value — encrypted at rest. |
scope | string | no | org | agent. Defaults to org. |
agentId | string | no | Required for agent-scoped secrets. |
Returns
{ ok: true }
/api/secretsDelete a secret by key and scope.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
key | string | yes | Secret key to delete. |
scope | string | no | org | agent. |
Returns
{ ok: true }
/api/mcpsList all configured MCP servers.
Returns
Array of MCP server objects.
/api/mcpsAdd a new MCP server.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Unique name for this MCP server. |
transport | string | yes | stdio | http. |
command | string | no | Executable for stdio transport. |
args | string[] | no | Arguments for the command. |
url | string | no | URL for http transport. |
env | object | no | Environment variables (can reference secrets). |
Returns
Created MCP server object.
/api/usageGet token usage and task counts for the org, optionally broken down by agent or model.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
period | string | no | day | week | month. Defaults to month. |
agent | string | no | Filter to a specific agent. |
Returns
Usage summary: { total_tokens, task_count, by_agent, by_model, daily_breakdown }.
/api/meReturn the authenticated user and org details.
Returns
User object with org, plan, and feature flags.
/api/searchFull-text search across agents and tasks.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
q | string | yes | Search query string. |
type | string | no | Scope: agents | tasks. Omit to search both. |
Returns
Array of matching Agent or Task objects tagged with a type field.
/api/export/tasksExport all tasks as a JSON download.
Returns
JSON file attachment containing all task records.
/api/export/agentsExport all agents as a JSON download.
Returns
JSON file attachment containing all agent records.
/api/export/auditExport the full audit log as a JSON download.
Returns
JSON file attachment containing all audit log entries.
/api/keysList all API keys for the org (secret values are never returned).
Returns
Array of { id, name, prefix, createdAt, lastUsedAt }.
/api/keysCreate a new API key.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Human-readable label for this key. |
Returns
{ id, name, key } — the full key is only returned once at creation time.
/api/keys/[id]Revoke an API key by ID.
Returns
{ ok: true }
/api/auditList audit log entries for the org.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
limit | number | no | Max results. Default 100. |
before | string | no | Cursor (ISO timestamp) for pagination. |
Returns
Array of AuditEntry objects ordered newest first.
/api/workspacesList all workspaces (orgs) the authenticated user belongs to.
Returns
Array of Workspace objects.
/api/workspaces/[id]Get a single workspace by ID.
Returns
Workspace object with members and plan details.
/api/workspaces/[id]Update workspace settings (name, etc.).
Returns
Updated Workspace object.
/api/workspaces/[id]/membersList members of a workspace.
Returns
Array of WorkspaceMember objects.
/api/health/agentsHealth check for all agents — reports which agents are reachable and their last heartbeat.
Returns
Array of { agentId, status, lastSeen }.
Webhooks Planned
Webhook support is on the roadmap. Once available, you will be able to register an HTTPS endpoint that receives a POST with a signed JSON payload whenever one of the following events fires:
task.completedtask.failedagent.errorAll webhook payloads will include a signature in the X-FleetRun-Signature header for verification.
HTTP status codes
400401403404429500