client.consents
Recorded marketing consent (§30A). These methods are on client.consents, where client is a MoreVoice client (see the Python SDK). 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()
Section titled “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.
def create(self, body: _m.ConsentsCreateBody | Mapping[str, Any], *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.ConsentBatchclient.consents.create() · await async_client.consents.create() · POST /consents · API reference
Request body
Section titled “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
Section titled “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
Section titled “Example”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()
Section titled “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.
def delete(self, phone: str, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.ConsentRevocationclient.consents.delete() · await async_client.consents.delete() · DELETE /consents/{phone} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
phone |
str |
yes | The number (URL-encode the + as %2B). |
Returns
Section titled “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
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
consent_revocation = client.consents.delete("+972501234567")print(consent_revocation)list()
Section titled “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.
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
Parameters
Section titled “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
Section titled “Returns”A page of results (ConsentList): data, has_more and next_cursor.
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
for consent in client.consents.list(): print(consent)