Free
For getting started.
No card needed.
5,000 emails to start
Start free- Then 500 emails every month
- 3 brands · 2 seats
- 1 custom sending domain
- Starter emails never expire
Give the agent its own inbox, hear every reply as a signed webhook, answer in the same thread, and hand off what it should not decide. Node and Python, tested against the live API.
An autonomous email agent is a program that sends email, receives the replies, reads the conversation and answers it without a person in the loop, and hands off what it should not decide alone. This guide builds one on Nitrosend, end to end: an inbox the agent owns, a signed webhook that delivers each reply with its text, a handler that answers in the same thread, and the guardrails that stop it looping or sending twice.
Every code block on this page was run against the live Nitrosend API on November 26, 2026, and the responses quoted below are the ones it returned. The endpoints come from the Nitrosend documentation and the OpenAPI spec. If you want the product view first, email for agents covers what an agent inbox is and what it costs.
Sending is the easy half. Any transactional email API will take a POST and deliver a message. An agent that runs on its own also has to hear back, know which conversation a reply belongs to, answer without breaking the thread, and survive the retries and duplicates every webhook system produces. Those are the parts most send-only setups leave you to build.
| Job | Nitrosend | Detail that matters |
|---|---|---|
| Own an address | POST /v1/my/inboxes | A nitrosend.net address needs no DNS. Creation never starts a purchase. |
| Send the first email | POST /v1/my/messages | Send from the inbox address, so replies come back to it. An idempotency key is required. |
| Hear the reply | email.received webhook | Signed. Carries text, html, attachments, auto_submitted and conversation_id. |
| Answer in the thread | POST /v1/my/conversations/{id}/reply | Nitrosend picks the inbox sender and keeps the thread headers. |
| Know when to stop | request_human, unless_inbound_since | Hand a thread to a person, or cancel a follow-up the customer already answered. |
I would build the loop in that order and test each step before the next, because a bug in the webhook handler is much cheaper to find before the agent is sending real replies.
Start by reading your capacity. The response lists the domains an inbox can live on, including your nitrosend.net address, which receives mail without any DNS change. A domain you verified yourself appears too, and needs an MX record before it can receive.
curl https://api.nitrosend.com/v1/my/inboxes/capacity \
-H "Authorization: Bearer $NITROSEND_API_KEY"
The fields you need, trimmed from the test account's response after its inboxes were made. remaining is how many more you can create without buying capacity, and the hosted domain's id is what the next call takes:
{"inboxes": {"used": 3, "included": 3, "remaining": 0, "over_limit": false},
"available_domains": [{"id": 13847, "receiving_method": "mx", "hosted": true}]}
Then create the inbox on that domain. Use one inbox per agent, so each agent has an identity people can recognise and a thread history of its own.
curl -X POST https://api.nitrosend.com/v1/my/inboxes \
-H "Authorization: Bearer $NITROSEND_API_KEY" \
-H "Idempotency-Key: create-agent-inbox" \
-H "Content-Type: application/json" \
-d "{\"inbox\": {\"domain_id\": $DOMAIN_ID, \"local_part\": \"agent\", \"display_name\": \"Support agent\"}}"
The call returned 201 with the new inbox, its id and "reply_available": true. Keep the id, the handler needs it. Run again for the same address, it returned the existing inbox and created nothing. When included capacity is used up, the call does not buy more. Extra inboxes cost US$1 a month and are approved in Billing. Free includes one inbox, and every paid plan includes three, as the pricing page sets out.
Register your endpoint for email.received. The URL must be public HTTPS. The response carries the signing secret, starting whsec_, in full this once, so store it with your other secrets.
curl -X POST https://api.nitrosend.com/v1/my/webhooks \
-H "Authorization: Bearer $NITROSEND_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"url\": \"$WEBHOOK_URL\", \"events\": [\"email.received\"]}"
Before you rely on it, send yourself a test event with POST /v1/my/webhooks/{id}/test. In the test run it came back 202, and the signed delivery reached the handler with the headers webhook-id, webhook-timestamp, webhook-signature and User-Agent: Nitrosend-Webhooks/1.0. The handler returned 200 to it and 400 to an unsigned request. Testing a webhook covers more ways to do this locally.
Replies reach Nitrosend when they are sent to an inbox address, so the first email goes out from the inbox itself. Use POST /v1/my/messages, the same call as any receipt or notification, with an idempotency key that names the thing you are sending about. Tags ride along on every later event for that send.
curl -X POST https://api.nitrosend.com/v1/my/messages \
-H "Authorization: Bearer $NITROSEND_API_KEY" \
-H "Idempotency-Key: order-1042-shipped" \
-H "Content-Type: application/json" \
-d "{
\"channel\": \"email\",
\"from\": \"Support agent <$AGENT_INBOX>\",
\"to\": \"$CUSTOMER_EMAIL\",
\"subject\": \"Your order 1042 has shipped\",
\"body\": \"It left the warehouse today. Reply to this email if anything looks wrong.\",
\"tags\": { \"order\": \"1042\" }
}"
Trimmed response:
{"id": 6378985, "channel": "email", "subject": "Your order 1042 has shipped", "status": "queued", "ignored_fields": []}
queued means accepted, not delivered. A lookup by key a few seconds later read sent with thread_id m6378985. If the answer to a send is ever lost, GET /v1/my/messages/lookup?idempotency_key=order-1042-shipped settles it without sending again.
This is the whole agent in one Node file, using Express and the verifyWebhook helper from @nitrosend/sdk. Install both with npm install express @nitrosend/sdk and set four environment variables: your API key, the webhook secret, the inbox address and the inbox id.
// agent.mjs: an autonomous email agent on Nitrosend.
// Receives signed email.received webhooks, reads the thread, replies in it.
import express from 'express';
import { verifyWebhook, WebhookVerificationError } from '@nitrosend/sdk';
const API = 'https://api.nitrosend.com/v1/my';
const KEY = process.env.NITROSEND_API_KEY; // nskey_live_...
const SECRET = process.env.NITROSEND_WEBHOOK_SECRET; // whsec_...
const AGENT_INBOX = process.env.AGENT_INBOX.toLowerCase(); // the agent's own address
const AGENT_INBOX_ID = process.env.AGENT_INBOX_ID; // its id from POST /v1/my/inboxes
const seen = new Set(); // use Redis or your database in production
async function nitro(path, { method = 'GET', body, key } = {}) {
const res = await fetch(`${API}${path}`, {
method,
headers: {
Authorization: `Bearer ${KEY}`,
'Content-Type': 'application/json',
...(key ? { 'Idempotency-Key': key } : {}),
},
body: body ? JSON.stringify(body) : undefined,
});
if (!res.ok) throw new Error(`${method} ${path} ${res.status}: ${await res.text()}`);
return res.json();
}
// Swap this for your model call. It gets the thread and returns a reply, or null to hand off.
async function decide(thread, event) {
const text = (event.data.text || '').toLowerCase();
if (text.includes('refund') || text.includes('cancel')) return null; // a person decides these
return `Thanks for your note. I have your message about "${event.data.subject}" and I'm on it.`;
}
// Move the thread to Needs you, so a person answers it in the Inbox.
async function handOff(conversationId) {
const items = await nitro(`/inbox_action_items?inbox_id=${AGENT_INBOX_ID}&state=agent_ready`);
const item = items.find((i) => i.conversation?.id === conversationId);
if (!item) return;
await nitro(`/inbox_action_items/${item.id}/act`, {
method: 'POST',
key: `handoff-${item.id}`,
body: { verb: 'request_human' },
});
console.log('handed off', conversationId, 'item', item.id);
}
async function handle(webhookId, event) {
if (event.type !== 'email.received') return;
const d = event.data;
if (d.auto_submitted) return; // out-of-office, auto-replies
if (!String(d.to).toLowerCase().includes(AGENT_INBOX)) return; // mail for another inbox
if (String(d.from).toLowerCase().includes(AGENT_INBOX)) return; // never answer yourself
const thread = await nitro(`/conversations/${d.conversation_id}`);
const answer = await decide(thread, event);
if (!answer) return handOff(d.conversation_id);
const sent = await nitro(`/conversations/${d.conversation_id}/reply`, {
method: 'POST',
key: `reply-${webhookId}`, // a retried webhook can never send a second reply
body: { reply: { body: answer } },
});
console.log('replied', d.conversation_id, JSON.stringify(sent).slice(0, 200));
}
const app = express();
// Raw body first: the signature covers the exact bytes Nitrosend sent.
app.post('/webhooks/nitrosend', express.raw({ type: 'application/json' }), async (req, res) => {
let event;
try {
event = await verifyWebhook(req.body.toString('utf8'), req.headers, SECRET);
} catch (err) {
if (err instanceof WebhookVerificationError) return res.sendStatus(400);
throw err;
}
const webhookId = req.headers['webhook-id'];
res.sendStatus(200); // acknowledge inside 10 seconds, then do the work
if (seen.has(webhookId)) return; // retries carry the same webhook-id
seen.add(webhookId);
handle(webhookId, event).catch((err) => console.error('handle failed', err));
});
app.listen(process.env.PORT || 3000, '127.0.0.1');
What each part is doing, in the order a reply hits it:
400.2xx. Model calls take longer than that, so the handler answers 200 and does the work after.webhook-id, so the handler records the ids it has seen. Keep them in your database in production, not in memory.GET /v1/my/conversations/{id} returns the thread. decide() is where your model call goes. The reply goes to POST /v1/my/conversations/{id}/reply, and Nitrosend picks the inbox as sender and sets the thread headers.decide() returns nothing, the handler moves the thread to Needs you with request_human, so a person picks it up in the Inbox.The reply call returned {"id": 6378988, "subject": "Re: Your order 1042 has shipped", "status": "queued"} in the test run, and the reply arrived back in the customer's inbox in the same conversation.
Any Standard Webhooks library will verify a Nitrosend request. If your agent runs in Python, the check is short enough to own. This function, from the webhooks reference, returned True on all eight real deliveries captured in the test run and False on each one with a single byte appended.
import base64, hashlib, hmac, time
def verify(body: bytes, headers, secret: str) -> bool:
try:
msg_id = headers["webhook-id"]
timestamp = int(headers["webhook-timestamp"])
signatures = headers["webhook-signature"].split(" ")
except (KeyError, ValueError):
return False
if abs(time.time() - timestamp) > 300:
return False
key = base64.b64decode(secret.removeprefix("whsec_"))
signed = f"{msg_id}.{timestamp}.".encode() + body
expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
return any(
hmac.compare_digest(sig.split(",", 1)[1], expected)
for sig in signatures
if sig.startswith("v1,")
)
Pass it the raw request bytes, never a re-serialised JSON object. Re-encoding changes key order and whitespace, and the signature stops matching. How to secure webhooks goes through the replay and timing attacks the timestamp check is there for.
An agent that can send on its own can also send the wrong thing on its own, many times. George Hartley, our co-founder, puts the rule plainly: never pair a growth goal with unattended send access, and treat any limit as a stop. In the tests he points to, agents given a growth target, a deadline and an inbox emailed scraped addresses, and when they hit sending limits they moved to a second sender. Four guards in the code above keep a support agent on the right side of that line.
email.received. The handler ignored it, because it was not addressed to the agent. Without that check, two inboxes on one brand will answer each other until something runs out.reply- plus the webhook-id. Replaying a captured delivery into a freshly restarted handler returned the original reply, id 6378988, and sent nothing new. Inboxes and conversations take an Idempotency-Key on every mutating call for this reason.auto_submitted is true for out-of-office notices and other automatic replies. Answer one and the other side's robot answers you back.unless_inbound_since refuses the send if the recipient has written to the brand since that time, and checks again at the moment it goes out.curl -X POST https://api.nitrosend.com/v1/my/messages \
-H "Authorization: Bearer $NITROSEND_API_KEY" \
-H "Idempotency-Key: order-1042-followup" \
-H "Content-Type: application/json" \
-d "{
\"channel\": \"email\",
\"from\": \"Support agent <$AGENT_INBOX>\",
\"to\": \"$CUSTOMER_EMAIL\",
\"subject\": \"Did order 1042 arrive?\",
\"body\": \"Checking in on your delivery. Reply here if anything is missing.\",
\"unless_inbound_since\": \"$FIRST_SENT_AT\"
}"
Run after the test customer had replied, it returned 422 and sent nothing:
{"code": 422, "message": "... has written to this brand since 2026-11-26T04:04:52Z, so this message was not sent", "error": true}
One thing the guards do not cover: Safe Mode, the account setting that holds an agent's campaigns for a person to approve, does not hold transactional messages or inbox replies. For an inbox agent, the code is the control, so test the hand-off path as carefully as the reply path. In the test run a message asking for a refund produced no reply and moved its thread to Needs you.
Your endpoint will be down at some point. Nitrosend retries a failed event after 1 minute, 5 minutes, 30 minutes, 2 hours, 8 hours and 24 hours, and a retried event can arrive after newer ones. For anything longer, read the same events by cursor:
# First call: no cursor. from=start reads from the beginning.
curl "https://api.nitrosend.com/v1/my/webhooks/events?events=email.received&from=start&limit=50" \
-H "Authorization: Bearer $NITROSEND_API_KEY"
# Then pass each response's cursor back as after=, while more is true.
Each event carries the id its webhook delivery used as webhook-id, so a handler that takes both sees each one once. In the test run, the read from the start returned the three email.received events the webhook had already delivered, with matching ids.
We learned the value of this the hard way, on the receiving side of someone else's webhooks. During large sends in October, our own feedback endpoint for Amazon SES dropped delivery and bounce events. A per-IP rate limit returned 429, a signature verifier downloaded its certificate on every request until the web server saturated, and the sender's retries gave up after about a minute. The fix shipped on 12 October: exempt the hook from the throttle, cache the verifier, and return a retryable 503 when verification cannot run. Build your agent's receiver with the same three habits, and keep the cursor read as the backstop.
Email threads are held together by the In-Reply-To and References headers. Get them wrong and Gmail or Outlook shows your agent's answer as a new email, and the customer loses the context. The conversation reply call sets them for you. If you need a threaded message from POST /v1/my/messages instead, read the original send's rfc_message_id from GET /v1/my/messages/{id} and pass it in those two headers yourself.
When I qualified Outreach replies in production on 12 November, a follow-up sent over SMTP arrived after 182 seconds carrying the expected In-Reply-To, and every HTML body that landed in the receiving inbox matched its preview. That is the check worth copying: send a reply to an inbox you own and read the headers back with GET /v1/my/conversations/{id}/messages/{message_id}/source, before a customer ever sees one.
Everything above is for an agent you write and host. If the agent is Claude, ChatGPT, Cursor or Codex, it can run the same loop through the Nitrosend MCP server with two tools, nitro_inbox and nitro_inbox_action. It polls instead of receiving webhooks: list_queue with state: "agent_ready", reads the thread, checks its draft with validate_reply, then answers with send_reply or hands off with request_human. In Claude Code the connection is one line:
claude mcp add --transport http nitrosend https://api.nitrosend.com/mcp
Then a prompt like this one:
Connect to Nitrosend. Work the agent inbox queue in state agent_ready.
For each item, read the thread, draft a reply, check it with validate_reply,
and send it. Anything about refunds, cancellations or billing: request_human,
do not reply. Show me a one-line summary of each item when you finish.
Sending email from Claude covers the setup in more detail, and the email MCP explainer explains how this kind of server differs from one that reads your personal mailbox.
Two other patterns come up when people build this. The first is an inbox-only API such as AgentMail, which gives agents mailboxes but leaves your receipts, newsletters and brand sending to another service. Nitrosend vs AgentMail covers that choice. The second is a sending API with inbound added on. On Resend, the email.received webhook carries metadata, and the body is fetched with a second call. On Nitrosend the event carries the text and HTML, so the handler above reads the thread once and answers. The Resend migration guide maps the webhook fields if you are moving a handler across.
The reason to keep sending and receiving on one platform is the thread. The agent's first email, the customer's reply, the agent's answer and any hand-off sit in one conversation with one set of ids, and the same account sends your marketing email in your brand. The best email APIs for AI agents ranks seven options on exactly these jobs.
An autonomous email agent is a program that sends email, receives the replies, reads the conversation and answers it without a person in the loop, and hands off the messages it should not decide alone. It needs four things from its email platform: an address that can receive mail, a push of each new message with its text, a reply call that keeps the thread, and guardrails against loops and duplicate sends.
On Nitrosend the agent gets its own inbox address, and every message that reaches it is posted to your HTTPS endpoint as a signed email.received webhook. The event carries the sender, subject, text and HTML (each up to 64 KiB), the attachments with their scan status, an auto_submitted flag for automatic replies, and the conversation_id the agent replies on. Quarantined mail is never sent to the webhook.
Nitrosend signs webhooks in the Standard Webhooks format. Build the string webhook-id.webhook-timestamp.raw-body, compute an HMAC-SHA256 with the base64-decoded part of your whsec_ secret, base64-encode it and compare it in constant time with each v1, value in the webhook-signature header. Reject requests more than 5 minutes old. In Node, verifyWebhook from @nitrosend/sdk does all of this.
Answer only mail addressed to the agent's own inbox, never mail sent from it, skip events where auto_submitted is true, record each webhook-id you have handled, and send every reply with an idempotency key built from the webhook-id. A retried or duplicated webhook then returns the original reply instead of sending a second one.
Yes. Leave the message unanswered and call POST /v1/my/inbox_action_items/{id}/act with the verb request_human. The thread moves to Needs you in the Nitrosend Inbox, where a person answers it. Refunds, cancellations and anything with money or legal weight are the usual cases.
No. A Nitrosend-provided address on nitrosend.net needs no DNS and can receive mail as soon as the inbox exists. Your own domain is better for reaching the inbox at volume, and it needs an MX record for receiving. Free includes one inbox, and Starter, Pro, Growth and Scale include three.
Every plan includes full stack emailing: Flows, Newsletter Campaigns and Transactional Email, plus our NitroWheel LLM and all agent integrations (Claude, ChatGPT, Codex, Cursor and others). Pay for what you send, not who you store.
Every paid plan includes 3 agent inboxes and no Nitrosend footer.
For getting started.
No card needed.
5,000 emails to start
Start freeFor your first email program.
$192 billed yearly.
20,000 emails / month
Choose StarterFor a growing audience.
$480 billed yearly.
60,000 emails / month
Choose ProFor teams and agencies.
$1,440 billed yearly.
200,000 emails / month
Choose GrowthFor high-volume sending.
$2,880 billed yearly.
500,000 emails / month
Choose ScaleSending 500,000+ emails a month? Get a custom plan designed for you, with volume email pricing and capacity that fits your business.
Daily allowances depend on your plan and sender standing. Strong list, domain and delivery evidence can raise standing, including on day one. Trusted receives the full plan allowance; available email credits, safety checks and delivery pacing still apply.
Free forever. No credit card required. See full comparison →