# client.consents

> The consents methods of the morevoice Python SDK: Recorded marketing consent (§30A).

Recorded marketing consent (§30A). These methods are on `client.consents`, 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()`

**Record consents.** Records marketing consent (§30A) for up to 1,000 numbers, with where it was given and what proves it. Needs a live key.

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

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

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `phones` | `string[]` | yes | Up to 1000 numbers that gave consent. |
| `evidence` | `string` | no | What proves it: a form URL, a recording reference, a document ID. |
| `granted_at` | `string` | no | When the consent was given (default: now). Not in the future. |
| `source` | `string` | no | Where the consent was given (default `api`). |

### Returns

`ConsentBatch`:

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"consent_batch"` | Always `consent_batch`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `recorded` | `string[]` | Numbers a consent record was added for (E.164). |
| `invalid` | `string[]` | Entries that are not valid phone numbers, as sent. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

consent_batch = client.consents.create({
    "evidence": "https://example.com/forms/123",
    "granted_at": "2026-10-30T12:00:00.000Z",
    "phones": [
        "+972501234567",
    ],
    "source": "web_form",
})
print(consent_batch)
```

## `delete()`

**Revoke a number's consent.** Revokes every active consent of the number. The records stay (with `revoked_at`) as evidence. Needs a live key.

```python
# client.consents
def delete(self, phone: str, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.ConsentRevocation
```

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

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `phone` | `str` | yes | The number (URL-encode the `+` as `%2B`). |

### Returns

`ConsentRevocation`:

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"consent_revocation"` | Always `consent_revocation`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `phone` | `string` | — |
| `revoked_at` | `string` | An ISO-8601 timestamp in UTC. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

consent_revocation = client.consents.delete("+972501234567")
print(consent_revocation)
```

## `list()`

**List consent records.** Lists the recorded consents to be called (§30A), newest first. Filter by `phone` (any common format) or by `active` (`false` lists revoked records). Test keys can read the list; recording or revoking consent needs a live key.

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

`client.consents.list()` · `await async_client.consents.list()` · `GET /consents` · [API reference](https://docs.morevoice.ai/api/operations/consents_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). |
| `phone` | `string` | no | Only this number (any common form). |
| `active` | `"true" \| "false"` | no | Only active (`true`) or only revoked (`false`) records. |

### Returns

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

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

for consent in client.consents.list():
    print(consent)
```
