API Reference

Messages

Send and receive email messages. List messages in an inbox, get individual messages, send new emails, and auto-extract verification codes.

Message Object

FieldTypeDescription
iduuidUnique message identifier
inbox_iduuidParent inbox ID
thread_iduuid?Thread ID (if part of a conversation)
directionstring"inbound" or "outbound"
fromstringSender email address
tostringRecipient email address
subjectstringEmail subject line
body_textstringPlain text body
body_htmlstringHTML body
created_attimestampWhen the message was received/sent
GET/api/v1/inboxes/{id}/messagesAPI Key

List Messages

List all messages in an inbox, ordered by most recent first.

Path Parameters

iduuid

Inbox ID

cURL
curl https://api.agentemail.email/api/v1/inboxes/{id}/messages \
  -H "X-API-Key: ak_your_key"

Response

{
  "success": true,
  "data": [{
    "id": "msg-uuid...",
    "direction": "inbound",
    "from": "noreply@example.com",
    "subject": "Verify your account",
    "body_text": "Your code is 847293...",
    "created_at": "2026-03-27T15:30:00Z"
  }]
}
GET/api/v1/inboxes/{id}/messages/latestAPI Key

Get Latest Message

Get the most recently received message in an inbox.

Path Parameters

iduuid

Inbox ID

cURL
curl https://api.agentemail.email/api/v1/inboxes/{id}/messages/latest \
  -H "X-API-Key: ak_your_key"
GET/api/v1/inboxes/{id}/messages/codeAPI Key

Extract Verification Code

Auto-extract a verification code from the latest email. Parses common formats like 6-digit codes, OTPs, and confirmation links.

Path Parameters

iduuid

Inbox ID

cURL
curl https://api.agentemail.email/api/v1/inboxes/{id}/messages/code \
  -H "X-API-Key: ak_your_key"

Response

{
  "success": true,
  "code": "847293",
  "text": "Your verification code is 847293. It expires in 10 minutes."
}
GET/api/v1/inboxes/{id}/messages/{mid}API Key

Get Message

Get a specific message by ID, including full HTML body.

Path Parameters

iduuid

Inbox ID

miduuid

Message ID

cURL
curl https://api.agentemail.email/api/v1/inboxes/{id}/messages/{mid} \
  -H "X-API-Key: ak_your_key"
POST/api/v1/inboxes/{id}/messagesAPI Key

Send Message

Send an email from a persistent inbox. Supports plain text and HTML content.

Path Parameters

iduuid

Inbox ID (must be persistent)

Request Body

tostring*

Recipient email address

subjectstring*

Email subject line

bodystring*

Plain text body

htmlstring

HTML body (optional)

cURL
curl -X POST https://api.agentemail.email/api/v1/inboxes/{id}/messages \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{"to":"user@example.com","subject":"Hello","body":"Hi from my agent!"}'

Response

{
  "success": true,
  "data": {
    "id": "msg-uuid...",
    "direction": "outbound",
    "to": "user@example.com",
    "subject": "Hello"
  }
}
DELETE/api/v1/inboxes/{id}/messages/{mid}API Key

Delete Message

Permanently delete a specific message.

Path Parameters

iduuid

Inbox ID

miduuid

Message ID

cURL
curl -X DELETE https://api.agentemail.email/api/v1/inboxes/{id}/messages/{mid} \
  -H "X-API-Key: ak_your_key"