---
title: "Stream entity events"
method: POST
path: "/api/v1/entities/stream"
tags: ["entities"]
---

# Stream entity events

`POST /api/v1/entities/stream`

Establishes a server-sent events (SSE) connection that streams entity data in real-time.
This is a one-way connection from server to client that follows the SSE protocol with text/event-stream content type.

This endpoint enables clients to maintain a real-time view of the common operational picture (COP)
by first streaming all pre-existing entities that match filter criteria, then continuously delivering
updates as entities are created, modified, or deleted.

The server first sends events with type PREEXISTING for all live entities matching the filter that existed before the stream was open,
then streams CREATE events for newly created entities, UPDATE events when existing entities change, and DELETED events when entities are removed. The stream remains open
indefinitely unless preExistingOnly is set to true.

Heartbeat messages can be configured to maintain connection health and detect disconnects by setting the heartbeatIntervalMS
parameter. These heartbeats help keep the connection alive and allow clients to verify the server is still responsive.

Clients can optimize bandwidth usage by specifying which entity components they need populated using the componentsToInclude parameter.
This allows receiving only relevant data instead of complete entities.

The connection automatically recovers from temporary disconnections, resuming the stream where it left off. Unlike polling approaches,
this provides real-time updates with minimal latency and reduced server load.

## Headers

- `Authorization` string, required

## Request body

- EntityStreamRequest
  - `heartbeatIntervalMS` integer — at what interval to send heartbeat events, defaults to 30s.
  - `preExistingOnly` boolean — only stream pre-existing entities in the environment and then close the connection, defaults to false.
  - `componentsToInclude` string[] — list of components to include, leave empty to include all components.
  - `filter` Statement — A Statement is the building block of the entity filter. The outermost statement is conceptually the root node of an "expression tree" which allows for the construction of complete boolean logic statements. Statements are formed by grouping sets of children statement(s) or predicate(s) according to the boolean operation which is to be applied. For example, the criteria "take an action if an entity is hostile and an air vehicle" can be represented as: Statement1: { AndOperation: { Predicate1, Predicate2 } }. Where Statement1 is the root of the expression tree, with an AND operation that is applied to children predicates. The predicates themselves encode "entity is hostile" and "entity is air vehicle."
    - `and` AndOperation — The AndOperation represents the boolean AND operation, which is to be applied to the list of children statement(s) or predicate(s).
      - `predicateSet` PredicateSet — The PredicateSet represents a list of predicates or "leaf nodes" in the expression tree, which can be directly evaluated to a boolean TRUE/FALSE result.
        - `predicates` Predicate[]
          - `fieldPath` string — The field_path determines which field on an entity is being referenced in this predicate. For example: correlated.primary_entity_id would be primary_entity_id in correlated component.
          - `value` Value — The Value represents the information against which an entity field is evaluated. It is one of a fixed set of types, each of which correspond to specific comparators. See "ComparatorType" for the full list of Value <-> Comparator mappings.
            - `booleanType` BooleanType — The BooleanType represents a static boolean value.
              - …
            - `numericType` NumericType — The NumericType represents static numeric values. It supports all numeric primitives supported by the proto3 language specification.
              - …
            - `stringType` StringType — The StringType represents static string values.
              - …
            - `enumType` EnumType — The EnumType represents members of well-known anduril ontologies, such as "disposition." When such a value is specified, the evaluation library expects the integer representation of the enum value. For example, a disposition derived from ontology.v1 such as "DISPOSITION_HOSTILE" should be represented with the integer value 2.
              - …
            - `timestampType` TimestampType — The TimestampType represents a static timestamp value.
              - …
            - `boundedShapeType` BoundedShapeType — The BoundedShapeType represents any static fully-enclosed shape.
              - …
            - `positionType` PositionType — The PositionType represents any fixed LLA point in space.
              - …
            - `headingType` HeadingType — The HeadingType represents the heading in degrees for an entity's attitudeEnu quaternion to be compared against. Defaults between a range of 0 to 360
              - …
            - `listType` ListType — A List of Values for use with the IN comparator.
              - …
            - `rangeType` RangeType — The RangeType represents a numeric range. Whether endpoints are included are based on the comparator used. Both endpoints must be of the same numeric type.
              - …
          - `comparator` 'COMPARATOR_INVALID' | 'COMPARATOR_MATCH_ALL' | 'COMPARATOR_EQUALITY' | 'COMPARATOR_IN' | 'COMPARATOR_LESS_THAN' | 'COMPARATOR_GREATER_THAN' | 'COMPARATOR_LESS_THAN_EQUAL_TO' | 'COMPARATOR_GREATER_THAN_EQUAL_TO' | 'COMPARATOR_WITHIN' | 'COMPARATOR_EXISTS' | 'COMPARATOR_CASE_INSENSITIVE_EQUALITY' | 'COMPARATOR_CASE_INSENSITIVE_EQUALITY_IN' | 'COMPARATOR_RANGE_CLOSED' — The comparator determines the manner in which the entity field and static value are compared. Comparators may only be applied to certain values. For example, the WITHIN comparator cannot be used for a boolean value comparison.
      - `statementSet` StatementSet — The StatementSet represents a list of statements or "tree nodes," each of which follow the same behavior as the Statement proto message.
        - `statements` Statement[]
    - `or` OrOperation — The OrOperation represents the boolean OR operation, which is to be applied to the list of children statement(s) or predicate(s).
      - `predicateSet` PredicateSet — The PredicateSet represents a list of predicates or "leaf nodes" in the expression tree, which can be directly evaluated to a boolean TRUE/FALSE result.
        - `predicates` Predicate[]
          - `fieldPath` string — The field_path determines which field on an entity is being referenced in this predicate. For example: correlated.primary_entity_id would be primary_entity_id in correlated component.
          - `value` Value — The Value represents the information against which an entity field is evaluated. It is one of a fixed set of types, each of which correspond to specific comparators. See "ComparatorType" for the full list of Value <-> Comparator mappings.
            - `booleanType` BooleanType — The BooleanType represents a static boolean value.
              - …
            - `numericType` NumericType — The NumericType represents static numeric values. It supports all numeric primitives supported by the proto3 language specification.
              - …
            - `stringType` StringType — The StringType represents static string values.
              - …
            - `enumType` EnumType — The EnumType represents members of well-known anduril ontologies, such as "disposition." When such a value is specified, the evaluation library expects the integer representation of the enum value. For example, a disposition derived from ontology.v1 such as "DISPOSITION_HOSTILE" should be represented with the integer value 2.
              - …
            - `timestampType` TimestampType — The TimestampType represents a static timestamp value.
              - …
            - `boundedShapeType` BoundedShapeType — The BoundedShapeType represents any static fully-enclosed shape.
              - …
            - `positionType` PositionType — The PositionType represents any fixed LLA point in space.
              - …
            - `headingType` HeadingType — The HeadingType represents the heading in degrees for an entity's attitudeEnu quaternion to be compared against. Defaults between a range of 0 to 360
              - …
            - `listType` ListType — A List of Values for use with the IN comparator.
              - …
            - `rangeType` RangeType — The RangeType represents a numeric range. Whether endpoints are included are based on the comparator used. Both endpoints must be of the same numeric type.
              - …
          - `comparator` 'COMPARATOR_INVALID' | 'COMPARATOR_MATCH_ALL' | 'COMPARATOR_EQUALITY' | 'COMPARATOR_IN' | 'COMPARATOR_LESS_THAN' | 'COMPARATOR_GREATER_THAN' | 'COMPARATOR_LESS_THAN_EQUAL_TO' | 'COMPARATOR_GREATER_THAN_EQUAL_TO' | 'COMPARATOR_WITHIN' | 'COMPARATOR_EXISTS' | 'COMPARATOR_CASE_INSENSITIVE_EQUALITY' | 'COMPARATOR_CASE_INSENSITIVE_EQUALITY_IN' | 'COMPARATOR_RANGE_CLOSED' — The comparator determines the manner in which the entity field and static value are compared. Comparators may only be applied to certain values. For example, the WITHIN comparator cannot be used for a boolean value comparison.
      - `statementSet` StatementSet — The StatementSet represents a list of statements or "tree nodes," each of which follow the same behavior as the Statement proto message.
        - `statements` Statement[]
    - `not` NotOperation — The NotOperation represents the boolean NOT operation, which can only be applied to a single child predicate or statement.
      - `predicate` Predicate — The Predicate fully encodes the information required to make an evaluation of an entity field against a given static value, resulting in a boolean TRUE/FALSE result. The structure of a predicate will always follow: "{entity-value} {comparator} {fixed-value}" where the entity value is determined by the field path. For example, a predicate would read as: "{entity.location.velocity_enu} {LESS_THAN} {500kph}"
        - `fieldPath` string — The field_path determines which field on an entity is being referenced in this predicate. For example: correlated.primary_entity_id would be primary_entity_id in correlated component.
        - `value` Value — The Value represents the information against which an entity field is evaluated. It is one of a fixed set of types, each of which correspond to specific comparators. See "ComparatorType" for the full list of Value <-> Comparator mappings.
          - `booleanType` BooleanType — The BooleanType represents a static boolean value.
            - `value` boolean
          - `numericType` NumericType — The NumericType represents static numeric values. It supports all numeric primitives supported by the proto3 language specification.
            - `doubleValue` number, double
            - `floatValue` string
            - `int32Value` integer
            - `int64Value` string
            - `uint32Value` integer
            - `uint64Value` string
          - `stringType` StringType — The StringType represents static string values.
            - `value` string
          - `enumType` EnumType — The EnumType represents members of well-known anduril ontologies, such as "disposition." When such a value is specified, the evaluation library expects the integer representation of the enum value. For example, a disposition derived from ontology.v1 such as "DISPOSITION_HOSTILE" should be represented with the integer value 2.
            - `value` integer
          - `timestampType` TimestampType — The TimestampType represents a static timestamp value.
            - `value` string, date-time
          - `boundedShapeType` BoundedShapeType — The BoundedShapeType represents any static fully-enclosed shape.
            - `polygonValue` GeoPolygon — A polygon shaped geo-entity. See https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6, only canonical representations accepted
              - …
          - `positionType` PositionType — The PositionType represents any fixed LLA point in space.
            - `value` Position — WGS84 position. Position includes four altitude references. The data model does not currently support Mean Sea Level (MSL) references, such as the Earth Gravitational Model 1996 (EGM-96) and the Earth Gravitational Model 2008 (EGM-08). If the only altitude reference available to your integration is MSL, convert it to Height Above Ellipsoid (HAE) and populate the altitude_hae_meters field.
              - …
          - `headingType` HeadingType — The HeadingType represents the heading in degrees for an entity's attitudeEnu quaternion to be compared against. Defaults between a range of 0 to 360
            - `value` integer
          - `listType` ListType — A List of Values for use with the IN comparator.
            - `values` Value[]
          - `rangeType` RangeType — The RangeType represents a numeric range. Whether endpoints are included are based on the comparator used. Both endpoints must be of the same numeric type.
            - `start` NumericType — The NumericType represents static numeric values. It supports all numeric primitives supported by the proto3 language specification.
              - …
            - `end` NumericType — The NumericType represents static numeric values. It supports all numeric primitives supported by the proto3 language specification.
              - …
        - `comparator` 'COMPARATOR_INVALID' | 'COMPARATOR_MATCH_ALL' | 'COMPARATOR_EQUALITY' | 'COMPARATOR_IN' | 'COMPARATOR_LESS_THAN' | 'COMPARATOR_GREATER_THAN' | 'COMPARATOR_LESS_THAN_EQUAL_TO' | 'COMPARATOR_GREATER_THAN_EQUAL_TO' | 'COMPARATOR_WITHIN' | 'COMPARATOR_EXISTS' | 'COMPARATOR_CASE_INSENSITIVE_EQUALITY' | 'COMPARATOR_CASE_INSENSITIVE_EQUALITY_IN' | 'COMPARATOR_RANGE_CLOSED' — The comparator determines the manner in which the entity field and static value are compared. Comparators may only be applied to certain values. For example, the WITHIN comparator cannot be used for a boolean value comparison.
      - `statement` Statement — recursive
    - `list` ListOperation — The ListOperation represents an operation against a proto list. If the list is of primitive proto type (e.g. int32), paths in all child predicates should be left empty. If the list is of message proto type (e.g. Sensor), paths in all child predicates should be relative to the list path. For example, the criteria "take an action if an entity has any sensor with sensor_id='sensor' and OperationalState=STATE_OFF" would be modeled as: Predicate1: { path: "sensor_id", comparator: EQUAL_TO, value: "sensor" } Predicate2: { path: "operational_state", comparator: EQUAL_TO, value: STATE_OFF } Statement2: { AndOperation: PredicateSet: { <Predicate1>, <Predicate2> } } ListOperation: { list_path: "sensors.sensors", list_comparator: ANY, statement: <Statement2> } Statement1: { ListOperation: <ListOperation> } Note that in the above, the child predicates of the list operation have paths relative to the list_path because the list is comprised of message not primitive types.
      - `listPath` string — The list_path specifies the repeated field on an entity to which this operation applies.
      - `listComparator` 'LIST_COMPARATOR_INVALID' | 'LIST_COMPARATOR_ANY_OF' — The list_comparator specifies how to compose the boolean results from the child statement for each member of the specified list.
      - `statement` Statement — recursive
    - `predicate` Predicate — The Predicate fully encodes the information required to make an evaluation of an entity field against a given static value, resulting in a boolean TRUE/FALSE result. The structure of a predicate will always follow: "{entity-value} {comparator} {fixed-value}" where the entity value is determined by the field path. For example, a predicate would read as: "{entity.location.velocity_enu} {LESS_THAN} {500kph}"
      - `fieldPath` string — The field_path determines which field on an entity is being referenced in this predicate. For example: correlated.primary_entity_id would be primary_entity_id in correlated component.
      - `value` Value — The Value represents the information against which an entity field is evaluated. It is one of a fixed set of types, each of which correspond to specific comparators. See "ComparatorType" for the full list of Value <-> Comparator mappings.
        - `booleanType` BooleanType — The BooleanType represents a static boolean value.
          - `value` boolean
        - `numericType` NumericType — The NumericType represents static numeric values. It supports all numeric primitives supported by the proto3 language specification.
          - `doubleValue` number, double
          - `floatValue` string
          - `int32Value` integer
          - `int64Value` string
          - `uint32Value` integer
          - `uint64Value` string
        - `stringType` StringType — The StringType represents static string values.
          - `value` string
        - `enumType` EnumType — The EnumType represents members of well-known anduril ontologies, such as "disposition." When such a value is specified, the evaluation library expects the integer representation of the enum value. For example, a disposition derived from ontology.v1 such as "DISPOSITION_HOSTILE" should be represented with the integer value 2.
          - `value` integer
        - `timestampType` TimestampType — The TimestampType represents a static timestamp value.
          - `value` string, date-time
        - `boundedShapeType` BoundedShapeType — The BoundedShapeType represents any static fully-enclosed shape.
          - `polygonValue` GeoPolygon — A polygon shaped geo-entity. See https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6, only canonical representations accepted
            - `rings` LinearRing[] — An array of LinearRings where the first item is the exterior ring and subsequent items are interior rings.
              - …
            - `isRectangle` boolean — An extension hint that this polygon is a rectangle. When true this implies several things: * exactly 1 linear ring with 5 points (starting corner, 3 other corners and start again) * each point has the same altitude corresponding with the plane of the rectangle * each point has the same height (either all present and equal, or all not present)
        - `positionType` PositionType — The PositionType represents any fixed LLA point in space.
          - `value` Position — WGS84 position. Position includes four altitude references. The data model does not currently support Mean Sea Level (MSL) references, such as the Earth Gravitational Model 1996 (EGM-96) and the Earth Gravitational Model 2008 (EGM-08). If the only altitude reference available to your integration is MSL, convert it to Height Above Ellipsoid (HAE) and populate the altitude_hae_meters field.
            - `latitudeDegrees` number, double — WGS84 geodetic latitude in decimal degrees.
            - `longitudeDegrees` number, double — WGS84 longitude in decimal degrees.
            - `altitudeHaeMeters` number, double — altitude as height above ellipsoid (WGS84) in meters. DoubleValue wrapper is used to distinguish optional from default 0.
            - `altitudeAglMeters` number, double — Altitude as AGL (Above Ground Level) if the upstream data source has this value set. This value represents the entity's height above the terrain. This is typically measured with a radar altimeter or by using a terrain tile set lookup. If the value is not set from the upstream, this value is not set.
            - `altitudeAsfMeters` number, double — Altitude as ASF (Above Sea Floor) if the upstream data source has this value set. If the value is not set from the upstream, this value is not set.
            - `pressureDepthMeters` number, double — The depth of the entity from the surface of the water through sensor measurements based on differential pressure between the interior and exterior of the vessel. If the value is not set from the upstream, this value is not set.
        - `headingType` HeadingType — The HeadingType represents the heading in degrees for an entity's attitudeEnu quaternion to be compared against. Defaults between a range of 0 to 360
          - `value` integer
        - `listType` ListType — A List of Values for use with the IN comparator.
          - `values` Value[]
        - `rangeType` RangeType — The RangeType represents a numeric range. Whether endpoints are included are based on the comparator used. Both endpoints must be of the same numeric type.
          - `start` NumericType — The NumericType represents static numeric values. It supports all numeric primitives supported by the proto3 language specification.
            - `doubleValue` number, double
            - `floatValue` string
            - `int32Value` integer
            - `int64Value` string
            - `uint32Value` integer
            - `uint64Value` string
          - `end` NumericType — The NumericType represents static numeric values. It supports all numeric primitives supported by the proto3 language specification.
            - `doubleValue` number, double
            - `floatValue` string
            - `int32Value` integer
            - `int64Value` string
            - `uint32Value` integer
            - `uint64Value` string
      - `comparator` 'COMPARATOR_INVALID' | 'COMPARATOR_MATCH_ALL' | 'COMPARATOR_EQUALITY' | 'COMPARATOR_IN' | 'COMPARATOR_LESS_THAN' | 'COMPARATOR_GREATER_THAN' | 'COMPARATOR_LESS_THAN_EQUAL_TO' | 'COMPARATOR_GREATER_THAN_EQUAL_TO' | 'COMPARATOR_WITHIN' | 'COMPARATOR_EXISTS' | 'COMPARATOR_CASE_INSENSITIVE_EQUALITY' | 'COMPARATOR_CASE_INSENSITIVE_EQUALITY_IN' | 'COMPARATOR_RANGE_CLOSED' — The comparator determines the manner in which the entity field and static value are compared. Comparators may only be applied to certain values. For example, the WITHIN comparator cannot be used for a boolean value comparison.

## Response `200`

Returns all pre-existing data and then return all new data as they become available.

## 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/a232aed4852f/schema)
