Add recipients
Add up to 1,000 people to a campaign. Every address is checked, and the answer says which were left out and why. Free.
POST https://api.won.dev/v1/email/campaigns/{id}/recipients
Adds up to 1000 people to a campaign, at any time before it ends. Each address is checked while you wait (form, suppression lists, whether the person is already in a running campaign of yours, region rules, missing placeholder values), and the answer lists every address that was left out, with the reason. Accepted addresses are then checked for an existing mailbox, which takes a few minutes; the ones that fail become invalid and cost nothing. Sending the same list twice changes nothing. A recipient can be anyone an endpoint returned to you with an email: pass their per_ ID as contact_id instead of the address. Free; emails are charged when they go out.
- Billing: The call is free. Each email the campaign sends costs $0.03 (
email_sent), see Billing.
Parameters
id is part of the path. The others go in the JSON body. POST requests also take an Idempotency-Key header, see Sending a request twice.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Campaign ID, such as cmp_7p1q8w3e5r4k2m9x. |
recipients | object[] | yes | Up to 1000 people to add. Each needs email or contact_id. |
recipients[].email | string | no | The person's work email. |
recipients[].contact_id | string | no | A person ID this account was given in the last 90 days, such as per_8f3k2m9x4p1q, instead of email: from a contact search, a people search, or any endpoint that returns a person. Their email, name, company and country on file are used. A person found without an email needs one first: POST /enrich/people/email/find with person_id. |
recipients[].first_name | string | no | The person's first name, for {{first_name}}. |
recipients[].last_name | string | no | The person's last name, for {{last_name}}. |
recipients[].company | string | no | The company the person works at, for {{company}}. |
recipients[].country | string | no | Where the person is, as an ISO code such as US. It decides their office hours and which rules apply. Guessed from the address when left out. An address that shows a country itself, such as one ending in .de, stays under that country's rules whatever is given here. |
recipients[].timezone | string | no | The person's IANA time zone, when you know it better than the country says. |
recipients[].variables | object | no | Values for your own placeholders, such as { "product": "mesh chairs" } for {{product}}. Names are lowercase letters, digits and underscores. |
recipients[].metadata | object | no | Your own keys and values, such as {"customer_id": "c_812"}: up to 20 keys of at most 40 characters, each value a string of at most 500. Returned with the recipient, and in the events about them over the campaign's keys of the same name. |
dry_run | boolean | no | Only check the list and say what would happen. Nothing is added. Default: false. |
Response
With dry_run: true nothing is created or changed: the response has the same fields and says what would happen. Errors are described in Errors.
| Field | Type | Description |
|---|---|---|
data | object | What became of each address. |
data.accepted | integer | Addresses taken into the campaign. |
data.duplicates | integer | Addresses that were in the campaign already. Nothing changed for them. |
data.rejected | integer | Addresses left out. results says why for each. |
data.results | object[] | One entry for each address that was rejected, was a duplicate, or was accepted with a warning. Addresses accepted without remark are only counted. |
data.results[].email | string | null | |
data.results[].status | accepted | duplicate | rejected | |
data.results[].recipient_id | string | null | |
data.results[].reason | string | null | Why it was rejected: invalid_address, blocked_mailbox, duplicate_in_request, suppressed, complained, undeliverable, active_in_other_campaign, region_blocked, region_not_declared, personal_mailbox_in_region, missing_variable, contact_not_found or campaign_full. |
data.results[].message | string | null | The same in a sentence, with what to do about it. |
data.results[].warnings | string[] | For an accepted address: shared_mailbox (such as info@, read by whoever is on duty) or personal_mailbox (a private mail service). |
data.dry_run | boolean | True when nothing was added: the answer to dry_run: true. |
notice | string | null | A plain sentence when there is something to know about this answer. Null otherwise. |
usage | object | Nothing is charged here. The balance, for reference. |
usage.cost | number | What this call cost, in US dollars. |
usage.balance | number | The balance left after this call, in US dollars. |
usage.replayed | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |
Example
curl https://api.won.dev/v1/email/campaigns/cmp_7p1q8w3e5r4k2m9x/recipients \
-H "Authorization: Bearer $WON_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"recipients": [
{
"email": "sam.ortiz@brightdesk.example",
"first_name": "Sam",
"company": "Brightdesk"
},
{
"email": "noreply@brightdesk.example",
"company": "Brightdesk"
}
]
}'{
"data": {
"dry_run": false,
"accepted": 1,
"duplicates": 0,
"rejected": 1,
"results": [
{
"email": "noreply@brightdesk.example",
"status": "rejected",
"recipient_id": null,
"reason": "blocked_mailbox",
"message": "This mailbox is not read by a person (such as noreply@ or postmaster@).",
"warnings": []
}
]
},
"notice": null,
"usage": {
"cost": 0,
"balance": 48.08,
"replayed": false
}
}A test key (won_test_...) runs this in the sandbox: nothing is sent and nothing is charged.