Inbound emails

List received emails

GET/api/v1/email/received

GET /email/received
curl -X GET 'https://www.unitpost.com/api/v1/email/received' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "received_email",
      "id": "id_123",
      "from": "you@yourdomain.com",
      "from_name": "string",
      "to": [
        "customer@example.com"
      ],
      "cc": [
        "string"
      ],
      "bcc": [
        "string"
      ],
      "message_id": "message_123",
      "subject": "Welcome to Acme",
      "spam_verdict": "string",
      "virus_verdict": "string",
      "spf_verdict": "string",
      "dkim_verdict": "string",
      "dmarc_verdict": "string",
      "size": 1,
      "received_at": "2026-01-01T00:00:00.000Z",
      "created_at": "2026-01-01T00:00:00.000Z",
      "thread_id": "thread_123",
      "reply_to": [
        "string"
      ],
      "attachment_count": 1
    }
  ]
}

Retrieve a list of inbound emails received on your receiving-enabled domains, newest-first and cursor-paginated. Rows are summaries (sender, subject, timestamps) without bodies — use a message's id with Retrieve a received email to read the full content and attachment metadata. Narrow the list with to (one address in the To or Cc header), thread_id (one conversation) and a created_after / created_before range. Requires the emails:read capability.

Parameters7 fields
FieldTypeDescription
limitinteger · queryMax rows to return (default 20, max 100).
afterstring · queryReturn rows after this id (forward paging).
beforestring · queryReturn rows before this id (backward paging).
tostring · queryOnly mail with this address in its To or Cc header, in any case. Envelope recipients aren't stored, so a Bcc copy or a forward to one of your addresses is matched by its headers only.
thread_idstring · queryOnly the messages of this conversation (`thr_…`), as `thread_id` on a received email and on the `email.received` webhook.
created_afterstring · queryOnly mail whose `created_at` is at/after this ISO 8601 time (with `Z` or an offset).
created_beforestring · queryOnly mail whose `created_at` is at/before this ISO 8601 time (with `Z` or an offset).
Response · 200 fields20 fields
FieldTypeDescription
objectrequiredstring—
idrequiredstring—
fromrequiredstring—
from_namerequiredstring | null—
torequiredstring[]—
ccrequiredstring[]—
bccrequiredstring[]—
message_idrequiredstring | null—
subjectrequiredstring | null—
spam_verdictrequiredstring | null—
virus_verdictrequiredstring | null—
spf_verdictrequiredstring | null—
dkim_verdictrequiredstring | null—
dmarc_verdictrequiredstring | null—
sizerequirednumber—
received_atrequiredstring—
created_atrequiredstring—
thread_idstring | nullThe conversation (`thr_…`); null until the message is threaded.
reply_tostring[]Reply-To addresses: answer these before `from` when present.
attachment_countrequirednumber—
200401403422

Retrieve a received email

GET/api/v1/email/received/{id}

GET /email/received/{id}
curl -X GET 'https://www.unitpost.com/api/v1/email/received/email_123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "received_email",
  "id": "id_123",
  "from": "you@yourdomain.com",
  "from_name": "string",
  "to": [
    "customer@example.com"
  ],
  "cc": [
    "string"
  ],
  "bcc": [
    "string"
  ],
  "message_id": "message_123",
  "subject": "Welcome to Acme",
  "text": "string",
  "html": "string",
  "spam_verdict": "string",
  "virus_verdict": "string",
  "spf_verdict": "string",
  "dkim_verdict": "string",
  "dmarc_verdict": "string",
  "size": 1,
  "attachments": [
    {
      "object": "received_attachment",
      "id": "id_123",
      "filename": "string",
      "content_type": "string",
      "content_disposition": "string",
      "content_id": "content_123",
      "size": 1
    }
  ],
  "received_at": "2026-01-01T00:00:00.000Z",
  "created_at": "2026-01-01T00:00:00.000Z",
  "thread_id": "thread_123",
  "reply_to": [
    "string"
  ],
  "headers": {},
  "sent_by_us": false
}

Retrieve a full inbound message by id, including its HTML and text bodies plus metadata for every attachment. Attachment bytes aren't inlined — download each one via Get an attachment download URL. Browse your inbound mail with List received emails. Requires the emails:read capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path—
Response · 200 fields24 fields
FieldTypeDescription
objectrequiredstring—
idrequiredstring—
fromrequiredstring—
from_namerequiredstring | null—
torequiredstring[]—
ccrequiredstring[]—
bccrequiredstring[]—
message_idrequiredstring | null—
subjectrequiredstring | null—
textrequiredstring | null—
htmlrequiredstring | null—
spam_verdictrequiredstring | null—
virus_verdictrequiredstring | null—
spf_verdictrequiredstring | null—
dkim_verdictrequiredstring | null—
dmarc_verdictrequiredstring | null—
sizerequirednumber—
attachmentsrequiredobject[]—
received_atrequiredstring—
created_atrequiredstring—
thread_idstring | nullThe conversation (`thr_…`); null until the message is threaded.
reply_tostring[]Reply-To addresses: answer these before `from` when present.
headersobjectThe headers we keep, by lower-case name: `date`, `in-reply-to`, `references`, `reply-to`, `return-path`, `list-unsubscribe` (when present).
sent_by_usbooleanA copy of one of your own sends that came back to your receiving domain. Its `text` and `html` are null: sent bodies aren't on the API (they can carry a sign-in or reset link).
200401403404

Get an attachment download URL

GET/api/v1/email/received/{id}/attachments/{attachmentId}

GET /email/received/{id}/attachments/{attachmentId}
curl -X GET 'https://www.unitpost.com/api/v1/email/received/email_123/attachments/att_789' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "received_attachment_url",
  "url": "https://example.com",
  "expires_at": "2026-01-01T00:00:00.000Z"
}

Get a short-lived, signed URL for downloading one inbound attachment's bytes. Fetch the URL and download promptly — it expires quickly (the expiry is included in the response). Find attachment ids on the message via Retrieve a received email. A copy of an email you sent (sent_by_us) is a 403, like its body: what you send isn't readable through the API. Requires the emails:read capability.

Parameters2 fields
FieldTypeDescription
idrequiredstring · path—
attachmentIdrequiredstring · path—
Response · 200 fields3 fields
FieldTypeDescription
objectrequiredenumreceived_attachment_url—
urlrequiredstringA signed, expiring URL to download the attachment bytes.
expires_atrequiredstringISO 8601 expiry of the signed URL (~5 minutes out).
200401403404503

Get a received email's original message

GET/api/v1/email/received/{id}/raw

GET /email/received/{id}/raw
curl -X GET 'https://www.unitpost.com/api/v1/email/received/email_123/raw' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "received_email_raw",
  "url": "https://example.com",
  "expires_at": "2026-01-01T00:00:00.000Z",
  "size_bytes": 1
}

Get a short-lived, signed URL for the received message's full original MIME (.eml), headers, every part and attachment included. A body over 256 KB isn't inlined on Retrieve a received email, so this is how to read it. Download promptly: the URL expires in about 5 minutes. Stored messages are kept 30 days. A copy of an email you sent (sent_by_us) is a 403. Requires the emails:read capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path—
Response · 200 fields4 fields
FieldTypeDescription
objectrequiredenumreceived_email_raw—
urlrequiredstringA signed, expiring URL to download the original message (.eml, RFC 5322).
expires_atrequiredstringISO 8601 expiry of the signed URL (~5 minutes out).
size_bytesrequiredintegerThe message's size in bytes.
200401403404422503

Search docs and guides

Search the docs and product guides.