---
title: "Stream tasks"
method: POST
path: "/api/v1/tasks/stream"
tags: ["tasks"]
---

# Stream tasks

`POST /api/v1/tasks/stream`

Establishes a server streaming connection that delivers task updates in real-time using Server-Sent Events (SSE).

The stream delivers all existing non-terminal tasks when first connected, followed by real-time
updates for task creation and status changes. Additionally, heartbeat messages are sent periodically to maintain the connection.

## Headers

- `Authorization` string, required

## Request body

- TaskStreamRequest — The request to establish a streaming connection using Server-Sent Events (SSE) for receiving task events. This message defines the filtering criteria for which tasks the client wants to receive events for, along with rate limiting and heartbeat configurations.
  - `heartbeatIntervalMs` integer — The time interval, in milliseconds, that determines the frequency at which to send heartbeat events. Defaults to 30000 (30 seconds).
  - `rateLimit` integer — The time interval, in milliseconds, after an update for a given task before another one will be sent for the same task. If set, value must be >= 250.
  - `excludePreexistingTasks` boolean — Optional flag to only include tasks created or updated after the stream is initiated, and not any previous preexisting tasks. If unset or false, the stream will include any new tasks and task updates, as well as all preexisting tasks.
  - `taskType` union — Optional filter that only returns tasks with specific types. If not provided, all task types will be streamed.
    - TaskStreamRequestTaskType0
      - `taskTypeUrls` string[], required — List of exact task type URLs to match.
    - TaskStreamRequestTaskType1
      - `taskTypePrefix` string, required — Prefix string to match task types. Any task with a type that starts with this prefix will be included.
  - `updateStartTime` string — The datetime string in ISO 8601 format.
  - `parentTaskId` string — A filter for tasks with a specific parent task ID. Note: This filter is mutually exclusive with all other filter fields (`updateStartTime`, `assignee`, `statusFilter`, `taskType`). Either provide `parentTaskId` or any combination of the other filters, but not both.
  - `assignee` Principal — A Principal is an entity that has authority over this task.
    - `system` System — System Principal representing some autonomous system.
      - `serviceName` string — Name of the service associated with this System.
      - `entityId` string — The Entity ID of the System.
      - `managesOwnScheduling` boolean — Whether the System Principal (for example, an Asset) can own scheduling. This means we bypass manager-owned scheduling and defer to the system Principal to handle scheduling and give us status updates for the task. Regardless of the value defined by the client, the Task Manager will determine and set this value appropriately.
    - `user` User — A User Principal representing a human.
      - `userId` string — The User ID associated with this User.
    - `team` Team — Represents a team of agents
      - `entityId` string — Entity ID of the team
      - `members` Agent[]
        - `entityId` string — Entity ID of the agent.
    - `onBehalfOf` Principal — recursive
  - `statusFilter` TaskStreamRequestStatusFilter — A filter for task statuses (inclusive or exclusive).
    - `statuses` TaskStreamRequestStatusFilterStatusesItems[] — The statuses to filter by.
    - `filterType` 'FILTER_TYPE_INVALID' | 'FILTER_TYPE_INCLUSIVE' | 'FILTER_TYPE_EXCLUSIVE' — The type of filter to apply.

## Response `200`

Returns a stream of task updates as they occur.

## Other responses

- `400` — Bad request
- `401` — Unauthorized to access resource

---

[API](https://skmtc.net/anduril/apis/rest.md) · [All operations](https://skmtc.net/anduril/apis/rest/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/anduril/rest/revisions/c2a841b48ac6/schema)
