Start here
Quick start
From an empty account to a sent email and a verified webhook, in about fifteen minutes.
You will need a Cirrus account, a domain you control (so you can add DNS records), and a terminal. The samples switch between curl and the four libraries; your choice is remembered for the rest of the site.
Create an API key
- Sign in to the dashboard and open Developer, then API keys.
- Choose Create key. Give it a name that says where it will be used, such as
Online shop. - Set Mode to Test while you build. A test key accepts your emails and pretends to deliver them, so nothing reaches a real inbox and nothing counts against your allowance.
- Tick the scopes this walk-through uses:
email:send,email:read,domain:write,domain:readandwebhook:manage. A real app should hold only what it needs. - Copy the key when it is shown. It begins
cirrus_test_and is shown once; if you lose it, create a new one.
# Nothing to install: curl talks to the API directly.
export CIRRUS_API_KEY="cirrus_test_..."Keep the key out of your code and out of version control: put it in an environment variable, as above.
export CIRRUS_API_KEY="cirrus_test_..." # the key you copied in step 1The samples that follow carry on from this one: cirrus, client and c are the client you just made.
Add and verify your domain
Email can only be sent from an address at a domain you have proven you own, even with a test key. Register the domain; the answer lists the DNS records to publish.
curl -X POST https://api.cirrusmail.example/v1/domains \
-H "Authorization: Bearer $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "shop.example"}'Add every record to your DNS provider exactly as listed. There are seven: one that proves ownership (ownership), three DKIM records, two for the return path (spf and mx), and one dmarc record. The Domains and DNS guide explains each.
Cirrus checks a new domain by itself about every five minutes for the first 72 hours. Ask for its status until it says verified; DNS changes can take a while to spread, sometimes hours.
curl https://api.cirrusmail.example/v1/domains/$DOMAIN_ID \
-H "Authorization: Bearer $CIRRUS_API_KEY"Send your first email
Send from any address at the verified domain. to can be one address or a list; give text, html or both. The Idempotency-Key makes it safe to repeat the request if you never see the answer (see Idempotency and retries).
curl -X POST https://api.cirrusmail.example/v1/emails \
-H "Authorization: Bearer $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-42" \
-d '{
"from": "Shop <orders@shop.example>",
"to": "ann@example.org",
"subject": "Your order is on its way",
"text": "Thanks for your order. It will arrive on Friday."
}'The answer is 202 Accepted. That means your email is queued and certain to be attempted, not that it has been delivered.
{
"data": {
"id": "b3c1f5a4-7d2e-4c8a-9a1b-0e6f2d4a8c11",
"status": "queued",
"stream": "transactional",
"test_mode": true
}
}test_mode is true because the key is a test key. Keep the id: it is how you look the email up.
Check the result
Ask for the email by its ID. Each recipient has its own status; the email's status is theirs, or mixed when they differ. The first answer is usually queued or sent; ask again a moment later.
curl https://api.cirrusmail.example/v1/emails/$EMAIL_ID \
-H "Authorization: Bearer $CIRRUS_API_KEY"{
"data": {
"id": "b3c1f5a4-7d2e-4c8a-9a1b-0e6f2d4a8c11",
"status": "delivered",
"stream": "transactional",
"from": "Shop <orders@shop.example>",
"subject": "Your order is on its way",
"to": "ann@example.org",
"recipient_count": 1,
"test_mode": true,
"submitted_at": "2026-01-15T09:30:00Z",
"recipients": [
{
"email": "ann@example.org",
"type": "to",
"status": "delivered",
"accepted_at": "2026-01-15T09:30:02Z",
"delivered_at": "2026-01-15T09:30:04Z",
"hard_bounced_at": null,
"soft_bounced_at": null,
"complained_at": null,
"cancelled_at": null,
"failed_at": null
}
]
}
}The body of the email is never returned. See Sending email for every status and what it means.
Receive a webhook
Rather than asking for each email, let Cirrus call you. Register an https address that answers on the public internet. Use a tunnel such as the one your hosting provider or a tool of your choice offers while you build locally.
curl -X POST https://api.cirrusmail.example/v1/webhooks \
-H "Authorization: Bearer $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://shop.example/hooks/cirrus",
"description": "Order emails",
"event_types": ["email.delivered", "email.bounced"]
}'The answer carries signing_secret, beginning whsec_. It is shown once. Store it as CIRRUS_WEBHOOK_SECRET; it is how you know a call really came from Cirrus.
Cirrus now sends a POST to your address for each email.delivered and email.bounced event, with the signature in the Webhook-Signature header. This receiver checks it before it trusts anything:
import express from "express";
import { verifyWebhook, WebhookVerificationError } from "@cirrus-mail/cirrus";
const app = express();
// The signature covers the exact bytes that were sent, so read the body raw.
app.post("/hooks/cirrus", express.raw({ type: "application/json" }), (req, res) => {
try {
verifyWebhook({
secret: process.env.CIRRUS_WEBHOOK_SECRET!,
timestamp: req.header("Webhook-Timestamp") ?? "",
signature: req.header("Webhook-Signature") ?? "",
body: req.body, // a Buffer
});
} catch (error) {
if (error instanceof WebhookVerificationError) return res.sendStatus(400);
throw error;
}
const event = JSON.parse(req.body.toString("utf8"));
console.log(event.type, event.data.email_id, event.data.recipient);
res.sendStatus(200);
});
app.listen(3000);A delivery looks like this:
{
"id": "0194c2d4-8a3e-7c11-b6a2-5d9f0e4a7b21",
"type": "email.delivered",
"created_at": "2026-01-15T09:30:04Z",
"data": {
"event_id": "0194c2d4-6f10-7a52-9e3b-2c8d1f0a4b67",
"email_id": "b3c1f5a4-7d2e-4c8a-9a1b-0e6f2d4a8c11",
"recipient": "ann@example.org",
"stream": "transactional",
"status": "delivered",
"occurred_at": "2026-01-15T09:30:04Z",
"test_mode": true
}
}Answer with any 2xx status within a few seconds. Anything else is tried again, up to eight times over about a day. Read Webhooks and signatures before you go live.
Before you go live#
- Create a live key (
cirrus_live_) with only the scopes your app needs, and keep it on the server. - Handle errors and the
429answer: see Errors and Rate limits. - Skim Bounces, complaints and suppression: addresses that bounce or complain are blocked for you.
| If you want to | Read |
|---|---|
| Send newsletters or offers | Marketing and promotional email |
| See every field and answer | API reference |
| Use a library in your language | Client libraries |