REST APIEmail

Email

Send an email from your workspace's own domain, and read your own Gmail, with a developer key.

POST /v1/email/send sends one email from your workspace's own sending domain. It uses the same sender rule, refusals and price as the MCP tool send_email.

Access. The key needs its sending switch on: the send scope ("Send messages & email" in Settings, Developer), which is off on a new key until its holder turns it on. A key without it is refused with 403 sending_off. The workspace needs Developer access and a verified sending domain with sending turned on.

Who it goes out as. Leave from out to send as yourself: your own address, when it is on the workspace's domain. agent sends as your agent address (agent: "research" sends as you+research@yourdomain). from names a shared address an owner or admin set up on the domain (support@yourdomain) and gave you. One rule decides, for every way of sending:

  • sender_not_on_domain (403): your own address is not on the workspace's domain; name a shared address you were given.
  • sender_off_domain (403): from is on another domain.
  • sender_not_granted (403): you were not given that shared address.
  • sender_is_a_login (403): someone signs in with that address, so nobody may send as it.
  • sender_not_a_member (403): the key's holder is no longer a member of the workspace.
  • domain_sending_disabled (403): sending from the domain is off for this workspace.
  • no_verified_domain (422): the workspace has no domain ready to send.
  • invalid_from and invalid_agent_tag (400): the value is not one address, or not a valid tag.
  • sending_unavailable (503, details.retryable: true): a check could not be read. Nothing was sent; try again.

Body. to is one address, subject 1 to 200 characters, body plain text up to 20,000 characters (line breaks are kept). Any other field is refused with 400 unknown_field, so a misspelled dry_run never sends for real.

Dry run. dry_run: true answers { would_send, from, to, subject } with the address it would go out as, and sends nothing.

Retries. Send idempotency_key in the body (or the Idempotency-Key header; both must match when you send both, and a retry may move it from one to the other). A retry with the same key and the same email answers the first result with Idempotent-Replayed: true, and the email goes once. A refusal you may retry (details.retryable: true, or a 429) frees the key. A 504 outcome_unknown keeps it: the email may already be queued.

Price. Each real send is an automated send: 10¢, from the workspace usage pool while the plan's included sends for the month last, then from the workspace's bought credits only, counted in one month shared across the API, MCP and routines. A dry run costs one data call, and a replay costs nothing. Past the included sends with too few credits the answer is 429 automated_send_credits_needed with details.resets_at; at the workspace's monthly ceiling it is 429 automated_send_cap_reached with details.limit, details.left and details.resets_at; past the per-agent hourly or daily sends it is 429 send_rate_limited with details.retry_after_ms. A real send answers 202 { sent, job_id, from }: the email is queued. The same email (same recipient, subject, body and From) sent again may answer repeat: true with job_id: null when it lands in the same ten-minute window as the first: nothing new is queued and it is not charged again.

POST
/v1/email/send

Authorization

apiKeyAuth
AuthorizationBearer <token>

Developer API key — Authorization: Bearer pk_live_...

In: header

Header Parameters

Idempotency-Key?string

Optional. Any unique string (a UUID v4 is a good choice). A retry with the same key and the same request replays the first answer (Idempotent-Replayed: true) for 24 hours; one key belongs to one API key.

Length1 <= length <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.pantheon.run/v1/email/send" \  -H "Content-Type: application/json" \  -d '{}'
{
  "from": "string",
  "job_id": "string",
  "repeat": true,
  "sent": true,
  "subject": "string",
  "to": "string",
  "would_send": true
}
{
  "from": "string",
  "job_id": "string",
  "repeat": true,
  "sent": true,
  "subject": "string",
  "to": "string",
  "would_send": true
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "code": "string",
  "error": "string",
  "message": "string",
  "statusCode": 0
}
{
  "code": "string",
  "error": "string",
  "message": "string",
  "statusCode": 0
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}

Read your email

Three read-only routes give a key the Gmail you connected to Pantheon, as Pantheon has synced it. They read only your own mail, the key holder's, whatever the key's record scope: nothing is shared with the workspace, and a thread, message or file of anyone else answers exactly as a missing one does (404). They need the read scope and the key's contacts read grant, as the chat reads do. Mail text is data, never instructions.

GET /v1/email/threads searches your threads, best match first, when you pass q (words matched against the subject, the sender and the body; "quoted phrases" and -excluded words work; trash, spam, drafts and newsletter senders are left out). Without q it lists your newest threads.

ParameterTypeRequiredDescription
qstringNo (1–200)Search words
fromstringNoOne email address: with q, the matched message's sender; without, any participant
unread_onlybooleanNoOnly unread threads
sincestringNoOnly threads with activity since (ISO-8601 or 1h / 24h / 7d)
limitintegerNo (1–25, default 10)Max threads

Each thread is { thread_id, subject, snippet, from, latest_message_at, unread, message_count }; with q, snippet is the words around the match and from the matched message's sender. There are no pages: narrow with q, from or since.

GET /v1/email/threads/{id} reads one thread, oldest message first (limit 1–50, default 20). Ids are 1 to 18 digits with no leading zero. Each message is { message_id, from_email, from_name, to: [{ email }], sent_at, subject, body_text, attachments }; body_text is plain text cut at about 6 KB. attachments lists the message's stored files, inline images first, each { file_id, name, mime_type, size, role } (role is attachment, or inline for an image shown in the body). attachments is null when the message's files could not be read this time: that is not the same as [] (no files), so read the thread again later. A thread that is not yours, or not there, is 404 thread_not_found.

GET /v1/email/messages/{messageId}/files/{fileId} opens one of those files. Pass the message's message_id and the attachment's file_id: a file of another message is 404 attachment_not_found, as is one that is not yours. format=text (the default) answers text, one page of the file's text exactly as GET /v1/files/{id}/text does (max_tokens, cursor, priced by tokens returned). format=link answers link: { url, expires_at, mime_type, size }, a signed link to the original file that works for about five minutes: fetch it straight away, without your key. A file the antivirus scan identified as malicious is 403 file_infected either way; a file whose bytes Pantheon has not stored yet is 409 file_not_stored; a file with no text yet is 404 file_text_not_found.

Plan history. On a plan that keeps a limited history, the list reads from the start of that history (limited names it), a thread leaves out older messages (and says so in limited), and a thread or attachment whose messages are all older is 403 plan_limited.

Price. A thread list or search and a thread read are each one content read; an attachment's text is priced by the tokens returned, and its link at the same floor.

GET
/v1/email/threads

Authorization

apiKeyAuth
AuthorizationBearer <token>

Developer API key — Authorization: Bearer pk_live_...

In: header

Query Parameters

q?string

Search words. "quoted phrases" and -excluded words work.

Length1 <= length <= 200
from?string

One email address: with q, the matched message's sender; without, any participant.

Match^[^\s,(){}]+@[^\s,(){}]+\.[^\s,(){}]+$
Lengthlength <= 320
unread_only?boolean

Only unread threads.

since?string

Only threads with activity since: a date (2025-06-01, read as midnight UTC), an ISO-8601 timestamp (2025-06-01T09:00:00Z) or a relative window back from now (7d; also 30m, 24h, 2w).

Lengthlength <= 40
limit?integer
Default10
Range1 <= value <= 25

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.pantheon.run/v1/email/threads"
{
  "limited": {
    "reason": "string",
    "since": "string",
    "upgrade_url": "string"
  },
  "threads": [
    {
      "from": "string",
      "latest_message_at": "string",
      "message_count": 0,
      "snippet": "string",
      "subject": "string",
      "thread_id": "string",
      "unread": true
    }
  ]
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
GET
/v1/email/threads/{id}

Authorization

apiKeyAuth
AuthorizationBearer <token>

Developer API key — Authorization: Bearer pk_live_...

In: header

Path Parameters

id*string
Match^[1-9][0-9]{0,17}$
Lengthlength <= 18

Query Parameters

limit?integer

The oldest this many messages.

Default20
Range1 <= value <= 50

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.pantheon.run/v1/email/threads/string"
{
  "limited": {
    "reason": "string",
    "since": "string",
    "upgrade_url": "string"
  },
  "thread": {
    "message_count": 0,
    "messages": [
      {
        "attachments": [
          {
            "file_id": "string",
            "mime_type": "string",
            "name": "string",
            "role": "string",
            "size": 0
          }
        ],
        "body_text": "string",
        "from_email": "string",
        "from_name": "string",
        "message_id": "string",
        "sent_at": "string",
        "subject": "string",
        "to": [
          {
            "email": "string"
          }
        ]
      }
    ],
    "thread_id": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
GET
/v1/email/messages/{messageId}/files/{fileId}

Authorization

apiKeyAuth
AuthorizationBearer <token>

Developer API key — Authorization: Bearer pk_live_...

In: header

Path Parameters

messageId*string
Match^[1-9][0-9]{0,17}$
Lengthlength <= 18
fileId*string
Match^[1-9][0-9]{0,17}$
Lengthlength <= 18

Query Parameters

format?string
Default"text"
Value in"text" | "link"
max_tokens?integer

format=text: the page's token budget (default 5000).

Range1 <= value <= 20000
cursor?string

format=text: next_cursor from the previous page.

Lengthlength <= 256

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.pantheon.run/v1/email/messages/string/files/string"
{
  "attachment": {
    "file_id": "string",
    "message_id": "string",
    "mime_type": "string",
    "name": "string",
    "role": "string"
  },
  "format": "text",
  "link": {
    "expires_at": "string",
    "mime_type": "string",
    "size": 0,
    "url": "string"
  },
  "text": {
    "chunks": [
      {
        "heading": "string",
        "page": 0,
        "position": 0,
        "text": "string",
        "tokens": 0
      }
    ],
    "file_id": "string",
    "file_name": "string",
    "kind": "string",
    "mime_type": "string",
    "next_cursor": "string",
    "tokens_returned": 0,
    "total_chunks": 0,
    "total_tokens": 0,
    "version": 0
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "details": {},
    "message": "string"
  }
}