> For the complete documentation index, see [llms.txt](https://docs.mailtrap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailtrap.io/developers/inbound/messages/get-a-message.md).

# Get a message

Returns a single inbound message together with URLs for the raw `.eml` file and for each attachment, plus the decoded HTML and plain-text bodies. URLs expire after one hour.

```json
{"openapi":"3.1.0","info":{"title":"Inbound","version":"2.0.0"},"tags":[{"name":"messages","description":"Inbound messages are the emails delivered to an inbox. Use these\nendpoints to page through recent messages, fetch the full body and\nattachments, reply to or forward a message, or delete one you no longer\nneed.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"API token in Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication"}},"parameters":{"inbox_id":{"name":"inbox_id","in":"path","required":true,"description":"Inbound inbox ID","schema":{"type":"integer"}},"message_id":{"name":"id","in":"path","required":true,"description":"Inbound message ID","schema":{"type":"string"}}},"schemas":{"MessageDetails":{"allOf":[{"$ref":"#/components/schemas/Message"},{"type":"object","properties":{"attachments":{"type":"array","items":{"$ref":"#/components/schemas/AttachmentWithDownloadUrl"}},"raw_message_url":{"type":["string","null"],"format":"uri","description":"URL to download the raw `.eml` file. Expires after one hour.\n"},"raw_message_expires_at":{"type":["string","null"],"format":"date-time"},"html_body":{"type":["string","null"],"description":"Decoded HTML body. `null` when the message has no HTML part."},"text_body":{"type":["string","null"],"description":"Decoded plain-text body. `null` when the message has no text part."}}}]},"Message":{"type":"object","properties":{"id":{"type":"string","description":"Mailtrap object ID for the message (not the `Message-ID` header value)."},"inbox_id":{"type":"integer"},"from":{"type":["string","null"]},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"reply_to":{"type":["string","null"]},"subject":{"type":["string","null"]},"rfc_message_id":{"type":["string","null"],"description":"Value of the original `Message-ID` header."},"in_reply_to":{"type":["string","null"]},"references":{"type":"array","items":{"type":"string"}},"headers":{"type":["object","null"],"additionalProperties":{"type":"string"},"description":"Selected headers from the original message, lowercased.\n"},"size":{"type":["integer","null"],"description":"Total size of the raw message in bytes."},"html_size":{"type":["integer","null"],"description":"Size of the HTML body in bytes. Zero if the message has no HTML part."},"text_size":{"type":["integer","null"],"description":"Size of the plain-text body in bytes. Zero if the message has no text part."},"received_at":{"type":"string","format":"date-time"},"thread_id":{"type":["string","null"],"description":"ID of the thread this message belongs to. Use it with the Threads\nendpoints to fetch the full conversation.\n"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}},"forwards":{"type":"array","description":"Outcome of each forward-rule destination this message was\nforwarded to. An empty array when no forward rule matched.\n","items":{"$ref":"#/components/schemas/ForwardOutcome"}}}},"Attachment":{"type":"object","properties":{"attachment_id":{"type":"string"},"size":{"type":["integer","null"]},"filename":{"type":["string","null"]},"content_type":{"type":["string","null"]},"content_disposition":{"type":["string","null"],"enum":["attachment","inline",null]},"content_id":{"type":["string","null"],"description":"`Content-ID` header value, used to reference inline attachments\nfrom the HTML body.\n"}}},"ForwardOutcome":{"type":"object","required":["rule_id","rule_name","destination","status","reason","message_id"],"properties":{"rule_id":{"type":"integer","description":"ID of the forward rule that selected this destination."},"rule_name":{"type":["string","null"],"description":"Name of the forward rule at the time of forwarding."},"destination":{"type":"string","description":"Address the message was forwarded to."},"status":{"type":"string","enum":["forwarded","rejected"],"description":"`forwarded` when the copy was accepted for sending; `rejected`\nwhen it could not be sent.\n"},"reason":{"type":["string","null"],"description":"Why the forward was rejected, e.g. `loop_prevention` or\n`fetch_failed`, or the rejection reason returned by the Email API.\n`null` when `status` is `forwarded`.\n"},"message_id":{"type":["string","null"],"description":"Email API UUID of the forwarded (sent) message. `null` when\n`status` is `rejected`.\n"}}},"AttachmentWithDownloadUrl":{"allOf":[{"$ref":"#/components/schemas/Attachment"},{"type":"object","properties":{"download_url":{"type":["string","null"],"format":"uri","description":"URL to download the attachment. Expires after one hour."},"download_url_expires_at":{"type":["string","null"],"format":"date-time"}}}]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}}},"ForbiddenError":{"type":"object","properties":{"errors":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden. The token lacks the permission required for this operation\n(`Access forbidden`), has no access to the account\n(`Account access forbidden`), or Email API/SMTP is not enabled for the\norganization (empty response body).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"NotFound":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/inbound/inboxes/{inbox_id}/messages/{id}":{"get":{"operationId":"getInboundMessage","summary":"Get a message","description":"Returns a single inbound message together with URLs for the\nraw `.eml` file and for each attachment, plus the decoded HTML and\nplain-text bodies. URLs expire after one hour.\n","tags":["messages"],"parameters":[{"$ref":"#/components/parameters/inbox_id"},{"$ref":"#/components/parameters/message_id"}],"responses":{"200":{"description":"Message details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetails"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mailtrap.io/developers/inbound/messages/get-a-message.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
