# mv.consents

> The consents methods of @morevoice/sdk: Recorded marketing consent (§30A).

Recorded marketing consent (§30A). These methods are on `mv.consents`, where `mv` is your client (see [the Node.js SDK](https://docs.morevoice.ai/sdk/node/#connect)). Each one returns the response object and throws 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.

```ts
mv.consents.create(body: ConsentsCreateData["body"], options?: RequestOptions): Promise<ConsentsCreateResponse>
```

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

### 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](https://docs.morevoice.ai/sdk/typescript/retries/). |

### 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

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

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()`

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

```ts
mv.consents.delete(phone: ConsentsDeleteData["path"]["phone"], options?: RequestOptions): Promise<ConsentsDeleteResponse>
```

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

### 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](https://docs.morevoice.ai/sdk/typescript/retries/). |

### 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

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const consentRevocation = await mv.consents.delete("+972501234567");
console.log(consentRevocation);
```

## `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.

```ts
mv.consents.list(query?: NonNullable<ConsentsListData["query"]>, options?: RequestOptions): PagedList<ConsentsListResponse["data"][number], NonNullable<ConsentsListData["query"]>>
```

`GET /consents` · [API reference](https://docs.morevoice.ai/api/operations/consents_list/)

### 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](https://docs.morevoice.ai/sdk/typescript/retries/). |

### Returns

A [`PagedList`](https://docs.morevoice.ai/sdk/typescript/pagination/): `await` it for the first page, `for await` it for every item.

### Example

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

for await (const consent of mv.consents.list()) {
	console.log(consent);
}
```
