Skip to content

Import a contact list in the background

POST
/campaigns/{id}/contacts/import
import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({
client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),
});
const contactImport = await mv.campaigns.contacts.import("cmp_ojFwMD7YNTROjaTP0i3ZFb", {
csv: "Mobile,Name,Plan\n0501234567,Dana Levi,Gold\n0527654321,Yossi Cohen,Silver\n",
default_country: "IL",
mapping: {
name: "Name",
phone: "Mobile",
variables: {
plan: "Plan",
},
},
});
console.log(contactImport);

Imports a CSV or XLSX list in the background through the dashboard’s import path and answers 202 with the import; poll GET /v1/imports/{id} until it succeeds or fails. Send the file as multipart/form-data (a file part plus the options as text fields, mapping as a JSON string), or as JSON: CSV text, a base64 file, or an https URL to download. An Idempotency-Key is required, so a retried upload never imports twice.

Try it in the API playground with a test-mode key.

id
required
string
<= 200 characters /^cmp_[0-9A-Za-z]+$/

A campaign ID (cmp_…).

MoreVoice-Version
string
/^\d{4}-\d{2}-\d{2}$/

The API version to use for this request. Defaults to the version the API key is pinned to.

Example
2026-11-01
Idempotency-Key
string
>= 1 characters <= 255 characters

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.

Example
5f0c1e8a-7b2d-4c3e-9f1a-2b6d8e4c0a17

A contact list to import in the background (up to 50,000 rows). Send exactly one of csv, file and url.

object
consent_channel

How every consenting row consented, when the file has no channel column.

string
Allowed values: web phone sms email whatsapp app written in_person other
consent_source

Where every consenting row consented, when the file has no source column.

string
>= 1 characters <= 200 characters
csv

The list as CSV text (UTF-8; comma, semicolon, tab or pipe separated).

string
>= 1 characters <= 10485760 characters
default_country

Country of numbers written without a country code (ISO 3166-1 alpha-2, default IL).

string
/^[A-Z]{2}$/
drop_dnc

Leave do-not-call numbers out entirely (default false: kept with status dnc, never dialled).

boolean
file

A CSV or XLSX file.

object
content_base64
required

The file, base64-encoded (≤ 10 MB decoded).

string
>= 1 characters <= 13981018 characters
filename
required

Its name; .xlsx is read as a spreadsheet, anything else as CSV.

string
>= 1 characters <= 200 characters
has_header

The first row holds column names (default: detected).

boolean
mapping

Which column holds what: contact field → header name (or 0-based index). Any other key names a {{variable}}. Omit the mapping to detect the columns like the dashboard does.

object
consent
Any of:
Any of:
string
>= 1 characters <= 200 characters
consent_at
Any of:
Any of:
string
>= 1 characters <= 200 characters
consent_channel
Any of:
Any of:
string
>= 1 characters <= 200 characters
consent_source
Any of:
Any of:
string
>= 1 characters <= 200 characters
name
Any of:
Any of:
string
>= 1 characters <= 200 characters
phone
required
Any of:
string
>= 1 characters <= 200 characters
timezone
Any of:
Any of:
string
>= 1 characters <= 200 characters
variables

{{variable}} name → column (or name them at the top level, as {“plan”: “Plan”}).

object
key
additional properties
Any of:
string
>= 1 characters <= 200 characters
key
additional properties
Any of:
string
>= 1 characters <= 200 characters
url

An https URL to download the CSV / XLSX from (public addresses only, ≤ 10 MB).

string format: uri
<= 2000 characters

Accepted: the import runs in the background.

Media typeapplication/json

A background contact-list import and its result. Poll it until status is succeeded or failed.

object
campaign_id
required

A campaign ID (prefix cmp_).

string
/^cmp_[0-9A-Za-z]+$/
completed_at
required
Any of:

An ISO-8601 timestamp in UTC.

string format: date-time
consent_recorded
required

Consent records created from the evidence sent.

integer
>= -9007199254740991 <= 9007199254740991
created_at
required

An ISO-8601 timestamp in UTC.

string format: date-time
error
required
Any of:
object
code
required
string
message
required
string
errors
required

Rejected rows (the first 100).

Array<object>
object
message
required
string
phone
required

The number as sent.

string
reason
required
string
Allowed values: invalid duplicate dnc consent_without_evidence
row
required

Row in the file (1-based, the header is row 1).

integer
>= -9007199254740991 <= 9007199254740991
filename
required
string | null
id
required

A import ID (prefix imp_).

string
/^imp_[0-9A-Za-z]+$/
imported
required

Contacts added to the campaign for dialling.

integer
>= -9007199254740991 <= 9007199254740991
livemode
required

true in live mode, false in test mode.

boolean
object
required
string
Allowed value: import
received
required

Non-empty contacts / rows received.

integer
>= -9007199254740991 <= 9007199254740991
rejected
required

Contacts not added for dialling (invalid, duplicate, do-not-call).

integer
>= -9007199254740991 <= 9007199254740991
rejected_reasons
required

Rejected contacts per reason.

object
dnc
required

On the organisation’s do-not-call list.

integer
>= -9007199254740991 <= 9007199254740991
duplicate
required

Repeated in the request, or already in the campaign.

integer
>= -9007199254740991 <= 9007199254740991
invalid
required

Not a valid phone number.

integer
>= -9007199254740991 <= 9007199254740991
source
required
string
Allowed values: csv xlsx url
started_at
required
Any of:

An ISO-8601 timestamp in UTC.

string format: date-time
status
required

Pending → processing → succeeded | failed. Poll GET /v1/imports/{id}.

string
Allowed values: pending processing succeeded failed
warnings
required

Rows added with a problem (the first 100).

Array<object>
object
message
required
string
phone
required

The number as sent.

string
reason
required
string
Allowed values: invalid duplicate dnc consent_without_evidence
row
required

Row in the file (1-based, the header is row 1).

integer
>= -9007199254740991 <= 9007199254740991
without_consent
required

Marketing: contacts added without a consent record. The dialer skips them (§30A) unless consent is recorded first.

integer
>= -9007199254740991 <= 9007199254740991
Example
{
"campaign_id": "cmp_2Yb7mCq9aPLk",
"completed_at": "2026-11-02T07:00:03.870Z",
"consent_recorded": 0,
"created_at": "2026-11-02T07:00:00.000Z",
"error": null,
"errors": [
{
"message": "too-short",
"phone": "05012",
"reason": "invalid",
"row": 17
}
],
"filename": "contacts.csv",
"id": "imp_7RkXq2Lm9PvTz4nB1c8Ya",
"imported": 4890,
"livemode": true,
"object": "import",
"received": 5000,
"rejected": 110,
"rejected_reasons": {
"dnc": 20,
"duplicate": 40,
"invalid": 50
},
"source": "csv",
"started_at": "2026-11-02T07:00:00.120Z",
"status": "succeeded",
"warnings": [],
"without_consent": 0
}

The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown.

Media typeapplication/json

Every /v1 error.

object
error
required
object
code
required

A stable, machine-readable code from the error-code catalogue.

string
details

Structured context, e.g. required_scope or the compliance verdict.

object
key
additional properties
doc_url
required

A link to the documentation of this code.

string
message
required

A human-readable explanation. Do not parse it.

string
param

The request parameter the error relates to, e.g. to or metadata[order_id].

string
request_id
required

The X-Request-Id of this request. Quote it when you contact support.

string
type
required

The category of the error.

string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error compliance_error idempotency_error api_error
Example
{
"error": {
"code": "parameter_missing",
"doc_url": "https://docs.morevoice.ai/api/errors#parameter-missing",
"message": "Missing required parameter: to.",
"param": "to",
"request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ",
"type": "invalid_request_error"
}
}
X-Request-Id
string

The request’s ID (req_…). Quote it when you contact support.

No valid API key was sent.

Media typeapplication/json

Every /v1 error.

object
error
required
object
code
required

A stable, machine-readable code from the error-code catalogue.

string
details

Structured context, e.g. required_scope or the compliance verdict.

object
key
additional properties
doc_url
required

A link to the documentation of this code.

string
message
required

A human-readable explanation. Do not parse it.

string
param

The request parameter the error relates to, e.g. to or metadata[order_id].

string
request_id
required

The X-Request-Id of this request. Quote it when you contact support.

string
type
required

The category of the error.

string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error compliance_error idempotency_error api_error
Example
{
"error": {
"code": "invalid_api_key",
"doc_url": "https://docs.morevoice.ai/api/errors#invalid-api-key",
"message": "Invalid API key.",
"request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ",
"type": "authentication_error"
}
}
X-Request-Id
string

The request’s ID (req_…). Quote it when you contact support.

The key may not do this (a missing scope, a plan limit, or a compliance block).

Media typeapplication/json

Every /v1 error.

object
error
required
object
code
required

A stable, machine-readable code from the error-code catalogue.

string
details

Structured context, e.g. required_scope or the compliance verdict.

object
key
additional properties
doc_url
required

A link to the documentation of this code.

string
message
required

A human-readable explanation. Do not parse it.

string
param

The request parameter the error relates to, e.g. to or metadata[order_id].

string
request_id
required

The X-Request-Id of this request. Quote it when you contact support.

string
type
required

The category of the error.

string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error compliance_error idempotency_error api_error
Example
{
"error": {
"code": "missing_scope",
"doc_url": "https://docs.morevoice.ai/api/errors#missing-scope",
"message": "This API key lacks the calls:write scope.",
"request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ",
"type": "permission_error"
}
}
X-Request-Id
string

The request’s ID (req_…). Quote it when you contact support.

No object with this ID exists in this organisation and mode.

Media typeapplication/json

Every /v1 error.

object
error
required
object
code
required

A stable, machine-readable code from the error-code catalogue.

string
details

Structured context, e.g. required_scope or the compliance verdict.

object
key
additional properties
doc_url
required

A link to the documentation of this code.

string
message
required

A human-readable explanation. Do not parse it.

string
param

The request parameter the error relates to, e.g. to or metadata[order_id].

string
request_id
required

The X-Request-Id of this request. Quote it when you contact support.

string
type
required

The category of the error.

string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error compliance_error idempotency_error api_error
Example
{
"error": {
"code": "resource_missing",
"doc_url": "https://docs.morevoice.ai/api/errors#resource-missing",
"message": "No such object: 'call_4Gk2'.",
"param": "id",
"request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ",
"type": "not_found"
}
}
X-Request-Id
string

The request’s ID (req_…). Quote it when you contact support.

The request conflicts with the object’s state, or the Idempotency-Key was reused with other parameters.

Media typeapplication/json

Every /v1 error.

object
error
required
object
code
required

A stable, machine-readable code from the error-code catalogue.

string
details

Structured context, e.g. required_scope or the compliance verdict.

object
key
additional properties
doc_url
required

A link to the documentation of this code.

string
message
required

A human-readable explanation. Do not parse it.

string
param

The request parameter the error relates to, e.g. to or metadata[order_id].

string
request_id
required

The X-Request-Id of this request. Quote it when you contact support.

string
type
required

The category of the error.

string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error compliance_error idempotency_error api_error
Example
{
"error": {
"code": "idempotency_mismatch",
"doc_url": "https://docs.morevoice.ai/api/errors#idempotency-mismatch",
"message": "This Idempotency-Key was already used with different parameters.",
"request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ",
"type": "idempotency_error"
}
}
X-Request-Id
string

The request’s ID (req_…). Quote it when you contact support.

Too many requests, or no call capacity right now. Retry after the Retry-After delay.

Media typeapplication/json

Every /v1 error.

object
error
required
object
code
required

A stable, machine-readable code from the error-code catalogue.

string
details

Structured context, e.g. required_scope or the compliance verdict.

object
key
additional properties
doc_url
required

A link to the documentation of this code.

string
message
required

A human-readable explanation. Do not parse it.

string
param

The request parameter the error relates to, e.g. to or metadata[order_id].

string
request_id
required

The X-Request-Id of this request. Quote it when you contact support.

string
type
required

The category of the error.

string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error compliance_error idempotency_error api_error
Example
{
"error": {
"code": "rate_limited",
"doc_url": "https://docs.morevoice.ai/api/errors#rate-limited",
"message": "Too many requests. Retry after 1 second.",
"request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ",
"type": "rate_limit_error"
}
}
Retry-After
integer

Seconds to wait before retrying.

X-Request-Id
string

The request’s ID (req_…). Quote it when you contact support.

Something went wrong on MoreVoice’s side. Retry with the same Idempotency-Key.

Media typeapplication/json

Every /v1 error.

object
error
required
object
code
required

A stable, machine-readable code from the error-code catalogue.

string
details

Structured context, e.g. required_scope or the compliance verdict.

object
key
additional properties
doc_url
required

A link to the documentation of this code.

string
message
required

A human-readable explanation. Do not parse it.

string
param

The request parameter the error relates to, e.g. to or metadata[order_id].

string
request_id
required

The X-Request-Id of this request. Quote it when you contact support.

string
type
required

The category of the error.

string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error compliance_error idempotency_error api_error
Example
{
"error": {
"code": "internal_error",
"doc_url": "https://docs.morevoice.ai/api/errors#internal-error",
"message": "Something went wrong on MoreVoice's side.",
"request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ",
"type": "api_error"
}
}
X-Request-Id
string

The request’s ID (req_…). Quote it when you contact support.