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

# Create Stream

> Creates a new stream for a specific chat

## Path Parameters

<ParamField path="chatId" type="string" required>
  Chat ID where the stream will be created
</ParamField>

## Body Parameters

<ParamField body="chatId" type="string" required>
  Chat ID (must match path parameter)
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the stream was created successfully
</ResponseField>

<ResponseField name="message" type="string">
  Success or error message
</ResponseField>

<ResponseField name="stream" type="object">
  The created stream object
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.yourdomain.com/api/chats/chat_123abc/streams \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "chatId": "chat_123abc"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.yourdomain.com/api/chats/chat_123abc/streams', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer <token>',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      chatId: "chat_123abc"
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.yourdomain.com/api/chats/chat_123abc/streams"
  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }
  payload = {"chatId": "chat_123abc"}

  response = requests.post(url, headers=headers, json=payload)
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "message": "Stream created successfully",
    "stream": {
      "id": "stream_345xyz",
      "chatId": "chat_123abc",
      "createdAt": "2024-01-17T10:30:00Z"
    }
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "success": false,
    "message": "Unauthorized"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "success": false,
    "message": "Chat not found"
  }
  ```
</ResponseExample>

## Notes

* Streams are typically used for real-time message delivery
* Multiple streams can be created for a single chat
* Ensure the chat exists before creating a stream
