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

# Stream Case Analysis Progress

> Receive real-time Server-Sent Events for case analysis progress updates.

Establish a Server-Sent Events (SSE) connection to receive real-time progress updates during case analysis. This endpoint provides live streaming of analysis events including file processing stages, progress percentages, and completion notifications.

<Warning>
  **Network Restrictions**: SSE streams may not be available on corporate or restricted networks due to proxy configurations, firewall rules, or man-in-the-middle (MITM) detection systems. If streaming fails, use the [polling endpoint](./cases-progress-poll) as a fallback.
</Warning>

## Event Types

The stream provides several event types to help you track progress:

* `file.analysis.progress`: Real-time updates on individual file processing stages.
* `file.analysis.completed`: Notification that a specific file has finished analysis.
* `case.analysis.completed`: Final event indicating the entire case is complete.
* `heartbeat`: Connection keep-alive signal.
* `stream_closed`: Indicates the stream has ended (e.g., if analysis was already finished).

## Best Practices

1. **Reconnection Logic**: Implement automatic reconnection with exponential backoff to handle transient network issues.
2. **Fallback Mechanism**: Always detect SSE connection failures and automatically switch to [polling](./cases-progress-poll).
3. **Resource Cleanup**: Ensure connections are closed when the user leaves the progress screen or the analysis completes.


## OpenAPI

````yaml GET /cases/{id}/progress/stream
openapi: 3.1.0
info:
  title: Veridox Core API
  description: Veridox Core Platform API
  version: 0.0.1
  contact: {}
servers:
  - url: https://api.uk.veridox.ai
    description: Live (UK)
  - url: https://api.ca.veridox.ai
    description: Live (CA)
security: []
tags:
  - name: Status
    description: System status and health check endpoints
  - name: Cases
    description: Case and case file management
  - name: Organisations
    description: Organisation management
  - name: Document Requests
    description: Document request management
  - name: Search
    description: Search functionality
  - name: Admin
    description: Administrative endpoints
paths:
  /cases/{id}/progress/stream:
    get:
      tags:
        - Cases
      summary: Stream case progress updates (SSE)
      description: >-
        Establishes a Server-Sent Events connection to receive real-time
        progress updates for case file analysis. Supports both authenticated
        users (access_token) and API key authentication (api_key). Only the case
        owner can subscribe. Sends heartbeat every 15 seconds.
      operationId: CasesController_streamProgress
      parameters:
        - name: api_key
          required: false
          in: query
          description: API key for authentication (alternative to access_token)
          schema:
            type: string
        - name: access_token
          required: false
          in: query
          description: Access token for JWT authentication
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Case ID
          schema:
            type: string
      responses:
        '401':
          description: Unauthorized (invalid or missing authentication token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '429':
          description: Too many requests (rate limit exceeded)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
      security:
        - api-key: []
components:
  schemas:
    ErrorDto:
      type: object
      properties:
        error_code:
          type: string
          description: Machine-readable error code for programmatic handling
          examples:
            - request.cases.file.missing-risk-score
            - request.authentication.invalid-token
            - request.forbidden
            - request.cases.case.not-found
            - request.cases.case.already-locked
        error_message:
          type: string
          description: Human-readable error message explaining what went wrong
          example: >-
            User tried to perform an invalid operation on a file without a risk
            score.
        error_details:
          type: object
          example:
            field: email_address
      required:
        - error_code
        - error_message
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: x-api-key

````