Skip to Content
Won.dev

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.

ParameterTypeRequiredDescription
idstringyesCampaign ID, such as cmp_7p1q8w3e5r4k2m9x.
recipientsobject[]yesUp to 1000 people to add. Each needs email or contact_id.
recipients[].emailstringnoThe person's work email.
recipients[].contact_idstringnoA 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_namestringnoThe person's first name, for {{first_name}}.
recipients[].last_namestringnoThe person's last name, for {{last_name}}.
recipients[].companystringnoThe company the person works at, for {{company}}.
recipients[].countrystringnoWhere 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[].timezonestringnoThe person's IANA time zone, when you know it better than the country says.
recipients[].variablesobjectnoValues for your own placeholders, such as { "product": "mesh chairs" } for {{product}}. Names are lowercase letters, digits and underscores.
recipients[].metadataobjectnoYour 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_runbooleannoOnly 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.

FieldTypeDescription
dataobjectWhat became of each address.
data.acceptedintegerAddresses taken into the campaign.
data.duplicatesintegerAddresses that were in the campaign already. Nothing changed for them.
data.rejectedintegerAddresses left out. results says why for each.
data.resultsobject[]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[].emailstring | null
data.results[].statusaccepted | duplicate | rejected
data.results[].recipient_idstring | null
data.results[].reasonstring | nullWhy 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[].messagestring | nullThe same in a sentence, with what to do about it.
data.results[].warningsstring[]For an accepted address: shared_mailbox (such as info@, read by whoever is on duty) or personal_mailbox (a private mail service).
data.dry_runbooleanTrue when nothing was added: the answer to dry_run: true.
noticestring | nullA plain sentence when there is something to know about this answer. Null otherwise.
usageobjectNothing is charged here. The balance, for reference.
usage.costnumberWhat this call cost, in US dollars.
usage.balancenumberThe balance left after this call, in US dollars.
usage.replayedbooleanTrue 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.

On this page