Add contacts to a campaign
import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({ client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),});
const contactBatchResult = await mv.campaigns.contacts.create("cmp_ojFwMD7YNTROjaTP0i3ZFb", { contacts: [ { consent: { channel: "web", granted_at: "2026-09-20T14:02:00+03:00", source: "website_form_2026", }, name: "Dana Levi", phone: "+972501234567", variables: { plan: "Gold", }, }, { name: "Yossi Cohen", phone: "052-765-4321", variables: { plan: "Silver", }, }, ], default_country: "IL",});console.log(contactBatchResult);import osimport uuid
import requests
response = requests.post( "https://api.morevoice.ai/v1/campaigns/cmp_ojFwMD7YNTROjaTP0i3ZFb/contacts", headers={"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "contacts": [ { "consent": { "channel": "web", "granted_at": "2026-09-20T14:02:00+03:00", "source": "website_form_2026", }, "name": "Dana Levi", "phone": "+972501234567", "variables": { "plan": "Gold", }, }, { "name": "Yossi Cohen", "phone": "052-765-4321", "variables": { "plan": "Silver", }, }, ], "default_country": "IL", },)response.raise_for_status()print(response.json())curl -X POST https://api.morevoice.ai/v1/campaigns/cmp_ojFwMD7YNTROjaTP0i3ZFb/contacts \ -H "Authorization: Bearer $MOREVOICE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "contacts": [ { "consent": { "channel": "web", "granted_at": "2026-09-20T14:02:00+03:00", "source": "website_form_2026" }, "name": "Dana Levi", "phone": "+972501234567", "variables": { "plan": "Gold" } }, { "name": "Yossi Cohen", "phone": "052-765-4321", "variables": { "plan": "Silver" } } ], "default_country": "IL"}'Adds up to 1,000 contacts and answers what was added and what was left out, like a dashboard import of the same list: numbers are normalised and de-duplicated, do-not-call numbers are kept as dnc (never dialled), and in a marketing campaign a contact without consent evidence is added but skipped by the dialer (§30A).
Try it in the API playground with a test-mode key.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”A campaign ID (cmp_…).
Header Parameters
Section titled “Header Parameters”The API version to use for this request. Defaults to the version the API key is pinned to.
Example
2026-11-01A 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-2b6d8e4c0a17Request Bodyrequired
Section titled “Request Bodyrequired”Contacts to add, checked like a dashboard import: normalised, de-duplicated, scrubbed against the do-not-call list and, for marketing, consent.
object
Up to 1000 contacts.
A contact to add to a campaign.
object
Marketing campaigns: the person’s consent with its evidence. Without it the contact is imported but not dialled.
object
How they agreed.
When the person agreed to marketing calls.
Where they agreed, e.g. the form or campaign name.
The number, E.164 (+972…) or national (050-…, read with default_country).
The contact’s IANA time zone, if not the campaign’s.
Values for {{variables}} in the campaign’s first message and script.
object
Country of numbers written without a country code (ISO 3166-1 alpha-2, default IL).
Leave numbers on the do-not-call list out entirely (default false: they are kept with status dnc, for the record, and never dialled).
Responses
Section titled “Responses”OK
What a batch added and why anything was left out.
object
A campaign ID (prefix cmp_).
Consent records created from the evidence sent.
Rejected contacts (the first 100).
object
Position in contacts (0-based).
The number as sent.
Contacts added to the campaign for dialling.
true in live mode, false in test mode.
Non-empty contacts / rows received.
Contacts not added for dialling (invalid, duplicate, do-not-call).
Rejected contacts per reason.
object
On the organisation’s do-not-call list.
Repeated in the request, or already in the campaign.
Not a valid phone number.
Contacts added with a problem, e.g. consent claimed without complete evidence (the first 100).
object
Position in contacts (0-based).
The number as sent.
Marketing: contacts added without a consent record. The dialer skips them (§30A) unless consent is recorded first.
Example
{ "campaign_id": "cmp_2Yb7mCq9aPLk", "consent_recorded": 1, "errors": [ { "index": 2, "message": "On the do-not-call list", "phone": "+972541112233", "reason": "dnc" } ], "imported": 2, "livemode": true, "object": "contact_batch_result", "received": 3, "rejected": 1, "rejected_reasons": { "dnc": 1, "duplicate": 0, "invalid": 0 }, "warnings": [], "without_consent": 1}The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the 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" }}Headers
Section titled “Headers”The request’s ID (req_…). Quote it when you contact support.
No valid API key was sent.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the 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" }}Headers
Section titled “Headers”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).
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the 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" }}Headers
Section titled “Headers”The request’s ID (req_…). Quote it when you contact support.
No object with this ID exists in this organisation and mode.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the 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" }}Headers
Section titled “Headers”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.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the 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" }}Headers
Section titled “Headers”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.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the 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" }}Headers
Section titled “Headers”Seconds to wait before retrying.
The request’s ID (req_…). Quote it when you contact support.
Something went wrong on MoreVoice’s side. Retry with the same Idempotency-Key.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the 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" }}Headers
Section titled “Headers”The request’s ID (req_…). Quote it when you contact support.