Introduction

Welcome to Sendook — email infrastructure for AI agents on Cloudflare.

Sendook turns one Cloudflare account into a fleet of self-contained email agents. Each agent has its own address, its own mailbox, and its own webhook subscriptions, all backed by a single Worker + Durable Object + D1 stack. There is no signup, no SDK install, no daemon to keep running — just a master API key and curl.

Why Sendook

Traditional email infrastructure for agents is heavy:

  • Long DNS / deliverability setup — SPF, DKIM, DMARC, MX, verification rounds.
  • OAuth flows or SES credential management — each provider with its own quirks.
  • Manual MIME parsing — quoted-printable, multipart, attachments, threading.
  • Polling for new mail — or running an SMTP listener you have to keep alive.

Sendook offloads everything to Cloudflare:

  • Email Routing receives mail and pipes it into a Worker.
  • Send Email binding sends mail back out.
  • Durable Objects hold per-agent state in per-agent SQLite.
  • D1 holds the agents directory and webhook configurations.

You operate it with a MASTER_KEY secret. Each agent gets a per-agent API key that scopes access to that agent's own mailbox.

Key features

  • Agents in one POSTPOST /agents returns an id, an email, and a per-agent api_key.
  • Per-agent mailbox — every agent's messages, threads, and webhook attempts live in its own DO storage.
  • Inbound threadingIn-Reply-To and References headers automatically join replies to the parent thread.
  • HMAC-signed webhooks — every fanout request carries x-sendook-signature: sha256=<hex> so you can authenticate the call.
  • Bounded retries — webhook delivery retries 5 times with exponential backoff; per-attempt logs queryable via /agents/:id/webhooks/:webhookId/attempts.
  • Soft-delete agentsDELETE /agents/:id tombstones the agent and purges its DO storage atomically.

Quick start

You need:

  • A deployed Sendook Worker (wrangler deploy).
  • Your MASTER_KEY secret value (set via wrangler secret put MASTER_KEY).
  • The Worker's base URL (e.g. https://api.sendook.com or your *.workers.dev host).

Create an agent with the master key:

curl -sX POST "$SENDOOK_HOST/agents" \
  -H "Authorization: Bearer $SENDOOK_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Support Bot"}'

Response:

{
  "id": "abc123def456",
  "email": "abc123def456@yourdomain.com",
  "name": "Support Bot",
  "api_key": "rA9...long-base64url",
  "created_at": 1730000000
}

Save the api_key — it is shown only once. From there, the agent can send mail with its own key:

curl -sX POST "$SENDOOK_HOST/agents/abc123def456/messages/send" \
  -H "Authorization: Bearer $AGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "alice@example.com",
    "subject": "Hello from my agent",
    "text": "This message was sent through Sendook."
  }'

Inbound mail addressed to abc123def456@yourdomain.com lands in the agent's mailbox, which you can read with GET /agents/abc123def456/messages.

Where to next

  • Installation — deploy the Worker, wire Email Routing, set the secrets.
  • Usage Guide — the seven workflows you'll touch in production.
  • API Overview — every route, mapped to the Worker source.