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

# Stream Room Updates

> Consume server-sent room option events as active suppliers return availability for a hotel.

This is an optional server-sent events (SSE) companion to
[Get Room Options](/api-reference/hotel-rooms). Start a room request first,
then connect to the returned `data.sse_stream_url` to receive supplier results
progressively.

## Connect to the Stream

<RequestExample>
  ```bash theme={null}
  curl -N "$UNIFYSTAYS_BASE_URL/hotels/123456/rooms/stream/stream_8f4b9d1f6d9e" \
    -H "x-api-key: $UNIFYSTAYS_API_KEY" \
    -H "language: en"
  ```
</RequestExample>

<Warning>
  The stream requires `x-api-key`. Connect from your backend or proxy the
  stream through your backend; do not place an API key in browser code or a URL.
</Warning>

## Event Flow

| Event              | Meaning                                              | Client action                                                                  |
| ------------------ | ---------------------------------------------------- | ------------------------------------------------------------------------------ |
| `stream_ready`     | The stream was created.                              | Record the stream state if needed.                                             |
| `provider_options` | One supplier returned normalized room options.       | Add the options to the selected hotel's room list.                             |
| `provider_skipped` | A supplier cannot provide streamed room options.     | Continue with options from other suppliers.                                    |
| `provider_error`   | One supplier's room request failed.                  | Continue with other results and show a recoverable state if no options arrive. |
| `done`             | All supplier requests settled or the stream expired. | Close the client connection and stop waiting for updates.                      |

Each event includes the `stream_id`, `hotel_id`, timestamp, and `event_type`.
A `provider_options` event contains options with the `booking_token` required
for prebook.

## Stream Lifetime

Treat `stream_id` as short-lived and single-use. If the stream is missing or
expired, call [Get Room Options](/api-reference/hotel-rooms) again to create a
new stream. The standard room response remains the source for the selected
stay's request context.

The OpenAPI section below documents the required path parameters and request
headers.


## OpenAPI

````yaml reference/openapi.json GET /hotels/{hotel_id}/rooms/stream/{stream_id}
openapi: 3.0.0
info:
  title: Unifystays API
  description: >-
    One unified hotel API across suppliers. Integrate once, then enable and
    manage suppliers from the Unifystays portal.
  version: '1.0'
  contact: {}
servers:
  - url: https://api-sandbox.unifystays.com
    description: Sandbox
  - url: https://api.unifystays.com
    description: Production
security:
  - x-api-key: []
tags: []
paths:
  /hotels/{hotel_id}/rooms/stream/{stream_id}:
    get:
      tags:
        - Hotel Rooms
      operationId: HotelRoomsController_streamRooms
      parameters:
        - name: hotel_id
          required: true
          in: path
          schema:
            type: string
        - name: stream_id
          required: true
          in: path
          schema:
            type: string
        - name: language
          description: Enter language code(ex. en)
          in: header
          schema: {}
      responses:
        '200':
          description: ''
components:
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: Environment-specific API key created in the Unifystays portal

````