# Adicionar destinatários

Source: https://won.dev/pt-BR/docs/email/recipients-add

`POST https://api.won.dev/v1/email/campaigns/{id}/recipients`

Adiciona até 1.000 pessoas a uma campanha, a qualquer momento antes de ela terminar. Cada endereço é conferido enquanto você espera (formato, listas de supressão, se a pessoa já está em outra campanha sua em andamento, regras por região, valores de marcadores faltando), e a resposta lista cada endereço que ficou de fora, com o motivo. Depois, os endereços aceitos passam por uma verificação de caixa existente: os primeiros 50 da campanha em poucos minutos, os demais cerca de um dia antes do primeiro e-mail, para que uma lista longa não seja verificada com meses de antecedência. Os que falham viram `invalid`. Enviar a mesma lista duas vezes não muda nada. Um destinatário pode ser qualquer pessoa que um endpoint retornou para você com e-mail: passe o ID `per_` dela como `contact_id` em vez do endereço. Grátis.

- **Cobrança:** A chamada é grátis, e os e-mails também: eles saem dos domínios de envio do remetente, pagos por mês; veja [Domínios de envio](/pt-BR/docs/email#domains).

Uma chave de teste (`won_test_...`) roda isto no [sandbox](/pt-BR/docs/email#sandbox): nada é enviado e nada é cobrado.

## Parâmetros [#parameters]

`id` faz parte do caminho. Os demais vão no corpo JSON. Requisições `POST` também aceitam o cabeçalho `Idempotency-Key`; veja [Enviar uma requisição duas vezes](/pt-BR/docs/email#idempotency).

| Parâmetro | Tipo | Obrigatório | Descrição (texto original da API) |
| --- | --- | --- | --- |
| `id` | string | sim | Campaign ID, such as `cmp_7p1q8w3e5r4k2m9x`. |
| `recipients` | object[] | sim | Up to 1000 people to add. Each needs `email` or `contact_id`. |
| `recipients[].email` | string | não | The person's work email. |
| `recipients[].contact_id` | string | não | 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 | não | The person's first name, for `{{first_name}}`. |
| `recipients[].last_name` | string | não | The person's last name, for `{{last_name}}`. |
| `recipients[].company` | string | não | The company the person works at, for `{{company}}`. |
| `recipients[].country` | string | não | 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 | não | The person's IANA time zone, when you know it better than the country says. |
| `recipients[].variables` | object | não | Values for your own placeholders, such as `{ "product": "mesh chairs" }` for `{{product}}`. Names are lowercase letters, digits and underscores. |
| `recipients[].metadata` | object | não | 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 | não | Only check the list and say what would happen. Nothing is added. Default: `false`. |

## Resposta [#response]

Com `dry_run: true` nada é criado nem alterado: a resposta tem os mesmos campos e diz o que aconteceria. Os erros estão descritos em [Erros](/pt-BR/docs/errors).

| Campo | Tipo | Descrição (texto original da API) |
| --- | --- | --- |
| `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. |

## Exemplo [#example]

```bash
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"
    }
  ]
}'
```

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