Skip to content
Create a Session
DocsREST API

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

POST/api/v1/sessions

Requires sessions:write permission.

Request

json
{
  "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.

ParamDefaultDescription
initialMessage—First message sent to the agent. When omitted, the session starts idle and awaits input.
sessionTypeGENERALOne 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.
sourceTypeMANUALOrigin 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

json
{
  "sessionId": "abc123",
  "status": "ACTIVE",
  "sessionType": "GENERAL",
  "createdAt": "2025-01-15T10:00:00Z"
}

List Sessions

GET/api/v1/sessions

Requires sessions:read permission.

Query Parameters

ParamDefaultDescription
limit20Number of sessions to return (1–100)
offset0Pagination 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

json
{
  "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

GET/api/v1/sessions/{sessionId}

Requires sessions:read permission. Returns 404 if the session does not exist.

Response 200 OK

json
{
  "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

ParamDefaultDescription
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

POST/api/v1/sessions/{sessionId}/cancel

Requires sessions:write permission. No request body needed.

Response 200 OK

json
{
  "success": true,
  "message": "session cancelled"
}

Archive a Session

POST/api/v1/sessions/{sessionId}/archive

Requires sessions:write permission. The request body is optional — pass prUrlsToClose to also close the listed pull requests when archiving.

Request (optional)

json
{
  "prUrlsToClose": [
    "https://github.com/acme/backend/pull/42"
  ]
}

Response 200 OK

json
{
  "success": true,
  "failedPrUrls": []
}

failedPrUrls lists any PR URLs that could not be closed.

Send a Message

POST/api/v1/sessions/{sessionId}/messages

Requires sessions:write permission. At least one of content or imageIds is required.

Request

json
{
  "content": "Can you also check the database connection pool?",
  "imageIds": []
}

Response 201 Created

json
{
  "messageId": "456",
  "sessionId": "abc123"
}

Get Messages

GET/api/v1/sessions/{sessionId}/messages

Requires sessions:read permission.

Query Parameters

ParamDefaultDescription
limit50Number 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

json
{
  "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.

ParamDefaultDescription
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)

GET/api/v1/sessions/{sessionId}/messages/stream

Requires sessions:read permission. Opens a Server-Sent Events stream that notifies you when new messages are available.

Query Parameters

ParamDefaultDescription
lastId0Only stream events for messages after this ID

Event Format

text
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

GET/api/v1/sessions/{sessionId}/decisions/open

Requires 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

ParamDefaultDescription
limit100How 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

json
{
  "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

POST/api/v1/sessions/{sessionId}/decisions

Requires sessions:write permission. Answers one or more open decisions so the agent can continue. Each submission requires a non-empty decisionId and response.

Request

json
{
  "decisions": [
    {
      "decisionId": "789",
      "response": "jwt"
    }
  ]
}

Response 200 OK

json
{
  "submitted": true
}

Get a Session's Plan

GET/api/v1/sessions/{sessionId}/plan

Requires sessions:read permission. Returns 404 if no plan exists for the session.

Response 200 OK

json
{
  "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

ParamDefaultDescription
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.
iterations0Number 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

POST/api/v1/sessions/{sessionId}/plan/approve

Requires sessions:write permission. If planId is omitted, the plan is looked up by session ID automatically.

Request (optional)

json
{
  "planId": "42"
}

Response 200 OK

json
{
  "planId": "42",
  "sessionId": "abc123",
  "status": "APPROVED",
  "summary": "Fix the authentication flow",
  "tasks": [...]
}

List a Session's Artifacts

GET/api/v1/sessions/{sessionId}/artifacts

Requires sessions:read permission. Returns artifacts like pull requests, plans, and files produced by the session.

Response 200 OK

json
{
  "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

POST/api/v1/sessions/{parentSessionId}/subsessions

Requires sessions:write permission. Creates a child session under an existing parent session. initialMessage is required.

Request

json
{
  "initialMessage": "Fix the failing unit tests in auth module",
  "sessionType": "GENERAL",
  "modelConfiguration": {
    "modelKey": "claude-sonnet-4-6"
  }
}

Response 201 Created

json
{
  "sessionId": "sub456",
  "status": "ACTIVE",
  "sessionType": "GENERAL",
  "createdAt": "2025-01-15T10:15:00Z",
  "parentSessionId": "abc123"
}

List Sub-Sessions

GET/api/v1/sessions/{parentSessionId}/subsessions

Requires sessions:read permission.

Query Parameters

ParamDefaultDescription
limit20Number of sub-sessions to return (1–100)
offset0Pagination offset

Response 200 OK

json
{
  "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

GET/api/v1/sessions/{sessionId}/usage

Requires 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

ParamDefaultDescription
start_date—Optional. Count only usage on or after this UTC date (YYYY-MM-DD)

Response 200 OK

json
{
  "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

GET/api/v1/harnesses/{harnessId}/capabilities

Requires 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

json
{
  "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

GET/api/v1/models

Requires sessions:read permission. Returns the list of models available for session creation.

Response 200 OK

json
{
  "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

ParamDefaultDescription
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.