Sessions API
Create and manage agent sessions over REST: send and stream messages, answer decisions, approve plans, and read artifacts, sub-sessions, and usage.
Create a Session
/api/v1/sessionsRequires sessions:write permission.
Request
{
"initialMessage": "Investigate the spike in API latency",
"sessionType": "GENERAL",
"sourceType": "MANUAL",
"harnessId": "harness_abc123",
"modelConfiguration": {
"modelKey": "claude-sonnet-4-6"
}
}All fields are optional. Send an empty body {} to create a session with your account defaults.
| Param | Default | Description |
|---|---|---|
initialMessage | — | First message sent to the agent. When omitted, the session starts idle and awaits input. |
sessionType | GENERAL | One of GENERAL, PLAN, TASK_EXECUTOR, MACHINE_SETUP, or HARNESS_BUILDER. Any other value returns 400. Session types that Vorflux creates internally cannot be requested here. |
sourceType | MANUAL | Origin of the session. Most API callers leave this as the default. |
harnessId | — | Harness configuration the session runs with. When omitted, the backend resolves the creating user’s default-harness setting. |
modelConfiguration | — | Optional model override. Accepts modelKey or a detailed modelSelection object. When omitted, account defaults apply. |
startedByUserEmail | — | Attribute / assign the session to another user in your account (must be a valid same-account email). The session still runs under the API key creator’s identity. |
forkedFromSessionId | — | Fork the new session from an existing session’s state. |
initialRepositoryUrls | [] | Repository URLs to attach to the session at creation. |
Response 201 Created
{
"sessionId": "abc123",
"status": "ACTIVE",
"sessionType": "GENERAL",
"createdAt": "2025-01-15T10:00:00Z"
}List Sessions
/api/v1/sessionsRequires sessions:read permission.
Query Parameters
| Param | Default | Description |
|---|---|---|
limit | 20 | Number of sessions to return (1–100) |
offset | 0 | Pagination offset |
status | — | Filter: ACTIVE, AWAITING_INPUT, ARCHIVED, PENDING_START, TODO, or UNSPECIFIED |
type | — | Filter: GENERAL, PLAN, TASK_EXECUTOR, MACHINE_SETUP, HARNESS_BUILDER, MERGE_QUEUE_WORKER, AUTOMATION_ROUTER, or UNSPECIFIED |
search | — | Search query string |
ACTIVE means the agent is working, PENDING_START that it has been created and is starting up, AWAITING_INPUT that it is blocked waiting on a reply, TODO that it is queued as a todo and has not started, and ARCHIVED that it is archived. ACTIVE and PENDING_START are both surfaced as working in the dashboard, so filter on the API value rather than what the UI displays.
An unrecognized status or type value returns 400 rather than being ignored. Filtering accepts more session types than you can create: MERGE_QUEUE_WORKER and AUTOMATION_ROUTER sessions are created by Vorflux itself, so you can list them but not request them from POST /api/v1/sessions.
Response 200 OK
{
"sessions": [
{
"sessionId": "abc123",
"title": "Investigate API latency",
"status": "ACTIVE",
"sessionType": "GENERAL",
"createdAt": "2025-01-15T10:00:00Z",
"updatedAt": "2025-01-15T10:05:00Z",
"startedBy": "user@example.com",
"assignedTo": "teammate@example.com",
"parentSessionId": "",
"totalLlmCostUsd": 0.42,
"repositories": [
"github.com/acme/api"
]
}
],
"totalCount": 42
}assignedTo is the user the session is assigned to, when one is set. totalLlmCostUsd is the aggregated LLM cost in USD and is omitted until cost has been aggregated, so it is usually absent on very recent or still-active sessions. repositories is omitted when no repositories are attached. This endpoint returns a summary of each session — machineId and accountId are only returned by Get a Session.
Get a Session
/api/v1/sessions/{sessionId}Requires sessions:read permission. Returns 404 if the session does not exist.
Response 200 OK
{
"sessionId": "abc123",
"title": "Investigate API latency",
"status": "ACTIVE",
"sessionType": "GENERAL",
"createdAt": "2025-01-15T10:00:00Z",
"updatedAt": "2025-01-15T10:05:00Z",
"startedBy": "user@example.com",
"assignedTo": "teammate@example.com",
"parentSessionId": "",
"accountId": "acct_xyz789",
"machineId": "machine_def456",
"totalLlmCostUsd": 0.42,
"repositories": [
"github.com/acme/api"
]
}Response Fields
| Param | Default | Description |
|---|---|---|
assignedTo | — | User the session is assigned to, when one is set. |
accountId | — | Account that owns the session. |
machineId | — | Machine the session runs on. Resolved on a best-effort basis, so it can be absent even for a running session. |
totalLlmCostUsd | — | Aggregated LLM cost in USD. Omitted until cost has been aggregated, so it is usually absent on very recent or still-active sessions. |
repositories | — | Repositories attached to the session, normalized to host/owner/repo. Omitted when none are attached. Also returned by List Sessions. |
machineId and accountId are returned here but not by List Sessions. Fetch a session by ID when you need them.
Cancel a Session
/api/v1/sessions/{sessionId}/cancelRequires sessions:write permission. No request body needed.
Response 200 OK
{
"success": true,
"message": "session cancelled"
}Archive a Session
/api/v1/sessions/{sessionId}/archiveRequires sessions:write permission. The request body is optional — pass prUrlsToClose to also close the listed pull requests when archiving.
Request (optional)
{
"prUrlsToClose": [
"https://github.com/acme/backend/pull/42"
]
}Response 200 OK
{
"success": true,
"failedPrUrls": []
}failedPrUrls lists any PR URLs that could not be closed.
Send a Message
/api/v1/sessions/{sessionId}/messagesRequires sessions:write permission. At least one of content or imageIds is required.
Request
{
"content": "Can you also check the database connection pool?",
"imageIds": []
}Response 201 Created
{
"messageId": "456",
"sessionId": "abc123"
}Get Messages
/api/v1/sessions/{sessionId}/messagesRequires sessions:read permission.
Query Parameters
| Param | Default | Description |
|---|---|---|
limit | 50 | Number of messages to return (1–100) |
beforeId | — | Return messages before this ID (cursor pagination) |
planId | — | Filter messages by plan ID |
taskId | — | Filter messages by task ID |
Response 200 OK
{
"messages": [
{
"id": "1",
"sessionId": "abc123",
"sentAt": "2025-01-15T10:00:00Z",
"sentBy": "user@example.com",
"messageType": "input",
"content": "Investigate the spike in API latency"
},
{
"id": "2",
"sessionId": "abc123",
"sentAt": "2025-01-15T10:00:05Z",
"agentType": "PLANNER",
"messageType": "text",
"content": "I'll investigate the API latency spike..."
},
{
"id": "3",
"sessionId": "abc123",
"sentAt": "2025-01-15T10:00:09Z",
"messageType": "tool_call",
"content": "Reading src/api/handler.go",
"toolCall": {
"toolCallId": "call_001",
"name": "read_file",
"displayMessage": "Reading src/api/handler.go",
"status": "success",
"arguments": "{\"path\":\"src/api/handler.go\"}",
"output": "package api\n..."
}
}
],
"hasMore": false
}Resolved Reference Fields
Some message types reference another object. When a message carries such a reference, the referenced object is resolved and included inline, so you do not need a second request to render the message. Each field is omitted when the message type does not carry that reference or when resolution fails.
| Param | Default | Description |
|---|---|---|
toolCall | — | Present on tool_call messages. Contains toolCallId, name, displayMessage, status (pending, success, failure, or unknown), arguments, and output. |
decisions | — | Present on decision request and response messages. An array of the same decision objects returned by Get Open Decisions. |
planDocument | — | Present on plan approval messages. Contains id and content, where content is the full plan markdown. |
comments | — | Present on diff comment messages. An array of objects with id, content, resolved, and filePath. |
Stream Messages (SSE)
/api/v1/sessions/{sessionId}/messages/streamRequires sessions:read permission. Opens a Server-Sent Events stream that notifies you when new messages are available.
Query Parameters
| Param | Default | Description |
|---|---|---|
lastId | 0 | Only stream events for messages after this ID |
Event Format
event: message
data: {"type":"refresh"}When you receive a refresh event, call the Get Messages endpoint to fetch the latest messages. The stream also sends :keepalive comments every 30 seconds.
Get Open Decisions
/api/v1/sessions/{sessionId}/decisions/openRequires sessions:read permission. Returns the pending decisions (multiple-choice questions) the agent is currently waiting on for this session. Returns an empty list when none are open.
Query Parameters
| Param | Default | Description |
|---|---|---|
limit | 100 | How many of the most recent messages to scan for open decisions (1–100). This is the scan window, not a cap on the number of decisions returned. |
Response 200 OK
{
"decisions": [
{
"decisionId": "789",
"status": "PENDING",
"question": "Which auth strategy should I use?",
"rationale": "Both approaches are viable for your stack.",
"options": [
{ "value": "jwt", "label": "JWT", "description": "Stateless tokens" },
{ "value": "session", "label": "Session", "description": "Server-side sessions" }
]
}
]
}Submit Decisions
/api/v1/sessions/{sessionId}/decisionsRequires sessions:write permission. Answers one or more open decisions so the agent can continue. Each submission requires a non-empty decisionId and response.
Request
{
"decisions": [
{
"decisionId": "789",
"response": "jwt"
}
]
}Response 200 OK
{
"submitted": true
}Get a Session's Plan
/api/v1/sessions/{sessionId}/planRequires sessions:read permission. Returns 404 if no plan exists for the session.
Response 200 OK
{
"planId": "42",
"sessionId": "abc123",
"status": "UNDER_REVIEW",
"summary": "Fix the authentication flow",
"planDocument": "## Plan\n\n1. Update the OAuth callback handler...",
"planSummaryDocument": "Fixes the OAuth callback and adds token rotation.",
"planExecutionStatus": "NOT_STARTED",
"planPreparationStatus": "READY",
"iterations": 2,
"tasks": [
{
"taskId": "1",
"description": "Update the OAuth callback handler",
"status": "TODO"
},
{
"taskId": "2",
"description": "Add refresh token rotation",
"status": "IN_PROGRESS"
}
]
}Response Fields
| Param | Default | Description |
|---|---|---|
summary | — | Short one-line summary of the plan. |
planDocument | — | Full plan as markdown. This is the same document shown in the Plan tab, so you can render an approval UI without scraping messages. |
planSummaryDocument | — | Longer prose summary of the plan, when the agent produced one. |
planExecutionStatus | — | How far execution of the approved plan has progressed. |
planPreparationStatus | — | Whether the plan is still being drafted or is ready for review. |
iterations | 0 | Number of revision rounds the plan has been through. |
designPlanDocument | — | Design plan document, present only for sessions that produced design mockups. |
Every field except planId is omitted when empty, so treat them all as optional.
Approve a Plan
/api/v1/sessions/{sessionId}/plan/approveRequires sessions:write permission. If planId is omitted, the plan is looked up by session ID automatically.
Request (optional)
{
"planId": "42"
}Response 200 OK
{
"planId": "42",
"sessionId": "abc123",
"status": "APPROVED",
"summary": "Fix the authentication flow",
"tasks": [...]
}List a Session's Artifacts
/api/v1/sessions/{sessionId}/artifactsRequires sessions:read permission. Returns artifacts like pull requests, plans, and files produced by the session.
Response 200 OK
{
"artifacts": [
{
"id": 1,
"artifactId": "pr-123",
"sessionId": "abc123",
"artifactType": "PULL_REQUEST",
"createdAt": "2025-01-15T10:10:00Z",
"approvalStatus": "PENDING"
}
]
}artifactType can be PULL_REQUEST, MARKDOWN_PLAN, GIT_BRANCH, or FILE. approvalStatus can be APPROVED, REJECTED, or PENDING.
Create a Sub-Session
/api/v1/sessions/{parentSessionId}/subsessionsRequires sessions:write permission. Creates a child session under an existing parent session. initialMessage is required.
Request
{
"initialMessage": "Fix the failing unit tests in auth module",
"sessionType": "GENERAL",
"modelConfiguration": {
"modelKey": "claude-sonnet-4-6"
}
}Response 201 Created
{
"sessionId": "sub456",
"status": "ACTIVE",
"sessionType": "GENERAL",
"createdAt": "2025-01-15T10:15:00Z",
"parentSessionId": "abc123"
}List Sub-Sessions
/api/v1/sessions/{parentSessionId}/subsessionsRequires sessions:read permission.
Query Parameters
| Param | Default | Description |
|---|---|---|
limit | 20 | Number of sub-sessions to return (1–100) |
offset | 0 | Pagination offset |
Response 200 OK
{
"sessions": [
{
"sessionId": "sub456",
"title": "Fix failing auth tests",
"status": "ACTIVE",
"sessionType": "GENERAL",
"createdAt": "2025-01-15T10:15:00Z",
"parentSessionId": "abc123"
}
],
"totalCount": 3
}Get Session Usage
/api/v1/sessions/{sessionId}/usageRequires sessions:read permission. Returns the cost of a session, split by agent type (the main agent and each subagent type) and by model.
This endpoint is in preview and is turned on per account. If it is not turned on for your account, it returns 404. To turn it on, contact Vorflux.
Query Parameters
| Param | Default | Description |
|---|---|---|
start_date | — | Optional. Count only usage on or after this UTC date (YYYY-MM-DD) |
Response 200 OK
{
"sessionId": "abc123",
"totalLlmCostUsd": 2.41,
"costBreakdown": [
{ "agentType": "main", "costUsd": 1.82 }
],
"tokenUsage": [
{
"model": "claude-opus-5-5",
"modelDisplayName": "Claude Opus 5.5",
"provider": "bedrock_same_region",
"providerDisplayName": "bedrock_same_region",
"isByok": false,
"tokens": 1250000,
"inputTokens": 1100000,
"outputTokens": 50000,
"cachedTokens": 900000,
"tokenFeeUsd": 2.1,
"platformFeeUsd": 0.31,
"totalCostUsd": 2.41
}
],
"machineCostMicrousd": 120000,
"totalCostWithMarkupMicrousd": 2530000,
"byokLlmCostMicrousd": 0
}agentType is main for the main agent. Other values name a subagent type. totalLlmCostUsd is null when the session has no LLM usage, so you can tell it apart from a real $0 total. Fields that end in Microusd are in millionths of a US dollar. totalCostWithMarkupMicrousd is the total billed cost (LLM, token fee, and machine). byokLlmCostMicrousd is the raw cost on your own provider keys and is 0 for sessions that do not use them. Returns 400 if start_date is not a valid date.
Get Harness Capabilities
/api/v1/harnesses/{harnessId}/capabilitiesRequires sessions:read permission. Returns the resolved capability flags for a harness (built-in or custom), so callers can tell which behaviors a session created with that harness will have. Returns 404 if the harness does not exist in your account.
Response 200 OK
{
"harnessId": "harness_abc123",
"fastMode": false,
"simplifyReviewDisabled": false,
"testingDisabled": false
}fastMode runs the agent in a faster, lighter configuration. simplifyReviewDisabled and testingDisabled indicate whether the harness skips the simplify/review and testing phases respectively.
List Available Models
/api/v1/modelsRequires sessions:read permission. Returns the list of models available for session creation.
Response 200 OK
{
"models": [
{
"modelKey": "claude-sonnet-4-6",
"displayName": "Claude Sonnet 4.6",
"description": "Fast and capable",
"supportsThinking": true
}
],
"profiles": [
{
"modelKey": "claude-sonnet-4-6",
"displayName": "Claude Sonnet 4.6",
"family": "claude",
"contextOptions": [],
"reasoningOptions": [],
"runtimeOptions": [],
"providerVariantOptions": [],
"defaultSelection": {
"modelKey": "claude-sonnet-4-6",
"thinkingEnabled": true,
"fastModeEnabled": false
}
}
],
"defaultModelKey": "claude-sonnet-4-6",
"defaultSelection": {
"modelKey": "claude-sonnet-4-6",
"thinkingEnabled": true,
"fastModeEnabled": false
}
}Response Fields
| Param | Default | Description |
|---|---|---|
models | [] | Flat list of selectable models. Use a modelKey from here as modelConfiguration.modelKey when creating a session. |
profiles | [] | Per-model configurable options — contextOptions, reasoningOptions, runtimeOptions, and providerVariantOptions — plus that model's own defaultSelection. Read this when you want to build a detailed modelSelection rather than just pick a model. |
defaultModelKey | — | Model used when a session is created without a model override. |
defaultSelection | — | The account's full default selection, including thinkingEnabled, reasoningEffort, thinkingBudgetTokens, providerVariantKey, and fastModeEnabled. |