# Add contacts to a campaign

`POST https://api.morevoice.ai/v1/campaigns/{id}/contacts`

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).

Authenticate with a secret API key: `Authorization: Bearer $MOREVOICE_API_KEY`.

Operation ID: `campaigns_contacts_create`.

## Parameters

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | A campaign ID (`cmp_…`). |

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `MoreVoice-Version` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `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. |

## Request body

Required, `application/json`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contacts` | `ContactInputInput[]` | yes | Up to 1000 contacts. |
| `default_country` | `string` | no | Country of numbers written without a country code (ISO 3166-1 alpha-2, default IL). |
| `drop_dnc` | `boolean` | no | Leave numbers on the do-not-call list out entirely (default false: they are kept with status dnc, for the record, and never dialled). |

Example:

```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"
}
```

## Responses

### 200 OK

OK Returns `ContactBatchResult`.

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"contact_batch_result"` | — |
| `campaign_id` | `string` | A campaign ID (prefix `cmp_`). |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `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. |
| `rejected_reasons.invalid` | `integer` | Not a valid phone number. |
| `rejected_reasons.duplicate` | `integer` | Repeated in the request, or already in the campaign. |
| `rejected_reasons.dnc` | `integer` | On the organisation's do-not-call list. |
| `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 contacts (the first 100). |
| `warnings` | `object[]` | Contacts added with a problem, e.g. consent claimed without complete evidence (the first 100). |

Example:

```json
{
  "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
}
```

### 400 Bad Request

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

### 401 Unauthorized

No valid API key was sent. Returns `ErrorEnvelope`.

### 403 Forbidden

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

### 404 Not Found

No object with this ID (in the path or the body) exists in this organisation and mode. Returns `ErrorEnvelope`.

### 409 Conflict

The request conflicts with the object's state, or the Idempotency-Key was reused with other parameters. Returns `ErrorEnvelope`.

### 413 Payload Too Large

The request body is larger than the endpoint accepts, or has more parts or files than it takes. Returns `ErrorEnvelope`.

### 415 Unsupported Media Type

The request body's Content-Type is not one the endpoint takes. Returns `ErrorEnvelope`.

### 429 Too Many Requests

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

### 500 Internal Server Error

Something went wrong on MoreVoice's side. Retry with the same Idempotency-Key. Returns `ErrorEnvelope`.

## Code samples

**TypeScript**

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

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

const contactBatchResult = await mv.campaigns.contacts.create("cmp_7Hk2Lm9Qp", {
	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);
```

**Python**

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

contact_batch_result = client.campaigns.contacts.create("cmp_7Hk2Lm9Qp", {
    "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",
})
print(contact_batch_result)
```

**cURL**

```sh
curl -X POST https://api.morevoice.ai/v1/campaigns/cmp_7Hk2Lm9Qp/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"
}'
```
