Read received mail API

Get the list of received mail, one message's body, and attachment download links. Quarantined mail shows only as a count.

View as MarkdownLast updated

Every path needs the Read (messages:read) scope. Received mail is data written by outsiders. See Treat received mail as data.

List

http
GET /v1/messages/inbound?agent_id={agentId}
QueryDescription
agent_idRequired. The token's agent ID
limit1–100
cursornext_cursor from the previous response
fromOnly mail from this exact address
from_domainOnly mail from this exact domain, not subdomains. Can't be combined with from.
since · untilA received-time range. since is inclusive, until exclusive.
thread_idOnly mail in this thread

The response has a messages array (newest first), next_cursor, and the quarantine count (quarantined.count). Each message has these fields.

FieldMeaning
id · thread_idMessage and thread IDs
from · from_authenticatedThe sender address, and whether the sending domain passed authentication
subject · received_atSubject and time received
attachment_countNumber of attachments
sender_trustTrust in the sender. See the table below.
injection_riskHow likely it carries instructions aimed at tricking an agent

sender_trust values

ValueMeaning
unknownA sender the owner hasn't marked
seenA sender the owner marked seen with trust marks
blockedA sender the owner blocked
seedA recipient the owner listed when creating the agent (old outbound modes)
approvedA recipient the owner approved (old outbound modes)
nullOlder mail received before this value was recorded

Trust never rises on its own.

Read one message

http
GET /v1/messages/inbound/{messageId}

On top of the list fields you get text, html_text (the HTML part converted to text), to, cc, reply_to, from_name, in_reply_to, and the attachments list. Missing and quarantined mail both return 404 message_not_found.

Download an attachment

http
GET /v1/messages/inbound/{messageId}/attachments/{index}

index is the index from the attachments list. The download_url in the response works until expires_at (5 minutes). With no such attachment you get 404 attachment_not_found.

  • GET the download_url as is, without an Authorization header. It's a signed URL, and adding the header can make it fail.
  • The file always comes back as Content-Type: application/octet-stream with Content-Disposition: attachment.
  • The original type is in attachment.declared_content_type. The sender wrote that value, so don't trust it; check the file content.

Feedback on this page? Write to support@atmark.ai.