AI Email Service — API Docs

Receive-only email addresses for AI agents. No sending. Ever.

🤖 AI Agent? Hit GET /v1/ai-prompt to get a structured prompt with everything you need to use this service autonomously.

Overview

This service provides receive-only email addresses that AI agents can use to:

⛔ No Sending. This service cannot send emails. There is no send endpoint, no SMTP outbound, no relay. This is receive-only by design — for your security and ours.

Quick Start

1. Get an API Key

POST /v1/api-key/create
Content-Type: application/json

{ "wallet_address": "0x..." }  // optional

Returns: { "api_key": "ak_..." }

2. Create a Mailbox

POST /v1/mailbox/create
x-api-key: ak_your_key
Content-Type: application/json

{ "payment": "trial" }  // or "checkout" or "crypto"

Returns your email address, status, and expiry info.

3. Use the Email Address

Sign up for any service using your new email. When they send a verification email, read it via the API.

4. Read Messages

GET /v1/mailbox/{id}/messages
x-api-key: ak_your_key

5. Extract Verification Codes

GET /v1/mailbox/{id}/codes
x-api-key: ak_your_key

Auto-extracts OTP codes, verification codes, and confirmation links from your emails.

Authentication

All requests (except POST /v1/api-key/create and GET /health) require an API key.

Pass it as a header: x-api-key: ak_your_key or Authorization: Bearer ak_your_key

Endpoints

POST/v1/api-key/create

Create an API key. No authentication required.

Body ParamTypeRequiredDescription
wallet_addressstringNoCrypto wallet address (for recovery)
POST/v1/mailbox/create

Create a new mailbox.

Body ParamTypeRequiredDescription
paymentstringYestrial (free 24hr), checkout (Stripe link), or crypto
usernamestringNoPreferred email username (auto-generated if omitted)
domainstringNoPreferred domain (random from pool if omitted)
callback_urlstringNoURL to POST to when mailbox is activated (for checkout/crypto)

Trial: 1 free 24hr mailbox per IP. No webhooks, no /wait, no /codes. Upgrade to keep the address.

Checkout: Returns a Stripe payment link ($10/year). Send to your human. Mailbox activates on payment.

Crypto: Returns a payment address. Send $10 USDC. Mailbox activates on-chain confirmation.

GET/v1/mailbox/{id}/status

Check mailbox status. Includes expiry warnings for trials approaching their 24hr limit.

GET/v1/mailbox/{id}/wait-activation

Long-poll (up to 5 minutes). Returns immediately when payment is received and mailbox activates.

Query ParamTypeDescription
timeoutintegerMax wait in seconds (default 300, max 300)
GET/v1/mailbox/{id}/messages

List messages in the mailbox.

Query ParamTypeDescription
limitintegerMax messages (default 50, max 100)
sincestringISO date — only messages after this time
GET/v1/mailbox/{id}/messages/{msgId}

Read a single message with full body (text + HTML).

GET/v1/mailbox/{id}/latest

Get the most recent message.

GET/v1/mailbox/{id}/wait

PAID ONLY Long-poll for new messages. Hangs until a matching message arrives or timeout.

Query ParamTypeDescription
timeoutintegerMax wait in seconds (default 30, max 60)
fromstringFilter: only messages from this sender
subject_containsstringFilter: subject must contain this text
GET/v1/mailbox/{id}/codes

PAID ONLY Auto-extracted OTP/verification codes from recent messages.

DELETE/v1/mailbox/{id}

Delete a mailbox and all its messages permanently.

Pricing

Trial vs Paid

FeatureFree TrialPaid ($10/yr)
Duration24 hours1 year (renewable)
Email addressTemporary (dies after 24hr)Permanent
Read messages
Message retention24 hours30 days
/wait (long-poll)
/codes (OTP extract)
Webhooks
API rate limit10/hour60/minute

Webhooks

Get notified instantly when emails arrive. Create webhook subscriptions to receive real-time POST requests to your URL.

POST/v1/webhooks

Create a webhook subscription.

Body ParamTypeRequiredDescription
urlstringYesHTTPS URL to receive POST notifications
mailbox_idstringNoScope to a specific mailbox (all mailboxes if omitted)
secretstringNoShared secret for HMAC-SHA256 signature verification
GET/v1/webhooks

List all your webhook subscriptions.

DELETE/v1/webhooks/{id}

Delete a webhook subscription.

POST/v1/webhooks/{id}/test

Send a test payload to your webhook URL to verify it's working.

Webhook Payload

POST https://your-server.com/webhook
Content-Type: application/json
x-webhook-signature: sha256=a1b2c3d4e5...

{
  "event": "message.received",
  "mailbox_id": "mbx_abc123",
  "email": "agent-x7k@aiemailservice.com",
  "message": {
    "id": "msg_xyz789",
    "from": "noreply@github.com",
    "subject": "Verify your email address",
    "text": "Your verification code is 847291",
    "extracted_codes": ["847291"],
    "received_at": "2026-02-14T12:00:00Z"
  }
}

Signature Verification

If you set a secret when creating the webhook, every request includes an x-webhook-signature header. Verify it with HMAC-SHA256:

const crypto = require('crypto');
const signature = crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
const expected = req.headers['x-webhook-signature'].replace('sha256=', '');
if (signature !== expected) throw new Error('Invalid signature');

CLI Tool

Manage your mailboxes from the command line. Install globally via npm:

npm install -g https://aiemailservice.com/aiemailservice-1.0.0.tgz

Commands

aiemailservice init              # Save your API key locally
aiemailservice create            # Create a new mailbox
aiemailservice list              # List all mailboxes
aiemailservice messages <id>     # List messages in a mailbox
aiemailservice read <id> <msgId> # Read a specific message
aiemailservice wait <id>         # Long-poll for new messages
aiemailservice codes <id>        # Extract verification codes
aiemailservice delete <id>       # Delete a mailbox
aiemailservice status <id>       # Check mailbox status

Add --json to any command for machine-readable JSON output.

MCP Server

Connect AI agents (Claude, OpenAI, etc.) natively using the Model Context Protocol server:

npm install -g https://aiemailservice.com/aiemailservice-mcp-1.0.0.tgz

The MCP server exposes 10 tools that let AI agents create mailboxes, read messages, extract codes, manage webhooks, and more — all through their native tool-calling interface. No HTTP plumbing required.

Multi-Agent Sharing

Your API key is stateless and portable. Any agent or machine with the key can access the same mailboxes — no device-specific tokens, no local state to sync.

Example: Agent A on Server 1 creates a mailbox. Agent B on Server 2 reads its messages. Agent C on a laptop extracts verification codes. All using the same API key.

Example: Full Signup Flow

// 1. Create API key
const key = await fetch('/v1/api-key/create', { method: 'POST' }).then(r => r.json());

// 2. Create mailbox
const mailbox = await fetch('/v1/mailbox/create', {
  method: 'POST',
  headers: { 'x-api-key': key.api_key, 'Content-Type': 'application/json' },
  body: JSON.stringify({ payment: 'trial' })
}).then(r => r.json());

console.log('My email:', mailbox.email);
// → agent-abc123@mailpulse.co

// 3. Sign up for GitHub using mailbox.email
// ... (your browser automation here)

// 4. Wait for verification email (paid only)
const result = await fetch(
  `/v1/mailbox/${mailbox.mailbox_id}/wait?from=noreply@github.com&timeout=30`,
  { headers: { 'x-api-key': key.api_key } }
).then(r => r.json());

// 5. Get the verification code
console.log('Code:', result.message.extracted_codes[0]);
// → 847291

// 6. Enter the code to complete signup