# client.teams

> The teams methods of the morevoice Python SDK: Teams of users.

Teams of users. These methods are on `client.teams`, 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 team.** Returns the new `Team`.

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

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

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | — |

### Returns

`Team`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The team's ID. |
| `object` | `"team"` | Always `team`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `member_count` | `integer` | Active members in the team. |
| `created` | `string` | An ISO-8601 timestamp in UTC. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

team = client.teams.create({
    "name": "Sales",
})
print(team)
```

## `delete()`

**Delete a team.** Deletes the team. Its members stay in the organisation, in no team; queues that list the team no longer reach them through it.

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

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

### Parameters

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

### Returns

`DeletedTeam`:

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

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

deleted_team = client.teams.delete("team_7Hk2Lm9Qp")
print(deleted_team)
```

## `list()`

**List teams.** Returns a page of `Team` objects, newest first. Pass `next_cursor` as `starting_after` for the next page; the SDKs iterate every page for you.

```python
# client.teams
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.Team]
```

`client.teams.list()` · `await async_client.teams.list()` · `GET /teams` · [API reference](https://docs.morevoice.ai/api/operations/teams_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 (`TeamList`): `data`, `has_more` and `next_cursor`.

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

for team in client.teams.list():
    print(team)
```

## `retrieve()`

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

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

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

### Parameters

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

### Returns

`Team`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The team's ID. |
| `object` | `"team"` | Always `team`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `member_count` | `integer` | Active members in the team. |
| `created` | `string` | An ISO-8601 timestamp in UTC. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

team = client.teams.retrieve("team_7Hk2Lm9Qp")
print(team)
```

## `update()`

**Rename a team.** Changes only the fields you send. Returns the updated `Team`. Answers `404` with the code `resource_missing` when nothing has this ID in this organisation and mode.

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

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

### Parameters

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

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | — |

### Returns

`Team`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The team's ID. |
| `object` | `"team"` | Always `team`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `member_count` | `integer` | Active members in the team. |
| `created` | `string` | An ISO-8601 timestamp in UTC. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

team = client.teams.update("team_7Hk2Lm9Qp", {
    "name": "Sales",
})
print(team)
```
