Skip to main content
GET
/
api
/
e2
/
mail
/
threads
/
{id}
JavaScript
import Inbound from 'inboundemail';

const client = new Inbound({
  apiKey: process.env['INBOUND_API_KEY'], // This is the default and can be omitted
});

const mail = await client.mail.retrieve('id');

console.log(mail.messages);
{
  "thread": {
    "id": "<string>",
    "root_message_id": "<string>",
    "participant_emails": [
      "<string>"
    ],
    "participant_names": [
      "<string>"
    ],
    "message_count": 123,
    "last_message_at": "<string>",
    "created_at": "<string>",
    "updated_at": "<string>",
    "normalized_subject": "<string>"
  },
  "messages": [
    {
      "id": "<string>",
      "type": "inbound",
      "thread_position": 123,
      "from": "<string>",
      "to": [
        "<string>"
      ],
      "cc": [
        "<string>"
      ],
      "bcc": [
        "<string>"
      ],
      "is_read": true,
      "has_attachments": true,
      "attachments": [
        {
          "filename": "<string>",
          "contentType": "<string>",
          "size": 123,
          "contentId": "<string>",
          "content": "<string>"
        }
      ],
      "references": [
        "<string>"
      ],
      "headers": "<unknown>",
      "tags": [
        {
          "name": "<string>",
          "value": "<string>"
        }
      ],
      "message_id": "<string>",
      "subject": "<string>",
      "text_body": "<string>",
      "html_body": "<string>",
      "from_name": "<string>",
      "from_address": "<string>",
      "date": "<string>",
      "received_at": "<string>",
      "sent_at": "<string>",
      "read_at": "<string>",
      "in_reply_to": "<string>",
      "status": "<string>",
      "failure_reason": "<string>"
    }
  ],
  "total_count": 123
}

Authorizations

Authorization
string
header
required

Your Inbound API key. Include it in the Authorization header as: Bearer

Path Parameters

id
string
required

The unique thread ID to retrieve

Response

Response for status 200

thread
object
required
messages
object[]
required

Array of all messages in the thread, sorted by thread position (chronological)

total_count
number
required

Total number of messages returned