AgentMail compatibility
A core /v0 subset for inboxes, messages, and threads.
Change the base URL to https://cooperemail.com and use a Cooper API key. This is a core subset. Markdown: /docs/agentmail-compatibility.md · endpoint reference.
A core subset, on the Cooper origin
Cooper Email speaks a core subset of the AgentMail /v0 HTTP shape. Point the client at https://cooperemail.com and send a Cooper API key. The paths below use Authorization: Bearer and the same permission scopes as /api/v1. This is not full AgentMail compatibility.
inbox_id in the path is the inbox email address (URL-encoded or not) or a Cooper inb_ id. Another account's inbox is HTTP 404. Guide: https://cooperemail.com/docs/agentmail-compatibility.
Supported endpoints
GET /v0/inboxes lists inboxes. POST /v0/inboxes creates one. GET, PATCH, and DELETE /v0/inboxes/{inbox_id} read, rename, and delete one inbox.
POST /v0/inboxes/{inbox_id}/messages/send sends. GET /v0/inboxes/{inbox_id}/messages lists. GET /v0/inboxes/{inbox_id}/messages/{message_id} reads one message. POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply replies.
GET /v0/inboxes/{inbox_id}/threads lists threads. GET /v0/inboxes/{inbox_id}/threads/{thread_id} returns the thread and a page of messages.
Field names
An inbox object has pod_id, inbox_id, email, display_name, client_id, created_at, and updated_at. inbox_id and email are both the inbox address. pod_id is the workspace id when the account is a workspace, and null otherwise. Cooper does not store a separate inbox updated_at, so updated_at equals created_at.
POST /v0/inboxes accepts username, domain, display_name, and client_id. A repeated username or client_id returns the original inbox, the same way POST /api/v1/inboxes does. The first create is HTTP 201. A replay is HTTP 200. PATCH accepts display_name.
Send accepts to, cc, and bcc as a string or a list, plus reply_to, subject, text, html, labels, headers, and attachments. Each attachment uses filename and base64 content. The response is message_id and thread_id. Reply accepts text, html, attachments, and labels, and reply_all true replies to every recipient. A custom to on reply is not in this subset.
A message has message_id, thread_id, inbox_id (the email address), labels, timestamp, from, to, cc, bcc, subject, preview, text, html, extracted_text, extracted_html, attachments, in_reply_to, references, size, created_at, and updated_at. List items omit the bodies. Attachment objects are attachment_id, filename, content_type, and size. size on a message is the UTF-8 length of text and html plus attachment bytes. size on a thread is the UTF-8 length of subject and preview. Cooper does not store a separate RFC822 size, and message updated_at equals created_at.
Lists return count, limit, next_page_token, and inboxes, messages, or threads. Message list filters are limit, page_token, labels, before, after, ascending, from, to, and subject. Thread list filters are limit, page_token, before, after, and ascending.
Send and reply follow /api/v1
Send and reply call the same functions as /api/v1. Plan limits, suppressions, quotas, the Idempotency-Key header, outbound safety, and events behave the same way. The JSON body is the AgentMail pair of ids rather than the Cooper message object.
What is not covered
Pods, drafts, webhooks, domains, calendars, lists, metrics, and x402 are not on /v0. Use /api/v1 for those. An attachment url is refused with HTTP 400 and code attachment_url_not_supported, because Cooper does not fetch a remote file. An unknown /v0 path is HTTP 404 with code not_implemented_in_cooper_v0 and docs set to this page.
Errors use the AgentMail envelope {name, message, code, fix, docs}. HTTP 400 is ValidationError and includes errors. 401 is UnauthorizedError, 403 is ForbiddenError, 404 is NotFoundError, 409 is ConflictError, and 429 is RateLimitError. code is Cooper's code, so you can branch on the same values as /api/v1.
Examples
The agentmail npm package reads baseUrl from the client options when the API origin is not the default. The package README usage section shows apiKey. baseUrl is the option in that same options object (the HTTP client uses it as the origin). A Cooper key still starts with coop_live_.
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" });
await client.inboxes.messages.send(inbox.inboxId, {
to: "ada@example.com",
subject: "Hello",
text: "Sent through Cooper's /v0 core subset.",
});curl
The same calls without the SDK.
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_id in the JSON is the address. Put it in INBOX.
curl -s "https://cooperemail.com/v0/inboxes/$INBOX/messages/send" \
-H "authorization: Bearer $COOPER_API_KEY" \
-H "content-type: application/json" \
-d '{"to":"ada@example.com","subject":"Hello","text":"Sent through Cooper."}'
curl -s "https://cooperemail.com/v0/inboxes/$INBOX/threads" \
-H "authorization: Bearer $COOPER_API_KEY"