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

# Reconnect to a run stream

> Subscribe to an existing run without starting another task. When resuming, send the last received SSE id in Last-Event-ID, in Redis cursor form such as 1791763200000-0. Replay depends on server-retained events; do not automatically start another run if replay is unavailable.



## OpenAPI

````yaml /api/openapi.sdk.json get /api/ai/threads/{thread_id}/runs/{run_id}/stream
openapi: 3.0.3
info:
  title: XpertAI SDK HTTP API
  version: 1.0.0
  description: >-
    Current HTTP endpoints used by the SDK guide. Authenticate with a
    server-side API Key using Authorization: Bearer <API_KEY> or x-api-key.
    These endpoints do not require ChatKit. The reference covers the guide
    examples, not every method exported by the SDK. Check deployment support
    before using additional fields.
servers:
  - url: https://api.xpertai.cn
    description: XpertAI API. Replace with your own API origin for private deployments.
security:
  - ApiKeyBearer: []
  - ApiKeyHeader: []
tags:
  - name: Assistants
  - name: Threads
  - name: Runs
  - name: Contexts
  - name: Store
paths:
  /api/ai/threads/{thread_id}/runs/{run_id}/stream:
    get:
      tags:
        - Runs
      summary: Reconnect to a run stream
      description: >-
        Subscribe to an existing run without starting another task. When
        resuming, send the last received SSE id in Last-Event-ID, in Redis
        cursor form such as 1791763200000-0. Replay depends on server-retained
        events; do not automatically start another run if replay is unavailable.
      operationId: join_run_stream
      parameters:
        - name: thread_id
          in: path
          required: true
          schema:
            type: string
        - name: run_id
          in: path
          required: true
          schema:
            type: string
        - name: Last-Event-ID
          in: header
          required: false
          schema:
            type: string
            pattern: ^\d+-\d+$
            example: 1791763200000-0
      responses:
        '200':
          description: >-
            Schematic SSE frames; real events contain additional fields.
            Preserve each id cursor, ignore colon-prefixed heartbeat comments
            and inspect lifecycle, interruption and error events. HTTP success
            or connection close alone is not task success.
          content:
            text/event-stream:
              schema:
                type: string
              example: >+
                id: 1791763200000-0

                data: {"type":"message","data":"Hello"}


                id: 1791763200001-0

                data:
                {"type":"event","event":"on_conversation_end","data":{"status":"idle","error":null}}

        '400':
          description: Invalid input, identifier mismatch or invalid operation state.
        '401':
          description: Missing or invalid API Key.
        '403':
          description: The caller cannot access the requested resource.
        '404':
          description: Resource not found or unavailable to the caller.
components:
  securitySchemes:
    ApiKeyBearer:
      type: http
      scheme: bearer
      description: Server-side API Key; do not expose it in browser code.
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````

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