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

# Chats

> Python SDK reference for the chats resource

<Note>The Bevor SDK is coming soon. This page previews its planned Python interface.</Note>

Access this resource from `client.chats`. Both async and sync clients expose the same methods.

## `create`

POST `/security/chats/analysis`

<CodeGroup>
  ```python Async theme={null}
  result = await client.chats.create(
      version_id=version_id,
  )
  ```

  ```python Sync theme={null}
  result = client.chats.create(
      version_id=version_id,
  )
  ```
</CodeGroup>

| Parameter    | Type | Required | Default |
| ------------ | ---- | -------- | ------- |
| `version_id` | `ID` | Yes      | `—`     |

**Returns:** `IdResponse`

## `list`

GET `/security/chats`

<CodeGroup>
  ```python Async theme={null}
  result = await client.chats.list()
  ```

  ```python Sync theme={null}
  result = client.chats.list()
  ```
</CodeGroup>

| Parameter         | Type                                          | Required | Default |
| ----------------- | --------------------------------------------- | -------- | ------- |
| `page`            | `int \| None`                                 | No       | `None`  |
| `page_size`       | `int \| None`                                 | No       | `None`  |
| `project_id`      | `ID \| None`                                  | No       | `None`  |
| `project_slug`    | `str \| None`                                 | No       | `None`  |
| `code_version_id` | `ID \| None`                                  | No       | `None`  |
| `analysis_id`     | `ID \| None`                                  | No       | `None`  |
| `chat_type`       | `ChatType \| None`                            | No       | `None`  |
| `order_by`        | `Literal['created_at', 'updated_at'] \| None` | No       | `None`  |
| `order`           | `Literal['desc', 'asc'] \| None`              | No       | `None`  |

**Returns:** `Pagination[SecurityChatSchema]`

## `get`

GET `/security/chats/{chat_id}`

<CodeGroup>
  ```python Async theme={null}
  result = await client.chats.get(
      chat_id=chat_id,
  )
  ```

  ```python Sync theme={null}
  result = client.chats.get(
      chat_id=chat_id,
  )
  ```
</CodeGroup>

| Parameter | Type | Required | Default |
| --------- | ---- | -------- | ------- |
| `chat_id` | `ID` | Yes      | `—`     |

**Returns:** `SecurityChatSchema`

## `update`

PATCH `/security/chats/{chat_id}`

<CodeGroup>
  ```python Async theme={null}
  result = await client.chats.update(
      chat_id=chat_id,
  )
  ```

  ```python Sync theme={null}
  result = client.chats.update(
      chat_id=chat_id,
  )
  ```
</CodeGroup>

| Parameter     | Type         | Required | Default |
| ------------- | ------------ | -------- | ------- |
| `chat_id`     | `ID`         | Yes      | `—`     |
| `analysis_id` | `ID \| None` | No       | `None`  |

**Returns:** `BooleanResponse`

## `messages`

GET `/security/chats/{chat_id}/messages`

<CodeGroup>
  ```python Async theme={null}
  result = await client.chats.messages(
      chat_id=chat_id,
  )
  ```

  ```python Sync theme={null}
  result = client.chats.messages(
      chat_id=chat_id,
  )
  ```
</CodeGroup>

| Parameter | Type | Required | Default |
| --------- | ---- | -------- | ------- |
| `chat_id` | `ID` | Yes      | `—`     |

**Returns:** `ResultsResponse[ChatMessageSchema]`

## `sync`

POST `/security/chats/{chat_id}/sync`

<CodeGroup>
  ```python Async theme={null}
  result = await client.chats.sync(
      chat_id=chat_id,
      message=message,
  )
  ```

  ```python Sync theme={null}
  result = client.chats.sync(
      chat_id=chat_id,
      message=message,
  )
  ```
</CodeGroup>

| Parameter     | Type                           | Required | Default |
| ------------- | ------------------------------ | -------- | ------- |
| `chat_id`     | `ID`                           | Yes      | `—`     |
| `message`     | `str`                          | Yes      | `—`     |
| `is_retry`    | `bool`                         | No       | `False` |
| `attributes`  | `List[Dict[str, Any]] \| None` | No       | `None`  |
| `approval_id` | `str \| None`                  | No       | `None`  |
| `is_approved` | `bool \| None`                 | No       | `False` |

**Returns:** `ChatResponseSchema`

## `generate_key`

POST `/security/chats/{chat_id}/stream-key`

<CodeGroup>
  ```python Async theme={null}
  result = await client.chats.generate_key(
      chat_id=chat_id,
  )
  ```

  ```python Sync theme={null}
  result = client.chats.generate_key(
      chat_id=chat_id,
  )
  ```
</CodeGroup>

| Parameter | Type | Required | Default |
| --------- | ---- | -------- | ------- |
| `chat_id` | `ID` | Yes      | `—`     |

**Returns:** `str`

## `stream`

POST `/security/chats/{chat_id}/stream`

<CodeGroup>
  ```python Async theme={null}
  result = await client.chats.stream(
      chat_id=chat_id,
      stream_key=stream_key,
      message=message,
  )
  ```

  ```python Sync theme={null}
  result = client.chats.stream(
      chat_id=chat_id,
      stream_key=stream_key,
      message=message,
  )
  ```
</CodeGroup>

| Parameter     | Type                           | Required | Default |
| ------------- | ------------------------------ | -------- | ------- |
| `chat_id`     | `str`                          | Yes      | `—`     |
| `stream_key`  | `str`                          | Yes      | `—`     |
| `message`     | `str`                          | Yes      | `—`     |
| `is_retry`    | `bool`                         | No       | `False` |
| `attributes`  | `List[Dict[str, Any]] \| None` | No       | `None`  |
| `approval_id` | `str \| None`                  | No       | `None`  |
| `is_approved` | `bool \| None`                 | No       | `False` |

**Returns:** `Any`
