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

# Get Stream Status

The `get_stream_status` API checks the current status of a streaming process (conversation streaming). This is useful for checking if the streaming process is still active and if a response is generated for the latest message **in case client disconnects** from the stream.

***

## Case 1: Stream not started yet

```js theme={null}
if (response_processing_status === null && stream_status === 'is_streaming') {
  // code here
}
```

* `stream_status` is "is\_streaming" but `response_processing_status` is `null`.
* Meaning: The message is sent for processing, but no response is being processed yet.
* Action taken:
  * API call to the `get_response` endpoint to get the response.
  * Show message loading state.

## Case 2: Stream initialized and processing

```js theme={null}
else if (response_processing_status === 'processing' && stream_status === 'is_streaming') {
    // code here
}
```

* `stream_status` is "is\_streaming" and `response_processing_status` is "processing".
* Meaning: The response is still being generated. No need to call `get_response` endpoint.
* Action taken:

  * Keeps showing the message loading state.
  * Poll `/get_stream_status` endpoint until `MAX_TRIES` is reached or both (`stream_status` and `response_processing_status`) get `completed` whichever first:
    * If retries (tries) are less than `MAX_TRIES`, increase the counter.
    * If retries exceed `MAX_TRIES`, stop loading and stop polling.

## Case 3: Stream is completed

```js theme={null}
else if (response_processing_status === 'completed' && stream_status === 'completed') {
    // assistant response generation completed
    // code here
}
```

* Both `stream_status` and `response_processing_status` are "completed".

* Meaning: The AI Agent has finished generating the response.

* Action taken:

  * Call the `/get_messages_for_conversation` endpoint to get the latest messages and show them to the UI.

* After processing:
  * Turn off the message loading state
  * Clear polling/interval loop

## Case 4: Unknown / Other status

```js theme={null}
else {
  clearInterval(intervalId);
}
```

* Any other situation that doesn't match the above cases.
* Meaning: Something unexpected happened or no valid status.
* Action taken:
  * Stops checking by clearing the interval.


## OpenAPI

````yaml get /get_stream_status
openapi: 3.0.0
info:
  title: Chatzy AI API
  version: 1.0.0
  description: >-
    Chatzy AI REST API for messaging, contact conversations, and agent
    interactions.
  contact:
    name: Chatzy
    url: https://chatzy.ai
    email: support@chatzy.ai
servers:
  - url: https://vevdoh3hve.execute-api.us-east-1.amazonaws.com/prod
    description: Production Server
security: []
tags:
  - name: Authentication
    description: Authentication to access the API
  - name: Contact Conversations
    description: Get contact conversations
  - name: Conversational AI Agent Interactions
    description: Interact with the conversational AI agent
  - name: Authorized iframe Access
    description: APIs for authorized iframe access
paths:
  /get_stream_status:
    get:
      tags:
        - Conversational AI Agent Interactions
      summary: Get Stream Status
      parameters:
        - name: conversation_id
          in: query
          required: true
          description: Conversation ID for which the stream status is to be checked.
          schema:
            type: string
            example: 96333140-53c3-4d1d-bbd1-edd150d46ea2
      responses:
        '200':
          description: Stream status and messages
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      stream_status:
                        type: string
                        enum:
                          - is_streaming
                          - completed
                        description: Current stream status
                      response_processing_status:
                        type: string
                        enum:
                          - processing
                          - completed
                        description: Processing status of the assistant response
                      messages:
                        type: array
                        description: Latest 10 messages in the conversation
                        items:
                          type: object
                    required:
                      - stream_status
                      - response_processing_status
                      - messages
                required:
                  - data

````