# client.queues

> The queues methods of the morevoice Python SDK: Call queues and their live state.

Call queues and their live state. These methods are on `client.queues`, where `client` is a `MoreVoice` client (see [the Python SDK](https://docs.morevoice.ai/sdk/python/#connect)). On `AsyncMoreVoice` the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.

## `create()`

**Create a queue.** Returns the new `Queue`.

```python
# client.queues
def create(self, body: _m.QueueCreateParamsInput | Mapping[str, Any], *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.Queue
```

`client.queues.create()` · `await async_client.queues.create()` · `POST /queues` · [API reference](https://docs.morevoice.ai/api/operations/queues_create/)

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | — |
| `away_on_missed` | `boolean` | no | — |
| `callbacks` | `object` | no | — |
| `copilot_profile_id` | `string \| null` | no | `cop_…` ID. |
| `enabled` | `boolean` | no | — |
| `hold` | `object` | no | — |
| `max_wait_seconds` | `integer` | no | — |
| `member_team_ids` | `string[]` | no | — |
| `member_user_ids` | `string[]` | no | — |
| `overflow` | `object` | no | Fields you leave out are kept. |
| `ring_timeout_seconds` | `integer` | no | — |
| `strategy` | `"longest_idle" \| "round_robin"` | no | — |
| `voice_assistant_id` | `string \| null` | no | `asst_…` ID. |
| `voicemail` | `object` | no | — |
| `wait_keys` | `object` | no | — |
| `wrap_up_seconds` | `integer` | no | — |

### Returns

`Queue`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The queue's ID. |
| `object` | `"queue"` | Always `queue`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `enabled` | `boolean` | A disabled queue takes no calls: they overflow. |
| `strategy` | `"longest_idle" \| "round_robin"` | Which available agent rings first: the one idle longest, or in turn. |
| `member_user_ids` | `string[]` | Users who answer this queue's calls. |
| `member_team_ids` | `string[]` | Teams whose members answer this queue's calls. |
| `ring_timeout_seconds` | `integer` | How long an agent's phone rings before the next agent is tried. |
| `max_wait_seconds` | `integer` | How long a caller waits before the overflow action (0: no limit). |
| `wrap_up_seconds` | `integer` | After-call time before an agent gets the next call. |
| `away_on_missed` | `boolean` | An agent who misses a call is set to away. |
| `overflow` | `object` | What happens to callers who waited too long, or when nobody can answer. |
| `voicemail` | `object` | — |
| `hold` | `object` | — |
| `wait_keys` | `object` | — |
| `callbacks` | `object` | How callbacks requested in this queue are returned. |
| `voice_assistant_id` | `string \| null` | The assistant whose voice speaks the queue's announcements. |
| `copilot_profile_id` | `string \| null` | The copilot profile agents get on this queue's calls. |
| `created` | `string` | An ISO-8601 timestamp in UTC. |
| `updated` | `string` | An ISO-8601 timestamp in UTC. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

queue = client.queues.create({
    "max_wait_seconds": 180,
    "member_team_ids": [
        "team_7Hj2Kl4Mn6Pq8Rs0Tu2Vw",
    ],
    "name": "Support",
    "overflow": {
        "action": "voicemail",
    },
})
print(queue)
```

## `delete()`

**Delete a queue.** Deletes the queue. Inbound routes that sent calls to it no longer target a queue; callers waiting in it now overflow.

```python
# client.queues
def delete(self, id: str, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.DeletedQueue
```

`client.queues.delete()` · `await async_client.queues.delete()` · `DELETE /queues/{id}` · [API reference](https://docs.morevoice.ai/api/operations/queues_delete/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `str` | yes | A queue ID (`q_…`). |

### Returns

`DeletedQueue`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | A queue ID (prefix `q_`). |
| `object` | `"queue"` | Always `queue`. |
| `deleted` | `true` | — |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

deleted_queue = client.queues.delete("q_7Hk2Lm9Qp")
print(deleted_queue)
```

## `list()`

**List queues.** Your queues, newest first.

```python
# client.queues
def list(self, *, limit: int | Unset = 20, starting_after: str | Unset = UNSET, ending_before: str | Unset = UNSET, more_voice_version: str | Unset = UNSET) -> AsyncPage[_m.Queue]
```

`client.queues.list()` · `await async_client.queues.list()` · `GET /queues` · [API reference](https://docs.morevoice.ai/api/operations/queues_list/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | no | How many objects to return, 1–100 (default 20). |
| `starting_after` | `string` | no | A cursor (`next_cursor`) or object ID: return the objects after it (older). |
| `ending_before` | `string` | no | A cursor or object ID: return the objects before it (newer). |

### Returns

A page of results (`QueueList`): `data`, `has_more` and `next_cursor`.

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

for queue in client.queues.list():
    print(queue)
```

## `retrieve()`

**Retrieve a queue.** Returns the `Queue` object. Answers `404` with the code `resource_missing` when nothing has this ID in this organisation and mode.

```python
# client.queues
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.Queue
```

`client.queues.retrieve()` · `await async_client.queues.retrieve()` · `GET /queues/{id}` · [API reference](https://docs.morevoice.ai/api/operations/queues_retrieve/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `str` | yes | A queue ID (`q_…`). |

### Returns

`Queue`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The queue's ID. |
| `object` | `"queue"` | Always `queue`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `enabled` | `boolean` | A disabled queue takes no calls: they overflow. |
| `strategy` | `"longest_idle" \| "round_robin"` | Which available agent rings first: the one idle longest, or in turn. |
| `member_user_ids` | `string[]` | Users who answer this queue's calls. |
| `member_team_ids` | `string[]` | Teams whose members answer this queue's calls. |
| `ring_timeout_seconds` | `integer` | How long an agent's phone rings before the next agent is tried. |
| `max_wait_seconds` | `integer` | How long a caller waits before the overflow action (0: no limit). |
| `wrap_up_seconds` | `integer` | After-call time before an agent gets the next call. |
| `away_on_missed` | `boolean` | An agent who misses a call is set to away. |
| `overflow` | `object` | What happens to callers who waited too long, or when nobody can answer. |
| `voicemail` | `object` | — |
| `hold` | `object` | — |
| `wait_keys` | `object` | — |
| `callbacks` | `object` | How callbacks requested in this queue are returned. |
| `voice_assistant_id` | `string \| null` | The assistant whose voice speaks the queue's announcements. |
| `copilot_profile_id` | `string \| null` | The copilot profile agents get on this queue's calls. |
| `created` | `string` | An ISO-8601 timestamp in UTC. |
| `updated` | `string` | An ISO-8601 timestamp in UTC. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

queue = client.queues.retrieve("q_7Hk2Lm9Qp")
print(queue)
```

## `retrieve_live()`

**Retrieve a queue's live state.** Who is waiting and for how long, which agents can take the calls, and today's numbers. A snapshot: poll it, or follow `queue.*` events.

```python
# client.queues
def retrieve_live(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.QueueLive
```

`client.queues.retrieve_live()` · `await async_client.queues.retrieve_live()` · `GET /queues/{id}/live` · [API reference](https://docs.morevoice.ai/api/operations/queues_retrieve_live/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `str` | yes | A queue ID (`q_…`). |

### Returns

`QueueLive`:

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"queue_live"` | Always `queue_live`. |
| `queue_id` | `string` | A queue ID (prefix `q_`). |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `enabled` | `boolean` | — |
| `waiting` | `integer` | Callers waiting for an agent right now. |
| `longest_wait_seconds` | `integer \| null` | How long the longest-waiting caller has waited (null: nobody waits). |
| `agents` | `object` | The queue's signed-in members by status. |
| `callers` | `object[]` | Waiting callers, longest wait first. |
| `members` | `object[]` | The queue's signed-in members. |
| `callbacks_offered` | `integer` | Callbacks ringing this queue's agents right now. |
| `today` | `object \| null` | Since midnight (Israel time); null when the statistics are unavailable. |
| `as_of` | `string` | An ISO-8601 timestamp in UTC. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

queue_live = client.queues.retrieve_live("q_7Hk2Lm9Qp")
print(queue_live)
```

## `update()`

**Update a queue.** Updates the fields you send. Nested objects (`overflow`, `hold`, `callbacks`…) merge with the stored values; lists replace them.

```python
# client.queues
def update(self, id: str, body: _m.QueueUpdateParamsInput | Mapping[str, Any] | Unset = UNSET, *, more_voice_version: str | Unset = UNSET) -> _m.Queue
```

`client.queues.update()` · `await async_client.queues.update()` · `PATCH /queues/{id}` · [API reference](https://docs.morevoice.ai/api/operations/queues_update/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `str` | yes | A queue ID (`q_…`). |

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `away_on_missed` | `boolean` | no | — |
| `callbacks` | `object` | no | — |
| `copilot_profile_id` | `string \| null` | no | `cop_…` ID. |
| `enabled` | `boolean` | no | — |
| `hold` | `object` | no | — |
| `max_wait_seconds` | `integer` | no | — |
| `member_team_ids` | `string[]` | no | — |
| `member_user_ids` | `string[]` | no | — |
| `name` | `string` | no | — |
| `overflow` | `object` | no | Fields you leave out are kept. |
| `ring_timeout_seconds` | `integer` | no | — |
| `strategy` | `"longest_idle" \| "round_robin"` | no | — |
| `voice_assistant_id` | `string \| null` | no | `asst_…` ID. |
| `voicemail` | `object` | no | — |
| `wait_keys` | `object` | no | — |
| `wrap_up_seconds` | `integer` | no | — |

### Returns

`Queue`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The queue's ID. |
| `object` | `"queue"` | Always `queue`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `enabled` | `boolean` | A disabled queue takes no calls: they overflow. |
| `strategy` | `"longest_idle" \| "round_robin"` | Which available agent rings first: the one idle longest, or in turn. |
| `member_user_ids` | `string[]` | Users who answer this queue's calls. |
| `member_team_ids` | `string[]` | Teams whose members answer this queue's calls. |
| `ring_timeout_seconds` | `integer` | How long an agent's phone rings before the next agent is tried. |
| `max_wait_seconds` | `integer` | How long a caller waits before the overflow action (0: no limit). |
| `wrap_up_seconds` | `integer` | After-call time before an agent gets the next call. |
| `away_on_missed` | `boolean` | An agent who misses a call is set to away. |
| `overflow` | `object` | What happens to callers who waited too long, or when nobody can answer. |
| `voicemail` | `object` | — |
| `hold` | `object` | — |
| `wait_keys` | `object` | — |
| `callbacks` | `object` | How callbacks requested in this queue are returned. |
| `voice_assistant_id` | `string \| null` | The assistant whose voice speaks the queue's announcements. |
| `copilot_profile_id` | `string \| null` | The copilot profile agents get on this queue's calls. |
| `created` | `string` | An ISO-8601 timestamp in UTC. |
| `updated` | `string` | An ISO-8601 timestamp in UTC. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

queue = client.queues.update("q_7Hk2Lm9Qp", {
    "enabled": False,
})
print(queue)
```
