esendblueGuide

Integrate

Working code for this account — your API address, a domain you have verified, and a real template id are already filled in.

What is filled in below

API address
https://api.esendblue.comEvery call goes here.
Sending domain
yourdomain.comA placeholder: no domain is verified yet, so every send would answer 403.
Template
none yetCreate a template and its real id appears in step 2 below.
1

Send an email

One call. The id that comes back is how you look the message up later — and the Idempotency-Key is what stops a timeout becoming a second email.

cURL
curl https://api.esendblue.com/v1/emails \
  -H "Authorization: Bearer $ESENDBLUE_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: welcome-user-42" \
  -d '{
    "from": "Your Company <hello@yourdomain.com>",
    "to": "customer@example.com",
    "subject": "Your receipt",
    "html": "<p>Thanks for your order.</p>",
    "text": "Thanks for your order."
  }'
2

Send a template

Keep the wording out of your deployment: your code sends an id and the values, and anyone can fix a typo without a release.

No templates yet. Start from a design and this step fills itself in.

3

Verify a webhook

This is the one piece of the integration that is worth getting exactly right. The URL is public, so anyone who guesses it could otherwise tell you an address bounced. Check the signature against the raw body — parsing and re-serialising changes the bytes.

cURL
# Signatures cannot be checked from a shell in any useful way.
# Pick your language above — this is the one piece of integration
# that is worth getting exactly right.
4

Handle the answers you will actually get

Three of these are worth branching on: the domain is not verified, the plan is out, and the server had a problem. Everything else is a bug in the request.

cURL
# The body of a failed call names what went wrong:
# {"error":"domain_not_verified","detail":"yourdomain.com"}
5

Or send over SMTP, and change nothing else

If the application already speaks SMTP — a framework mailer, a CMS plugin — point it here. Same pipeline: verified domains, quota, suppression, DKIM and tracking.

settings
Host        see Settings → SMTP
Port        587
Encryption  STARTTLS
Username    apikey        (the value is ignored)
Password    an API key with emails:send

Every field the send endpoint accepts, and why each feature exists, is in the guide. Keys are created under API keys — give each integration its own, scoped to what it actually needs.