Sessions

Returns a paginated list of sessions for the authenticated user. With computerId, sessions are listed from that computer, whose session list records no run state, so every row reports status idle; read a session with GET /api/v0/sessions/{sessionId}?computerId= for whether it is running. Rows listed from a computer omit factoryCredits; without computerId, factoryCredits appears on sessions that have reported usage, and is omitted from every row when the organization hides billable usage. Without computerId, updatedAfter and updatedBefore select sessions by their current last update time, at or after updatedAfter and before updatedBefore; they do not return a history of changes, and they are rejected with computerId. Send the same window with every cursor. A page can be short or empty while hasMore is true, so follow nextCursor until hasMore is false. A session updated while you page is listed at its new update time, so it can appear again or leave the window, and a cursor that names none of your sessions starts the list again; deduplicate rows by sessionId. For periodic polls, set an explicit updatedBefore and overlap consecutive windows to reduce missed updates. excludeSubagents=true omits sessions with a public parent_session_id; see the parameter for which sessions remain listed. This feature is enabled for selected organizations only.

get/api/v0/sessions

Request

  • Base URL
    https://api.factory.ai
  • Auth
    HTTP bearer

Query parameters

limit, integer

Maximum number of items to return (1-100)

cursor, string

Cursor for pagination

computerId, string

Computer ID to query directly

sessionIds, string

Comma-separated set of 1–100 session UUIDs, counted before deduplication. Unknown or inaccessible IDs are omitted. Returns only normally listable matches in last-update order, not input order. Use limit=100 for up to 100 matches; repeat the same IDs with each cursor and time window. Older storage that cannot apply this filter returns 503, never an unfiltered list. Not supported with a nonempty computerId or on the workstreams list.

excludeSubagents, boolean

excludeSubagents=true omits sessions with a public parent_session_id. Mission and legacy child sessions without that public parent remain listed. Filtering can produce short or empty pages with hasMore=true; continue using nextCursor. A fork of a child session inherits that child's parent lineage, so it is omitted when the child is. When supplied, excludeSubagents cannot be combined with sessionIds or a non-empty computerId, even when it is false.

updatedAfter, string

List only sessions whose last update time (Unix ms) is at or after this time

updatedBefore, string

List only sessions whose last update time (Unix ms) is before this time; at least 1 and later than updatedAfter

Headers

X-Factory-Org-Id, string

Organization a JWT request acts in; required to act in a sub-organization. Without it, the request acts in the user's root organization, or is rejected with 403 when the user cannot access the root organization. API keys always act in their own organization and ignore this header.

Response

Response for status 200

ListSessions200ResponseBody required
sessions, object[] required
pagination, object required

Changes

    • info

      added the new optional query request parameter excludeSubagents

    • info

      added the new optional query request parameter sessionIds

    • info

      added the new optional query request parameter updatedAfter

    1 more change in this revision