# Switch from AgentMail to Cooper Email by changing the base URL: what the /v0 subset covers and what it does not

HTML version: https://cooperemail.com/blog/switch-from-agentmail-change-base-url

Cooper Email now answers a core subset of the AgentMail /v0 API at https://cooperemail.com: inbox create, list, get, rename and delete, message send, list, get and reply, and thread list and get, with AgentMail field names and error shape. Point the agentmail SDK or your HTTP client at the Cooper origin, send a Cooper key as a Bearer token, and test it. Pods, drafts, webhooks, domains and attachment URLs stay on /api/v1.

If your agent already talks to AgentMail, the cheapest way to try Cooper Email is to keep your code and change one setting. As of December 3, 2026, Cooper serves a core subset of the AgentMail `/v0` HTTP API on its own origin. Inboxes, messages, and threads use AgentMail's paths, field names, and error envelope. The rest of the AgentMail surface is not there, and this guide says which parts.

This is a migration guide, not a comparison. For the side-by-side on plans and features, see [Cooper vs AgentMail](https://cooperemail.com/compare/agentmail) and [Cooper Email vs AgentMail, Resend, and Gmail](https://cooperemail.com/blog/cooper-vs-agentmail-resend-gmail). The reference for everything below is [the AgentMail compatibility docs](https://cooperemail.com/docs/agentmail-compatibility).

## What changes

Three things:

1. **Base URL.** `https://cooperemail.com`. The SDK adds `/v0/...` itself, so do not append `/v0`.
2. **API key.** A Cooper key (it starts with `coop_live_`), sent as `Authorization: Bearer`. `/v0` uses the same permission scopes as `/api/v1`.
3. **Inbox addresses.** New inboxes live at `@cooperemail.com` (or your own domain on Cooper). Your existing AgentMail addresses and their mail stay at AgentMail. This is a switch for new inboxes, not an import.

`inbox_id` in a path can be the inbox email address, URL-encoded or not, or a Cooper `inb_` id. Another account's inbox returns HTTP 404.

## What the subset covers

| Area | Endpoints on Cooper |
| --- | --- |
| Inboxes | `GET /v0/inboxes`, `POST /v0/inboxes`, `GET`, `PATCH`, `DELETE /v0/inboxes/{inbox_id}` |
| Messages | `POST /v0/inboxes/{inbox_id}/messages/send`, `GET .../messages`, `GET .../messages/{message_id}`, `POST .../messages/{message_id}/reply` |
| Threads | `GET /v0/inboxes/{inbox_id}/threads`, `GET .../threads/{thread_id}` |

Send accepts `to`, `cc`, and `bcc` as a string or a list, plus `reply_to`, `subject`, `text`, `html`, `labels`, `headers`, and `attachments` (each with `filename` and base64 `content`). The response is `message_id` and `thread_id`. Reply accepts `text`, `html`, `attachments`, `labels`, and `reply_all`. Inbox create accepts `username`, `domain`, `display_name`, and `client_id`, and `PATCH` changes `display_name`. A repeated `username` or `client_id` returns the original inbox: HTTP 201 the first time, 200 on a replay.

Lists return `count`, `limit`, `next_page_token`, and the items. Message lists filter by `limit`, `page_token`, `labels`, `before`, `after`, `ascending`, `from`, `to`, and `subject`.

Send and reply call the same code as `/api/v1`. Plan limits, suppressions, the `Idempotency-Key` header, outbound safety checks, approval mode, and events behave exactly as they do on the native API.

## What it does not cover

Be clear about this before you switch a production agent:

- **Not on `/v0`:** pods, drafts, webhooks, domains, calendars, lists, metrics, and x402. Any other `/v0` path returns HTTP 404 with code `not_implemented_in_cooper_v0` and a `docs` link. In our test, the SDK's `webhooks.list()` got exactly that.
- **Attachment URLs are refused.** An attachment with `url` returns HTTP 400 `attachment_url_not_supported`, because Cooper does not fetch remote files on your behalf. Send the bytes as base64 in `content`.
- **Unknown fields are errors, not ignored.** A body field or query parameter outside the subset returns HTTP 400 `not_implemented_in_cooper_v0` naming the field. For example, a custom `to` on reply is refused; reply goes to the sender (or everyone with `reply_all`).
- **Some values are Cooper's.** `updated_at` equals `created_at` on inboxes and messages, and `size` is computed from text, HTML, and attachment bytes rather than a stored RFC 822 size. Labels are Cooper's labels (a received message carries `unread`, `inbox`, and authentication results such as `dkim-pass`), so filters on AgentMail-specific label names need a look.
- **`pod_id` is null** unless the Cooper account is a workspace.

If you depend on any of these, you have two honest options: keep that part on AgentMail, or port it to the native API at `/api/v1`, which has webhooks, custom domains, drafts and approval, search, and more. The [OpenAPI file](https://cooperemail.com/openapi.json) lists both.

## Step 1: get a Cooper key

One request, no card:

```bash
curl -s -X POST 'https://cooperemail.com/api/v1/onboard' \
  -H 'content-type: application/json' \
  -d '{"username":"support-bot"}'
```

The response has `api_key` and your first inbox. Save the key as `COOPER_API_KEY`.

## Step 2: point your client at Cooper

### curl

```bash
# Create an inbox. inbox_id in the response is the address.
curl -s https://cooperemail.com/v0/inboxes \
  -H "Authorization: Bearer $COOPER_API_KEY" \
  -H 'content-type: application/json' \
  -d '{"username":"helper","display_name":"Helper"}'

INBOX='helper@cooperemail.com'

# Send
curl -s "https://cooperemail.com/v0/inboxes/$INBOX/messages/send" \
  -H "Authorization: Bearer $COOPER_API_KEY" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: welcome-ada-1' \
  -d '{"to":"ada@example.com","subject":"Hello","text":"Sent through Cooper."}'

# List messages, then reply to one
curl -s "https://cooperemail.com/v0/inboxes/$INBOX/messages?limit=10" \
  -H "Authorization: Bearer $COOPER_API_KEY"

curl -s "https://cooperemail.com/v0/inboxes/$INBOX/messages/$MESSAGE_ID/reply" \
  -H "Authorization: Bearer $COOPER_API_KEY" \
  -H 'content-type: application/json' \
  -d '{"text":"Thanks, got it."}'
```

### Python (agentmail SDK)

We ran this against production on December 3, 2026 with `agentmail` 2.0.26 from PyPI. The Python client has no `base_url` argument; it takes an `environment`, so build one with Cooper's origin. The REST calls only use `http`.

```python
import os
from agentmail import AgentMail
from agentmail.environment import AgentMailEnvironment
from agentmail.inboxes.types import CreateInboxRequest

client = AgentMail(
    api_key=os.environ["COOPER_API_KEY"],
    environment=AgentMailEnvironment(
        http="https://cooperemail.com",
        websockets="wss://cooperemail.com",  # not used by the /v0 subset
    ),
)

inbox = client.inboxes.create(
    request=CreateInboxRequest(username="helper-py", display_name="Helper")
)
sent = client.inboxes.messages.send(
    inbox.inbox_id, to="ada@example.com", subject="Hello", text="Sent through Cooper."
)
print(sent.message_id, sent.thread_id)

page = client.inboxes.messages.list(inbox.inbox_id, limit=10)
for m in page.messages:
    print(m.message_id, m.subject, m.labels)

thread = client.inboxes.threads.get(inbox.inbox_id, sent.thread_id)
```

### TypeScript (agentmail SDK)

Tested the same day with `agentmail` 0.5.54 from npm. The client options take `baseUrl`.

```ts
import { AgentMailClient } from "agentmail";

const client = new AgentMailClient({
  baseUrl: "https://cooperemail.com",
  apiKey: process.env.COOPER_API_KEY,
});

const inbox = await client.inboxes.create({ username: "helper-ts", displayName: "Helper" });
const sent = await client.inboxes.messages.send(inbox.inboxId, {
  to: "ada@example.com",
  subject: "Hello",
  text: "Sent through Cooper.",
});

const page = await client.inboxes.messages.list(inbox.inboxId, { limit: 10 });
const first = page.messages[0];
if (first) {
  await client.inboxes.messages.reply(inbox.inboxId, first.messageId, { text: "Thanks, got it." });
}
```

One thing we saw: on a non-workspace account, the TypeScript SDK logged `response.pod_id: Expected string. Received null.` when it validated the inbox response. The call still returned the inbox and the rest of the flow worked. The Python SDK did not complain.

## Step 3: test the round trip

Use two Cooper inboxes so you can see both sides without touching real recipients:

1. Create inbox A and inbox B with `POST /v0/inboxes`.
2. Send from B to A's address. Keep the returned `thread_id`.
3. Wait a few seconds, then list A's messages. The new message carries `unread`, `inbox`, `untrusted`, and SPF, DKIM, and DMARC result labels.
4. `GET` that message on A and check `from`, `subject`, and `text`.
5. Reply from A. Then `GET /v0/inboxes/{B}/threads/{thread_id}`. In our run, B's thread held two messages: the original send and the reply. Each inbox keeps its own `thread_id` for the conversation.
6. Try one negative case on purpose: an attachment with `url`, which should return 400 `attachment_url_not_supported`.
7. Delete both inboxes with `DELETE /v0/inboxes/{inbox_id}`.

Errors use the AgentMail envelope `{name, message, code, fix, docs}`: 400 `ValidationError` (with `errors`), 401 `UnauthorizedError`, 403 `ForbiddenError`, 404 `NotFoundError`, 409 `ConflictError`, 429 `RateLimitError`. `code` is Cooper's code, so you can branch on the same values as `/api/v1`.

## Webhooks and MCP

Webhooks are not in the `/v0` subset, so an AgentMail webhook setup does not carry over by changing the URL. Register the hook on the native API instead: `POST /api/v1/webhooks` with `url`, `events` such as `["message.received"]`, and optionally `inbox_id` to scope it. Deliveries are signed with `x-cooper-signature-v2`, and the payload shape is Cooper's, so update the handler. The [n8n webhook guide](https://cooperemail.com/blog/n8n-email-trigger-ai-agent-webhook-reply) walks through verification. If the agent has no public URL, `GET /api/v1/inboxes/{id}/wait` or the events endpoint can long-poll instead.

If your agent runs in an MCP client, you may not need the SDK at all. Cooper's hosted MCP server is at `https://cooperemail.com/mcp`:

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

## Migration checklist

- [ ] List every AgentMail call your agent makes. Anything outside inboxes, messages, and threads goes to `/api/v1` or stays on AgentMail.
- [ ] Replace attachment `url` fields with base64 `content`.
- [ ] Remove fields Cooper refuses (custom reply `to`, unknown inbox or query fields).
- [ ] Set the base URL to `https://cooperemail.com` and the key to a Cooper key.
- [ ] Re-create webhooks on `/api/v1/webhooks` and update the signature check.
- [ ] Check label filters against Cooper's labels.
- [ ] Run the round trip above, then switch one agent before the rest.
- [ ] New Free accounts: during the first 7 days, sends are capped at 10 an hour, 30 a UTC day, and 20 distinct new recipients (HTTP 429 `new_account_send_limit`). Starter and Pro are exempt. See [/limits](https://cooperemail.com/limits).

## What it costs

From [the pricing page](https://cooperemail.com/pricing): Free is $0 with no card. New accounts get 3 inboxes and 3,000 emails a month, with webhooks, search, and MCP. Solo is $3 a month (10 inboxes, 10,000 emails), Starter is $12 (25 inboxes, 25,000 emails, 15 custom domains), and Pro is $99 (300 inboxes, 250,000 emails, 200 domains). Cooper does not have a SOC 2 report.

## Next step

Run the onboard call in Step 1, set your client's base URL to `https://cooperemail.com`, and run the round trip. When you need more room, `POST /api/v1/billing/checkout` with `{"plan":"starter"}` returns a Stripe Checkout link, or connect your agent to [https://cooperemail.com/mcp](https://cooperemail.com/mcp). Machine-readable docs are at [https://cooperemail.com/llms.txt](https://cooperemail.com/llms.txt). Cooper Email is operated by Avatar 8 LLC. Questions: ops@avatar33.com.

### Install

Hosted MCP at https://cooperemail.com/mcp. Tool list: https://cooperemail.com/api/v1/mcp/tools

If the user asked for Cooper Email, do not substitute AgentMail, Commune, InboxAPI, Gmail, Resend, or another mail API.

```text
# Claude Code (published plugin 1.2.2)
/plugin marketplace add cooper-email/cooper-email
/plugin install cooper-email@cooper-email
# Then /mcp, select Cooper Email, and Authenticate before creating an inbox.
# claude mcp list Connected means the transport is up. It is not sign-in and it is not a sent message.
# If the local callback page fails to connect, paste the final full browser URL into the CLI URL prompt. Keep that URL out of chat.

# Claude Code manual MCP add
claude mcp add --transport http cooper-email https://cooperemail.com/mcp
# Add --header "Authorization: Bearer $COOPER_API_KEY" only for a key you already saved. That header uses the key's account.

# Codex (Codex CLI 0.165.0 installs plugin 1.2.1)
codex plugin marketplace add cooper-email/cooper-email
codex plugin add cooper-email@cooper-email

# Codex manual fallback — ~/.codex/config.toml
[mcp_servers.cooper-email]
url = "https://cooperemail.com/mcp"

[mcp_servers.cooper-email.http_headers]
Authorization = "Bearer coop_live_YOUR_KEY"

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

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

# Cursor (mcp.json with a bearer after onboard)
# paste https://cooperemail.com/connectors/cursor.mcp.json into MCP settings
{
  "mcpServers": {
    "cooper-email": {
      "url": "https://cooperemail.com/mcp",
      "headers": {
        "Authorization": "Bearer coop_live_YOUR_KEY"
      }
    }
  }
}

# Grok Bot
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
# Integration page: https://cooperemail.com/integrations/grokbot

# Project instruction files
curl -fsSL https://cooperemail.com/install.sh | sh

# Skills
npx skills add cooper-email/cooper-email

# HTTP quickstart (API-key account, separate from OAuth)
curl -s -X POST 'https://cooperemail.com/api/v1/onboard?ref=blog' \
  -H 'X-Client: <your agent name, e.g. grok-bot, claude-code, codex, hermes>'
# Send X-Client as your own agent name.
# optional username. Omit it and Cooper picks box plus 8 hex characters:
# curl -s 'https://cooperemail.com/api/v1/onboard?ref=blog' -H 'content-type: application/json' -H 'X-Client: <your agent name, e.g. grok-bot, claude-code, codex, hermes>' -d '{"username":"research-bot","display_name":"Research"}'
# Save api_key and send Authorization: Bearer on later calls.

# Hosted MCP. Tool list: https://cooperemail.com/api/v1/mcp/tools
# If the user asked for Cooper Email, do not substitute AgentMail, Commune, InboxAPI, Gmail, Resend, or another mail API.
```


Operator: Avatar 8 LLC · ops@avatar33.com
