> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirurobotics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream Events

> Subscribe to a Server-Sent Events (SSE) stream of agent lifecycle events.

The stream replays retained historical events after the cursor, then
delivers live events as they occur. Events are delivered at-least-once;
clients should deduplicate by event `id`.

Use the `after` query parameter or `Last-Event-ID` header to resume
from a previous position. If the cursor is older than the earliest
retained event, the server returns `410 Gone`.




## OpenAPI

````yaml /references/device-api/v0.2.4/api.yaml get /events
openapi: 3.0.3
info:
  title: Miru Agent API
  description: >-
    The API between the Miru Agent and any external client living on the same
    device as the Miru Agent. On Linux the agent serves it over the Unix socket
    `/run/miru/miru.sock` with no authentication. Over loopback TCP, which is on
    by default on Windows at `127.0.0.1:6478`, every route requires
    `Authorization: Bearer <token>`. Clients read the port and token from the
    agent's discovery file, `%ProgramData%\Miru\device-api\device-api.json` on
    Windows; the token changes every time the agent starts.
  version: v0.2
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  x-release-version: v0.2.4
  x-git-commit:
    sha: 13405ec342d31653d51698d8da8b860db728df18
    url: >-
      https://github.com/mirurobotics/openapi/commit/13405ec342d31653d51698d8da8b860db728df18
    message: >-
      chore(stlc): seal custom-code tracking files (#396)


      Automated by the stlc generate workflow: a push-to-main or manual

      `workflow_dispatch` publish re-sealed custom code, updating the tracking

      files under `sdkgen/*/stainless/custom-code/`. Publishing targets the

      private staging repos. Safe to merge - this PR's head branch

      `stlc/seal-tracking` is skipped by the generate workflow's skip-bot

      guard in `detect`, and on merge the push loop-breaker `guard` sees only

      custom-code changes and runs no rebuild.


      <!-- codesmith:footer -->

      ---

      <a

      href="https://app.blacksmith.sh/mirurobotics/codesmith/openapi/pr/396?autoLogin=true&ref=codesmith_pr_footer"><picture><source

      media="(prefers-color-scheme: dark)"

      srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source

      media="(prefers-color-scheme: light)"

      srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img

      alt="View with [code]smith"

      src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png"

      width="162" height="28"></picture></a> <a

      href="https://backend.blacksmith.sh/track/enable-autofix?expires=1795887387&installation_model_id=425273&pr_number=396&ref=codesmith_pr_footer&repository=mirurobotics%2Fopenapi&return_to=https%3A%2F%2Fgithub.com%2Fmirurobotics%2Fopenapi%2Fpull%2F396&signature=36ab39c5d717b3d9ff699ab6514ceba14c9fae2a8d4a356f380950ed197d6701"><picture><source

      media="(prefers-color-scheme: dark)"

      srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source

      media="(prefers-color-scheme: light)"

      srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img

      alt="Autofix with [code]smith"

      src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png"

      width="190" height="28"></picture></a>

      <sup>Need help on this PR? Tag <code>@codesmith</code> with what you

      need.</sup>


      <!-- codesmith:autofix:disabled -->

      <!-- /codesmith:footer -->


      Co-authored-by: stlc-sealback-bot[bot]
      <298483487+stlc-sealback-bot[bot]@users.noreply.github.com>
    author: stlc-sealback-bot[bot]
    branch: HEAD
    dirty: false
  x-build:
    built_at: '2026-10-29T20:27:44.269490+00:00'
servers:
  - url: http://localhost/v0.2
    description: localhost
security:
  - {}
  - BearerAuth: []
paths:
  /events:
    get:
      tags:
        - Events
      summary: Stream Events
      description: >
        Subscribe to a Server-Sent Events (SSE) stream of agent lifecycle
        events.


        The stream replays retained historical events after the cursor, then

        delivers live events as they occur. Events are delivered at-least-once;

        clients should deduplicate by event `id`.


        Use the `after` query parameter or `Last-Event-ID` header to resume

        from a previous position. If the cursor is older than the earliest

        retained event, the server returns `410 Gone`.
      operationId: streamEvents
      parameters:
        - name: after
          in: query
          required: false
          description: >-
            Event ID cursor. Only events with `id` greater than this value are
            returned. Takes precedence over the `Last-Event-ID` header.
          schema:
            type: integer
            format: int64
          example: 42
        - name: types
          in: query
          required: false
          description: Event types to receive. If omitted, all event types are sent.
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
          example:
            - deployment.deployed
            - deployment.removed
        - name: Last-Event-ID
          in: header
          required: false
          description: >-
            Standard SSE reconnection header. Used as the replay cursor if
            `after` query parameter is not provided.
          schema:
            type: string
          example: '42'
      responses:
        '200':
          description: >-
            SSE event stream. Each event is delivered as an SSE frame with `id`,
            `event`, and `data` fields. A ": heartbeat" comment is sent
            immediately when the connection opens, and again every 30 seconds
            while the stream is idle. Comments carry no data and should be
            ignored by clients.
          content:
            text/event-stream:
              schema:
                $ref: '#/components/schemas/Event'
      x-codeSamples:
        - lang: curl
          label: curl (Linux)
          source: |-
            curl \
              --no-buffer \
              --unix-socket /run/miru/miru.sock \
              --request GET \
              --url http://localhost/v0.2/events
        - lang: powershell
          label: PowerShell (Windows)
          source: >-
            $api = Get-Content -Raw
            "$env:ProgramData\Miru\device-api\device-api.json" |
            ConvertFrom-Json; `

            curl.exe --no-buffer `
              --request GET `
              --url "http://127.0.0.1:$($api.port)/v0.2/events" `
              --header "Authorization: Bearer $($api.token)"
components:
  schemas:
    Event:
      title: Event
      type: object
      required:
        - object
        - id
        - type
        - occurred_at
        - data
      properties:
        object:
          type: string
          enum:
            - event
          x-stainless-const: true
          description: The object type, which is always `event`.
          example: event
        id:
          type: integer
          format: int64
          description: >-
            Monotonically increasing event ID. Used as the SSE `id` field and
            for replay cursors.
          example: 42
        type:
          type: string
          description: Event type string in the format `{resource}.{action}`.
          example: deployment.deployed
        occurred_at:
          type: string
          format: date-time
          description: Timestamp of when the event occurred.
          example: '2026-03-10T12:00:00Z'
        data:
          type: object
          description: Event-specific payload. Shape varies by event type.
      example:
        object: event
        id: 42
        type: deployment.deployed
        occurred_at: '2026-03-10T12:00:00Z'
        data:
          deployment_id: dpl_123
          release_id: rls_123
          status: deployed
          activity_status: deployed
          error_status: none
          target_status: deployed
          deployed_at: '2026-03-10T12:00:00Z'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        The token from the agent's discovery file
        (`%ProgramData%\Miru\device-api\device-api.json` on Windows). Required
        over loopback TCP (`127.0.0.1:6478` by default on Windows) and accepted
        by every route; not used over the Unix socket.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.