Pular para o conteúdo
Won.dev
DocumentaçãoReferência da API
API de cold mail

Criar uma campanha

Cria uma cadência de até seis e-mails para uma lista de pessoas e a inicia. Grátis: os e-mails saem dos domínios de envio do remetente.

Cria uma cadência de até seis e-mails para uma lista de pessoas e, com start: true, começa a enviá-la. Envia das caixas dos domínios de envio do próprio remetente (POST /email/domains), poucos e-mails por caixa por dia, no horário comercial de cada destinatário; cada destinatário recebe a cadência inteira da mesma caixa, e a cadência para para uma pessoa assim que ela responde, dá bounce ou se descadastra. Campanhas e e-mails são grátis: o que os domínios do remetente enviam é pago com os domínios. Uma campanha envia por dia o que o daily_limit dela permite, dentro do que os domínios enviam juntos, que todas as campanhas do remetente dividem. Use dry_run: true primeiro: ele confere os textos e a lista, mostra o primeiro e-mail como os primeiros destinatários o receberiam e quanto tempo a campanha leva com os domínios que o remetente tem, sem criar nada. Iniciar falha com no_domains enquanto o remetente não tiver nenhum. Com um cabeçalho Idempotency-Key, uma nova tentativa nunca cria uma segunda campanha. Também dá para adicionar destinatários depois com POST /email/campaigns/{id}/recipients.

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

Uma chave de teste (won_test_...) roda isto no sandbox: nada é enviado e nada é cobrado.

POST
/email/campaigns

Autenticação

apiKey
headerAuthorizationBearer <chave de API>

Authorization: Bearer won_live_..., a key from the console.

Parâmetros de cabeçalho

Idempotency-Key?string

Any unique string. A retry with the same key and the same body returns the first response and is not charged again.

Tamanholength <= 255

Corpo da requisição

application/json
  1. body
sender_id*string

The sender the emails are for, from POST /email/senders.

Tamanholength <= 40
name*string

A name for your own reference. Recipients never see it.

Tamanho1 <= length <= 120
steps*array<>

The emails of the sequence, in order. Two to four work best.

Itens1 <= items <= 6
recipients?array<>

Up to 1000 people to write to. Each is checked: bad addresses, people on a suppression list and people in regions the sender has not declared are left out and listed in the answer.

Itensitems <= 1000
schedule?

When emails go out. The hours are read in each recipient's own time zone when their country or time zone is known.

daily_limit?integer

The most emails the campaign sends on one day. It never sends more than the sender's domains may send, 45 a day each at full speed, which the sender's campaigns share.

Intervalo1 <= value <= 1000
Padrão50
stop_on_company_reply?boolean

When one person at a company answers, stop writing to the others at that company.

Padrãotrue
track_opens?boolean

Count opens with an invisible image. Off by default: it lowers inbox placement, and mail programs that fetch images themselves make the numbers unreliable.

Padrãofalse
track_clicks?boolean

Count clicks by sending links through our redirect. Off by default, for the same reason.

Padrãofalse
metadata?

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 as given, and in the events about it.

start?boolean

Start sending right away. Otherwise the campaign is a draft until POST /email/campaigns/{id}/start.

Padrãofalse
dry_run?boolean

Check everything and show a preview, without creating anything. Problems in the texts are listed instead of failing the call.

Padrãofalse

Corpo da resposta

The result.

application/json
  1. response
data*

The campaign, and what the checks found in its list and its texts.

notice*|

A plain sentence when there is something to know about this answer. Null otherwise.

usage*

Nothing is charged here. The balance, for reference.

Requisição de exemplo
curl -X POST 'https://api.won.dev/v1/email/campaigns' \  -H 'Content-Type: application/json' \  -d '{  "sender_id": "snd_4k2m9x7p1q8w3e5r",  "name": "US chair importers, November",  "steps": [    {      "subject": "Office chairs for {{company}}",      "body": "Hi {{first_name|there}},\n\nI saw that {{company}} imports office seating. We make mesh task chairs in Leeds and ship to the US in four weeks.\n\nWould a price list be useful?\n\n{{sender_first_name}}"    },    {      "delay_days": 3,      "body": "Hi {{first_name|there}},\n\nJust checking that my note reached the right person. Who looks after seating suppliers at {{company}}?\n\n{{sender_first_name}}"    }  ],  "recipients": [    {      "email": "dana.whitfield@harborline-imports.example",      "first_name": "Dana",      "company": "Harborline Imports",      "country": "US"    },    {      "email": "info@coastal-office.example",      "company": "Coastal Office Supply"    }  ],  "daily_limit": 30,  "start": false}'
Resposta de exemplo
{  "data": {    "dry_run": false,    "campaign": {      "id": "cmp_7p1q8w3e5r4k2m9x",      "name": "US chair importers, November",      "sender_id": "snd_4k2m9x7p1q8w3e5r",      "status": "draft",      "pause_reason": null,      "waiting": null,      "steps": [        {          "delay_days": 0,          "versions": [            {              "subject": "Office chairs for {{company}}",              "body": "Hi {{first_name|there}},\n\nI saw that {{company}} imports office seating. We make mesh task chairs in Leeds and ship to the US in four weeks.\n\nWould a price list be useful?\n\n{{sender_first_name}}",              "weight": 1,              "stats": {                "sent": 0,                "opened": 0,                "clicked": 0,                "replied": 0              }            }          ]        },        {          "delay_days": 3,          "versions": [            {              "subject": null,              "body": "Hi {{first_name|there}},\n\nJust checking that my note reached the right person. Who looks after seating suppliers at {{company}}?\n\n{{sender_first_name}}",              "weight": 1,              "stats": {                "sent": 0,                "opened": 0,                "clicked": 0,                "replied": 0              }            }          ]        }      ],      "schedule": {        "timezone": "America/New_York",        "days": [          "mon",          "tue",          "wed",          "thu",          "fri"        ],        "start_hour": 9,        "end_hour": 17      },      "daily_limit": 30,      "stop_on_company_reply": true,      "track_opens": false,      "track_clicks": false,      "metadata": {        "customer_id": "c_812"      },      "stats": {        "recipients": 2,        "waiting": 2,        "in_sequence": 0,        "finished": 0,        "replied": 0,        "bounced": 0,        "unsubscribed": 0,        "excluded": 0,        "emails_sent": 0,        "emails_opened": 0,        "emails_clicked": 0      },      "test": false,      "created_at": "2026-11-18T14:03:10.000Z",      "started_at": null,      "completed_at": null    },    "recipients": {      "accepted": 2,      "duplicates": 0,      "rejected": 0,      "results": [        {          "email": "info@coastal-office.example",          "status": "accepted",          "recipient_id": "rcp_5r4k2m9x7p1q8w3e",          "reason": null,          "message": null,          "warnings": [            "shared_mailbox"          ]        }      ]    },    "content": {      "problems": [],      "advice": [],      "variables": [        {          "name": "company",          "required": true        },        {          "name": "first_name",          "required": false        }      ]    },    "preview": [],    "estimate": {      "emails": 4,      "per_day": 30,      "days": 4,      "domains_for_a_week": 1    }  },  "notice": null,  "usage": {    "cost": 0,    "balance": 48.08,    "replayed": false  }}

Última atualização em