Skip to content

Quickstarts

Six flows, four ways to call them.

curl, Python, TypeScript, and MCP are all in this page. A shell can use the CLI instead. Markdown: /docs/quickstarts.md. Framework setup: Cloudflare Agents SDK · Vercel eve · OpenClaw · Hermes Agent · OpenCode.

Operator: Avatar 8 LLC (ops@avatar33.com).

Claude Code

In Claude Code, add the marketplace, then install the plugin. The plugin connects https://cooperemail.com/mcp and includes the agent-email and human-in-the-loop skills.

https://code.claude.com/docs/en/plugin-marketplaces

/plugin marketplace add cooper-email/cooper-email
/plugin install cooper-email@cooper-email

Manual MCP add

https://code.claude.com/docs/en/mcp

claude mcp add --transport http cooper-email https://cooperemail.com/mcp

Codex

Codex CLI 0.165.0 installs plugin 1.2.1 from cooper-email/cooper-email with these two commands. That install includes the hosted MCP server and the agent-email and human-in-the-loop skills.

https://developers.openai.com/plugins/build/plugins

codex plugin marketplace add cooper-email/cooper-email
codex plugin add cooper-email@cooper-email

Manual fallback (~/.codex/config.toml)

https://learn.chatgpt.com/docs/extend/mcp.md

[mcp_servers.cooper-email]
url = "https://cooperemail.com/mcp"

Cursor

The install link opens Cursor and asks before it adds the server. The config query is base64 of the server entry.

https://cursor.com/docs/mcp/install-links

cursor://anysphere.cursor-deeplink/mcp/install?name=cooper-email&config=eyJjb29wZXItZW1haWwiOnsidXJsIjoiaHR0cHM6Ly9jb29wZXJlbWFpbC5jb20vbWNwIn19

Or paste mcp.json

https://cursor.com/docs/mcp

{
  "mcpServers": {
    "cooper-email": {
      "url": "https://cooperemail.com/mcp"
    }
  }
}

Grok Bot

Paste this into the bot chat. It points Grok Bot at llms.txt and the hosted MCP server at https://cooperemail.com/mcp, then asks it to create an inbox.

https://cooperemail.com/integrations/grokbot

Read https://cooperemail.com/llms.txt, connect the Cooper Email MCP at https://cooperemail.com/mcp, finish OAuth, then create an inbox on that signed-in account

Project instruction files

Run this in a project folder. It adds a short Email section to AGENTS.md, CLAUDE.md, GEMINI.md, and .cursor/rules when they exist. It does not write an API key, and running it again changes nothing. Read it first at /install.sh.

curl -fsSL https://cooperemail.com/install.sh | sh

Create an inbox

POST /api/v1/onboard creates an account, a Bearer key, and an inbox at cooperemail.com in one call. username is optional. Omit it and Cooper picks box plus 8 hex characters. The api_key is returned once. hint says to save the key and address now and gives the command to check mail.

curl
curl -s -X POST https://cooperemail.com/api/v1/onboard
# or name it: curl -s https://cooperemail.com/api/v1/onboard -H 'content-type: application/json' -d '{"username":"research-bot"}'
Python
import json, urllib.request
req = urllib.request.Request(
    "https://cooperemail.com/api/v1/onboard",
    data=json.dumps({"username": "research-bot"}).encode(),
    headers={"content-type": "application/json"},
    method="POST",
)
with urllib.request.urlopen(req) as res:
    body = json.load(res)
print(body["api_key"], body["inbox"]["email"], body["inbox"]["id"])
TypeScript
const response = await fetch("https://cooperemail.com/api/v1/onboard", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ username: "research-bot" }),
});
const created = await response.json();
const key = created.api_key as string;
const inboxId = created.inbox.id as string;
const email = created.inbox.email as string;
MCP
{
  "tool": "cooper_onboard",
  "arguments": { "username": "research-bot" }
}

Send an email

POST /api/v1/inboxes/{id}/messages sends from the inbox. client_id and Idempotency-Key stop a retry from sending twice.

curl
curl -s https://cooperemail.com/api/v1/inboxes/$INBOX/messages \
  -H "authorization: Bearer $COOP_KEY" \
  -H "content-type: application/json" \
  -H "idempotency-key: send-001" \
  -d '{"to":["ada@example.com"],"subject":"Hello","text":"Tuesday works.","client_id":"send-001"}'
Python
import json, os, urllib.request
req = urllib.request.Request(
    f"https://cooperemail.com/api/v1/inboxes/{os.environ['INBOX']}/messages",
    data=json.dumps({
        "to": ["ada@example.com"],
        "subject": "Hello",
        "text": "Tuesday works.",
        "client_id": "send-001",
    }).encode(),
    headers={
        "authorization": f"Bearer {os.environ['COOP_KEY']}",
        "content-type": "application/json",
        "idempotency-key": "send-001",
    },
    method="POST",
)
with urllib.request.urlopen(req) as res:
    print(json.load(res)["id"])
TypeScript
await fetch(`https://cooperemail.com/api/v1/inboxes/${inboxId}/messages`, {
  method: "POST",
  headers: {
    authorization: `Bearer ${key}`,
    "content-type": "application/json",
    "idempotency-key": "send-001",
  },
  body: JSON.stringify({
    to: ["ada@example.com"],
    subject: "Hello",
    text: "Tuesday works.",
    client_id: "send-001",
  }),
});
MCP
{
  "tool": "cooper_send_message",
  "arguments": {
    "inbox_id": "research-bot",
    "to": ["ada@example.com"],
    "subject": "Hello",
    "text": "Tuesday works.",
    "client_id": "send-001",
    "idempotency_key": "send-001"
  }
}

Wait for a verification code

GET /api/v1/inboxes/{id}/wait-for-code holds up to 55 seconds and returns the code or verification link and the message id. kind=link waits for a link. The body is not returned and the link is not opened.

curl
curl -s "https://cooperemail.com/api/v1/inboxes/$INBOX/wait-for-code?wait=25" \
  -H "authorization: Bearer $COOP_KEY"
Python
import json, os, urllib.request
url = f"https://cooperemail.com/api/v1/inboxes/{os.environ['INBOX']}/wait-for-code?wait=25"
req = urllib.request.Request(url, headers={"authorization": f"Bearer {os.environ['COOP_KEY']}"})
with urllib.request.urlopen(req) as res:
    body = json.load(res)
print(body["code"], body["message"]["id"])
TypeScript
const waiting = await fetch(
  `https://cooperemail.com/api/v1/inboxes/${inboxId}/wait-for-code?wait=25`,
  { headers: { authorization: `Bearer ${key}` } },
);
const code = await waiting.json();
console.log(code.code, code.message.id);
MCP
{
  "tool": "cooper_wait_for_code",
  "arguments": { "inbox_id": "research-bot", "wait": 25 }
}

Register a webhook

POST /api/v1/webhooks registers an HTTPS URL. Verify x-cooper-signature-v2 over the timestamp, a dot, and the raw body, and dedupe on x-cooper-delivery.

curl
curl -s https://cooperemail.com/api/v1/webhooks \
  -H "authorization: Bearer $COOP_KEY" \
  -H "content-type: application/json" \
  -d '{"url":"https://example.com/hooks/cooper","events":["message.received"],"client_id":"hook-1"}'
Python
import hashlib, hmac, json, os, urllib.request
req = urllib.request.Request(
    "https://cooperemail.com/api/v1/webhooks",
    data=json.dumps({
        "url": "https://example.com/hooks/cooper",
        "events": ["message.received"],
        "client_id": "hook-1",
    }).encode(),
    headers={
        "authorization": f"Bearer {os.environ['COOP_KEY']}",
        "content-type": "application/json",
    },
    method="POST",
)
with urllib.request.urlopen(req) as res:
    secret = json.load(res)["secret"]

def verify(secret, raw_body, timestamp, signature):
    expected = "v1=" + hmac.new(
        secret.encode(), f"{timestamp}.{raw_body}".encode(), hashlib.sha256
    ).hexdigest()
    return any(hmac.compare_digest(expected, part.strip()) for part in signature.split(","))
TypeScript
await fetch("https://cooperemail.com/api/v1/webhooks", {
  method: "POST",
  headers: {
    authorization: `Bearer ${key}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    url: "https://example.com/hooks/cooper",
    events: ["message.received"],
    client_id: "hook-1",
  }),
});
MCP
{
  "tool": "cooper_register_webhook",
  "arguments": {
    "url": "https://example.com/hooks/cooper",
    "events": ["message.received"]
  }
}

Buy a phone number and read an inbound text

POST /api/v1/inboxes/{id}/phone-number buys a US number for a Starter or Pro inbox that has a verified owner. Inbound texts are stored on the inbox. cooper_wait_for_sms waits for a text. GET events?types=message.received&wait=25 waits for the next received message on that inbox.

curl
# Search first: [] means no stock in that area code (fallback names any substitute).
curl -s "https://cooperemail.com/api/v1/phone-numbers/available?area_code=650&limit=3" \
  -H "authorization: Bearer $COOP_KEY"

curl -s https://cooperemail.com/api/v1/inboxes/$INBOX/phone-number \
  -H "authorization: Bearer $COOP_KEY" \
  -H "content-type: application/json" \
  -H "idempotency-key: phone-1" \
  -d '{"area_code":"650"}'

curl -s "https://cooperemail.com/api/v1/inboxes/$INBOX/events?types=message.received&wait=25" \
  -H "authorization: Bearer $COOP_KEY"
Python
import json, os, urllib.request
inbox = os.environ["INBOX"]
headers = {
    "authorization": f"Bearer {os.environ['COOP_KEY']}",
    "content-type": "application/json",
    "idempotency-key": "phone-1",
}
buy = urllib.request.Request(
    f"https://cooperemail.com/api/v1/inboxes/{inbox}/phone-number",
    data=json.dumps({"area_code": "650"}).encode(),
    headers=headers,
    method="POST",
)
with urllib.request.urlopen(buy) as res:
    print(json.load(res)["e164"])
wait = urllib.request.Request(
    f"https://cooperemail.com/api/v1/inboxes/{inbox}/events?types=message.received&wait=25",
    headers={"authorization": headers["authorization"]},
)
with urllib.request.urlopen(wait) as res:
    print(json.load(res))
TypeScript
await fetch(`https://cooperemail.com/api/v1/inboxes/${inboxId}/phone-number`, {
  method: "POST",
  headers: {
    authorization: `Bearer ${key}`,
    "content-type": "application/json",
    "idempotency-key": "phone-1",
  },
  body: JSON.stringify({ area_code: "650" }),
});
const inbound = await fetch(
  `https://cooperemail.com/api/v1/inboxes/${inboxId}/events?types=message.received&wait=25`,
  { headers: { authorization: `Bearer ${key}` } },
);
MCP
{
  "tool": "cooper_provision_phone_number",
  "arguments": { "inbox_id": "research-bot", "area_code": "650", "idempotency_key": "phone-1" }
}

{
  "tool": "cooper_wait_for_sms",
  "arguments": { "inbox_id": "research-bot", "wait": 20 }
}

Approve before send

A verified owner is required. PATCH send_mode to approval holds POST /messages, reply, reply-all, and forward as a pending draft and emails that owner Approve and Reject links. No verified owner returns HTTP 409 owner_required and leaves send_mode direct. The confirm page lists recipients, subject, schedule, attachments, and the text body, and pressing Approve does not send if the draft changed after the page was opened. Owner confirm pages cannot be framed.

curl
curl -s -X PATCH https://cooperemail.com/api/v1/inboxes/$INBOX \
  -H "authorization: Bearer $COOP_KEY" \
  -H "content-type: application/json" \
  -d '{"send_mode":"approval"}'

curl -s https://cooperemail.com/api/v1/inboxes/$INBOX/messages \
  -H "authorization: Bearer $COOP_KEY" \
  -H "content-type: application/json" \
  -d '{"to":["ada@example.com"],"subject":"Quote","text":"Ready for review.","client_id":"draft-1"}'
Python
import json, os, urllib.request
inbox = os.environ["INBOX"]
key = os.environ["COOP_KEY"]

def post(path, payload, method="POST"):
    req = urllib.request.Request(
        f"https://cooperemail.com{path}",
        data=json.dumps(payload).encode(),
        headers={"authorization": f"Bearer {key}", "content-type": "application/json"},
        method=method,
    )
    with urllib.request.urlopen(req) as res:
        return json.load(res)

post(f"/api/v1/inboxes/{inbox}", {"send_mode": "approval"}, "PATCH")
post(f"/api/v1/inboxes/{inbox}/messages", {
    "to": ["ada@example.com"],
    "subject": "Quote",
    "text": "Ready for review.",
    "client_id": "draft-1",
})
TypeScript
await fetch(`https://cooperemail.com/api/v1/inboxes/${inboxId}`, {
  method: "PATCH",
  headers: {
    authorization: `Bearer ${key}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({ send_mode: "approval" }),
});
await fetch(`https://cooperemail.com/api/v1/inboxes/${inboxId}/messages`, {
  method: "POST",
  headers: {
    authorization: `Bearer ${key}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    to: ["ada@example.com"],
    subject: "Quote",
    text: "Ready for review.",
    client_id: "draft-1",
  }),
});
MCP
{
  "tool": "cooper_update_inbox",
  "arguments": { "inbox_id": "research-bot", "send_mode": "approval" }
}

{
  "tool": "cooper_create_draft",
  "arguments": {
    "inbox_id": "research-bot",
    "to": ["ada@example.com"],
    "subject": "Quote",
    "text": "Ready for review.",
    "client_id": "draft-1"
  }
}