# mv.imports

> The imports methods of @morevoice/sdk: Background contact-list imports and their results.

Background contact-list imports and their results. These methods are on `mv.imports`, 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.

## `retrieve()`

**Retrieve a contact import.** Returns a background contact import: its `status` (`pending`, `processing`, then `succeeded` or `failed`), how many rows were received, imported and rejected, and why rows were rejected. Poll it until it succeeds or fails; `importCsv` in the SDK does that for you.

```ts
mv.imports.retrieve(id: ImportsRetrieveData["path"]["id"], options?: RequestOptions): Promise<ImportsRetrieveResponse>
```

`GET /imports/{id}` · [API reference](https://docs.morevoice.ai/api/operations/imports_retrieve/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | A import ID (`imp_…`). |
| `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

`ContactImport`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | A import ID (prefix `imp_`). |
| `object` | `"import"` | Always `import`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `campaign_id` | `string` | A campaign ID (prefix `cmp_`). |
| `status` | `"pending" \| "processing" \| "succeeded" \| "failed"` | pending → processing → succeeded \| failed. Poll GET /v1/imports/{id}. |
| `source` | `"csv" \| "xlsx" \| "url"` | — |
| `filename` | `string \| null` | — |
| `received` | `integer` | Non-empty contacts / rows received. |
| `imported` | `integer` | Contacts added to the campaign for dialling. |
| `rejected` | `integer` | Contacts not added for dialling (invalid, duplicate, do-not-call). |
| `rejected_reasons` | `ContactRejectedReasons` | Rejected contacts per reason. |
| `without_consent` | `integer` | Marketing: contacts added without a consent record. The dialer skips them (§30A) unless consent is recorded first. |
| `consent_recorded` | `integer` | Consent records created from the evidence sent. |
| `errors` | `object[]` | Rejected rows (the first 100). |
| `warnings` | `object[]` | Rows added with a problem (the first 100). |
| `error` | `object \| null` | Why the import failed (status failed): a stable code and a message to show. |
| `created_at` | `string` | An ISO-8601 timestamp in UTC. |
| `started_at` | `string \| null` | — |
| `completed_at` | `string \| null` | — |

### Example

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

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

const contactImport = await mv.imports.retrieve("imp_7Hk2Lm9Qp");
console.log(contactImport);
```
