mv.consents
Recorded marketing consent (§30A). These methods are on mv.consents, where mv is your client (see the Node.js SDK). Each one returns the response object and throws 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.
mv.consents.create(body: ConsentsCreateData["body"], options?: RequestOptions): Promise<ConsentsCreateResponse>POST /consents · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
body.phones |
string[] |
yes | Up to 1000 numbers that gave consent. |
body.evidence |
string |
no | What proves it: a form URL, a recording reference, a document ID. |
body.granted_at |
string |
no | When the consent was given (default: now). Not in the future. |
body.source |
string |
no | Where the consent was given (default api). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
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”import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({ client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),});
const consentBatch = await mv.consents.create({ evidence: "https://example.com/forms/123", granted_at: "2026-10-30T12:00:00.000Z", phones: [ "+972501234567", ], source: "web_form",});console.log(consentBatch);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.
mv.consents.delete(phone: ConsentsDeleteData["path"]["phone"], options?: RequestOptions): Promise<ConsentsDeleteResponse>DELETE /consents/{phone} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
phone |
string |
yes | The number (URL-encode the + as %2B). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
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”import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({ client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),});
const consentRevocation = await mv.consents.delete("+972501234567");console.log(consentRevocation);list()
Section titled “list()”List consent records.
mv.consents.list(query?: NonNullable<ConsentsListData["query"]>, options?: RequestOptions): PagedList<ConsentsListResponse["data"][number], NonNullable<ConsentsListData["query"]>>GET /consents · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.limit |
integer |
no | How many objects to return, 1–100 (default 20). |
query.starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
query.ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
query.phone |
string |
no | Only this number (any common form). |
query.active |
string |
no | Only active (true) or only revoked (false) records. |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”A PagedList: await it for the first page, for await it for every item.
Example
Section titled “Example”import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({ client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),});
for await (const consent of mv.consents.list()) { console.log(consent);}