Quick Start
Send your first email in 3 steps, or let Claude set it up for you.
1. Create an API key
In Settings → API Keys, create a Test key while you build (it never delivers) and put it in your environment as HATCHED_SEND_API_KEY.
2. Install the SDK
npm install @hatched-digital/send3. Send an email
import { HatchedSend } from "@hatched-digital/send";
const send = new HatchedSend(); // reads HATCHED_SEND_API_KEY
const { id } = await send.emails.send({
from: "hello@yourdomain.com",
to: "user@example.com",
subject: "Welcome, {{name}}!",
html: "<h1>Welcome, {{name}}!</h1><p>Your account is ready.</p>",
variables: { name: "Alex" },
});Or with curl:
curl -X POST https://send.hatched.digital/api/v1/email \
-H "Authorization: Bearer $HATCHED_SEND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "hello@yourdomain.com",
"to": "user@example.com",
"subject": "Hello from Hatched Send!",
"html": "<h1>Welcome, {{name}}!</h1><p>Your account is ready.</p>",
"variables": { "name": "Alex" }
}'Response: with a test key you also get "test": true and nothing is delivered.
{
"id": "0193a1b2-...",
"status": "queued"
}When you're ready to go live: add your domain (Settings → Domains, or the Domains API), then swap in a live key.
Set up with Claude
Connect Claude, connect your project, done. Add the Hatched Send connector in Claude (Settings → Connectors → Add custom connector) with this URL, sign in, and allow Developer setup:
https://send.hatched.digital/mcpThen, in Claude Code or any Claude chat with your project open:
Connect this project to Hatched Send: create a test key, put it in .env,
install the SDK and send me a test welcome email. Then add yourapp.com as a
sending domain and register a webhook for bounces at /api/webhooks/hatched-send.Claude uses the connector's developer tools (create_api_key, add_sending_domain, verify_sending_domain, register_webhook) and writes keys and secrets into your environment file instead of the chat. More on the connector: Hatched Send for Claude.
Keys & Test Mode
All API requests require a valid API key sent in the Authorization header.
Authorization: Bearer sk_live_your_api_key_hereSecurity: Keep your API key secret. Never expose it in client-side code, public repositories, or browser requests. Use environment variables on your server.
Test keys
Keys starting sk_test_ work on the email endpoints exactly like live keys: same validation, suppression checks and rendering, and the message is logged with status test. Nothing is delivered and nothing counts towards your plan. Responses include "test": true. Use them in CI and local development.
Permissions
New keys can send and read messages. Tick Manage Domains or Manage Webhooks when you create a key to use the Domains and Webhooks APIs.
Send Email
/api/v1/emailSend a single transactional email. Supports HTML, plain text, templates, and merge variables.
| Parameter | Type | Required | Description |
|---|---|---|---|
| from | string | Yes | Sender email address (must be a verified domain) |
| to | string | string[] | Yes | Recipient email, or a list of up to 50: a list sends a separate email to each address |
| cc | string | string[] | No | Visible copies on the same message, up to 20. Needs a single to address |
| bcc | string | string[] | No | Hidden copies on the same message, up to 20. Needs a single to address |
| from_name | string | No | Display name, e.g. "Acme via YourApp" |
| subject | string | Yes | Email subject line |
| html | string | No | HTML body content |
| text | string | No | Plain text fallback |
| template_id | string | No | Use a saved template by UUID |
| variables | object | No | Merge variables for {{variable}} substitution |
| reply_to | string | No | Reply-to email address |
| tags | string[] | No | Tags for filtering in analytics (max 10) |
| track_opens | boolean | No | Track email opens (default: true) |
| track_clicks | boolean | No | false sends links untouched (no click tracking). Leave out for the account default. |
| category | string | No | "transactional" (default) or "marketing" (adds unsubscribe footer and List-Unsubscribe) |
| sender_ref | string | No | Your id for the business this email is for (platforms). See Sending for Businesses |
| attachments | object[] | No | Up to 5 files: { filename, content (base64), content_type }, 10 MB each |
| show_powered_by | boolean | No | Include the Powered by Hatched Send badge. Transactional emails never include it unless you set true. For marketing emails, omit to use the Email footer setting; Growth and Scale can set false, Free and Starter always include it. |
Example: Simple email
curl -X POST https://send.hatched.digital/api/v1/email \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"from": "noreply@yourdomain.com",
"to": "user@example.com",
"subject": "Your password reset code",
"html": "<p>Your code is: <strong>{{code}}</strong></p>",
"variables": { "code": "483921" },
"tags": ["password-reset"]
}'Example: Using a template
curl -X POST https://send.hatched.digital/api/v1/email \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"from": "orders@yourdomain.com",
"to": "customer@example.com",
"subject": "Order #{{order_id}} confirmed",
"template_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"variables": {
"name": "Sarah",
"order_id": "SK-1234",
"total": "$49.99"
}
}'CC & BCC
Copies ride in the same message as the to address, so they need a single to (a to list sends one email per address). Each copy is checked against your suppression list and counts as a recipient.
await send.emails.send({
from: "bookings@yourapp.com",
to: "customer@example.com",
cc: "manager@business.com",
bcc: ["records@yourapp.com"],
reply_to: "manager@business.com",
subject: "Your booking is confirmed",
html: "<p>See you Tuesday.</p>",
});
// Suppressed copies are left off and listed: { id, status, suppressed_copies: [...] }Safe Retries
Send an Idempotency-Key header to make retries safe. A repeat with the same key and body within 24 hours returns the first response (with Idempotent-Replayed: true) and sends nothing. The same key with a different body returns 422; while the first request is still running, 409.
await send.emails.send(params, { idempotencyKey: `welcome-${user.id}` });Suppressed Recipients
Addresses that hard-bounced, complained or unsubscribed are never mailed. With one to address the request fails with suppressed. With several, every address gets its own result, in request order:
{
"results": [
{ "id": "0193a1b2-...", "to": "a@example.com", "status": "queued" },
{ "id": "", "to": "b@example.com", "status": "failed: recipient suppressed (unsubscribed/bounced)", "reason": "suppressed" }
]
}Batch Send
/api/v1/email/batchSend up to 100 emails in a single API call. Each message can have different recipients, subjects, and variables. Per message pass track_opens (default true), and cc/bcc as for a single send. The response lists every recipient with its own status.
curl -X POST https://send.hatched.digital/api/v1/email/batch \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"from": "noreply@yourdomain.com",
"to": "alice@example.com",
"subject": "Welcome, Alice!",
"html": "<h1>Welcome, {{name}}!</h1>",
"variables": { "name": "Alice" }
},
{
"from": "noreply@yourdomain.com",
"to": "bob@example.com",
"subject": "Welcome, Bob!",
"html": "<h1>Welcome, {{name}}!</h1>",
"variables": { "name": "Bob" }
}
]
}'Delivery Status
/api/v1/email/{id}/statusThe message's current status (queued, sent, delivered, opened, clicked, bounced, complained, or test) and every event. Use it to reconcile when a webhook was missed.
const status = await send.emails.status(id);Sending for Businesses
If your app sends on behalf of many businesses (bookings, quotes, invoices), pass your id for the business as sender_ref, its name in from_name and its address in reply_to. Each sender_ref has its own bounce and complaint counters, so one business with a bad list is paused on its own (403 sender_paused and a sender.paused webhook) while the rest keep sending.
await send.emails.send({
from: "bookings@yourplatform.com",
from_name: "Joe's Plumbing via YourPlatform",
reply_to: "joe@joesplumbing.com",
sender_ref: business.id,
to: customer.email,
subject: "Your quote",
html,
});
const paused = await send.senders.list({ paused: true }); // GET /api/v1/senders?paused=true
await send.senders.resume(business.id); // POST /api/v1/senders/resumeContacts API
/api/v1/audiences/api/v1/contacts/api/v1/contacts?email=/api/v1/contacts/unsubscribeAdd signups from your own site to an audience. consent must be true. Safe to retry: an existing subscriber is updated, never duplicated. A "New subscriber" automation on that audience (like a welcome email) starts when someone newly joins or rejoins. Needs a key with Write Contacts (Read Contacts for lookups). Keep the key on your server. 120 requests a minute per key.
const [news] = await send.audiences.list();
const r = await send.contacts.upsert({
email: "jane@example.com",
audience_id: news.id,
consent: true,
first_name: "Jane",
tags: ["website"],
});
// r.result: "created" | "resubscribed" | "updated", r.automations_started
await send.contacts.get("jane@example.com");
await send.contacts.unsubscribe("jane@example.com"); // all audiences + suppressionDomains API
/api/v1/domains/api/v1/domains/api/v1/domains/{domain}/api/v1/domains/{domain}/verifyAdd a sending domain and get the DNS records to publish, then verify it. Records come with the value to type in your DNS provider's Host field (host) and an action: ok when already in place. Needs a key with Manage Domains.
const domain = await send.domains.create("yourapp.com");
for (const r of domain.records.filter((r) => r.action !== "ok")) {
console.log(r.type, r.host, r.value);
}
const checked = await send.domains.verify("yourapp.com"); // status: "verified" | "pending"Templates
Create email templates using the Hatched Send MCP tools in Cursor or VS Code, then reference them in API calls with template_id.
Templates support {{variable}} merge variables that get replaced at send time.
Tip: Design your transactional templates in the Hatched Send builder, then use them via API. Your brand colors, logo, and fonts are applied automatically.
Merge Variables
Use double curly braces to insert dynamic content:
<!-- In your HTML or template -->
<h1>Hello, {{name}}!</h1>
<p>Your order #{{order_id}} has shipped.</p>
<p>Track at: {{tracking_url}}</p>
<!-- API call -->
{
"variables": {
"name": "Sarah",
"order_id": "1234",
"tracking_url": "https://track.example.com/1234"
}
}Webhooks
/api/v1/webhooks/api/v1/webhooks/api/v1/webhooks/{id}/api/v1/webhooks/{id}Register an HTTPS endpoint (or use Settings → Webhooks) to receive events as they happen. Leave events out for all of them. The signing secret is returned once. Needs a key with Manage Webhooks.
email.sentemail.deliveredemail.openedemail.clickedemail.bouncedemail.complainedemail.unsubscribedemail.inboundsender.pausedconst hook = await send.webhooks.create({
url: "https://yourapp.com/api/webhooks/hatched-send",
events: ["email.delivered", "email.bounced", "email.complained"],
});
// Store hook.secret as HATCHED_SEND_WEBHOOK_SECRET (shown once).Verifying deliveries
Each delivery carries X-HatchedSend-Signature-V1: t=<unix>,v1=<hex>, an HMAC-SHA256 of t + "." + raw body with your secret. The payload's id is unique per event, so you can drop duplicates.
import { verifyWebhook } from "@hatched-digital/send";
export async function POST(req: Request) {
const raw = await req.text();
const event = await verifyWebhook(
raw,
req.headers.get("x-hatchedsend-signature-v1"),
process.env.HATCHED_SEND_WEBHOOK_SECRET!,
);
// event.event === "email.bounced", event.data.to, event.data.sender_ref, ...
return new Response("ok");
}Rate Limits
| Plan | Emails/month | Rate |
|---|---|---|
| Trial (7 days) | 200 emails | 50/min |
| Starter | 5,000 | 50/min |
| Growth | 50,000 | 200/min |
| Scale | 200,000 | 500/min |
| Scale | 500,000 | 1,000/min |
Error Codes
| Status | Type | Description |
|---|---|---|
| 400 | validation_error | Invalid request body (check error.errors for details) |
| 401 | authentication_error | Missing or invalid API key |
| 403 | permission_error | API key lacks required permission |
| 403 | test_key_not_allowed | Test keys only work on the email endpoints |
| 403 | sender_paused | This sender_ref is paused after bounces or complaints |
| 403 | domain_unverified | Send from your own verified domain |
| 400 | suppressed | Every recipient is on the suppression list |
| 404 | not_found | Resource not found (e.g. template_id) |
| 409 | idempotency_conflict | The first request with this Idempotency-Key is still running |
| 422 | idempotency_mismatch | This Idempotency-Key was used with a different body |
| 429 | rate_limit_error | Too many requests: slow down |
| 500 | server_error | Internal server error: contact support |
Error response format:
{
"error": {
"type": "validation_error",
"message": ""to" must be a valid email address",
"errors": [...]
}
}SDKs & Examples
Node.js / TypeScript SDK
npm install @hatched-digital/send. No dependencies; runs in Node 18+, Bun, Deno and edge runtimes. Full API reference: openapi.json.
Node.js (fetch)
const response = await fetch("https://send.hatched.digital/api/v1/email", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.HATCHED_SEND_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "noreply@yourdomain.com",
to: "user@example.com",
subject: "Welcome!",
html: "<h1>Hello, {{name}}!</h1>",
variables: { name: "World" },
}),
});
const { id, status } = await response.json();
console.log(`Email ${id}: ${status}`);Python
import requests
import os
response = requests.post(
"https://send.hatched.digital/api/v1/email",
headers={
"Authorization": f"Bearer {os.environ['HATCHED_SEND_API_KEY']}",
"Content-Type": "application/json",
},
json={
"from": "noreply@yourdomain.com",
"to": "user@example.com",
"subject": "Welcome!",
"html": "<h1>Hello, {{name}}!</h1>",
"variables": {"name": "World"},
},
)
data = response.json()
print(f"Email {data['id']}: {data['status']}")PHP
$ch = curl_init("https://send.hatched.digital/api/v1/email");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . getenv("HATCHED_SEND_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"from" => "noreply@yourdomain.com",
"to" => "user@example.com",
"subject" => "Welcome!",
"html" => "<h1>Hello, {{name}}!</h1>",
"variables" => ["name" => "World"],
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch), true);
echo "Email {$response['id']}: {$response['status']}";Ruby
require "net/http"
require "json"
uri = URI("https://send.hatched.digital/api/v1/email")
req = Net::HTTP::Post.new(uri.path, {
"Authorization" => "Bearer #{ENV['HATCHED_SEND_API_KEY']}",
"Content-Type" => "application/json"
})
req.body = {
from: "noreply@yourdomain.com",
to: "user@example.com",
subject: "Welcome!",
html: "<h1>Hello, {{name}}!</h1>",
variables: { name: "World" }
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)
puts "Email #{data['id']}: #{data['status']}"Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
payload, _ := json.Marshal(map[string]interface{}{
"from": "noreply@yourdomain.com",
"to": "user@example.com",
"subject": "Welcome!",
"html": "<h1>Hello, {{name}}!</h1>",
"variables": map[string]string{"name": "World"},
})
req, _ := http.NewRequest("POST",
"https://send.hatched.digital/api/v1/email",
bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("HATCHED_SEND_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
var result map[string]string
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("Email %s: %s\n", result["id"], result["status"])
}Questions? Email hello@hatched.digital