# prov.account.importTextConsents

prov.account.importTextConsents in Node SDK. Slice 2: import a CSV of phones that agreed to your texts (mode `company`, Pro and up): the columns `phone`, `method`, `obtained_at` and, optionally, `evidence_url`; up to 50,000 rows and 5 MB.

## Signature

```ts
prov.account.importTextConsents(file: string | Uint8Array | Blob, opts?: { fileName?: string }): Promise<TextConsentImport>
```

## Parameters

- `file` (string | Uint8Array | Blob)
- `opts` ({ fileName?: string }, optional)

## Returns

`Promise<TextConsentImport>`

## HTTP operation

[`POST /v1/account/text_consent_imports`](https://provenanceauth.com/docs/api/account.md#post-v1-account-text-consent-imports): Import consents to text from a CSV

## Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`text_consent_mode_mismatch`](https://provenanceauth.com/docs/platform/errors.md#text_consent_mode_mismatch)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`text_consents_unavailable`](https://provenanceauth.com/docs/platform/errors.md#text_consents_unavailable)

## Example

**Node**

```ts
import { readFile } from "node:fs/promises";

const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/text_consent_imports?file_name=consents.csv`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "text/csv" },
  body: await readFile("consents.csv"),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
with open("consents.csv", "rb") as f:
    data = httpx.post(
        f"{api}/v1/account/text_consent_imports",
        params={"file_name": "consents.csv"},
        headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}", "Content-Type": "text/csv"},
        content=f.read(),
    ).json()
```
