Skip to content

Document Inbound Email v2 API#47

Merged
mklocek merged 7 commits into
mainfrom
MT-23095-update-api-docs-for-inbound-inbox-v-2-release-gated
Jul 21, 2026
Merged

Document Inbound Email v2 API#47
mklocek merged 7 commits into
mainfrom
MT-23095-update-api-docs-for-inbound-inbox-v-2-release-gated

Conversation

@mklocek

@mklocek mklocek commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Adds and updates the public API reference for Inbound Email v2.

Inbound

  • Threads — list, get, and delete conversation threads. Listing is
    cursor-paginated (data / total_count / last_id); getting a thread
    returns it with its messages embedded, each tagged with a visibility_status
    (available or placeholder).
  • Reply, reply-all, and forward — send a reply or forward an inbound
    message, with the request and response schemas and validation errors.
  • Threading fieldsthread_id on inbound messages and message_group_id
    on thread messages.
  • RFC Message-ID — exposed as rfc_message_id on message and thread-message
    responses.
  • Custom-domain inboxes — create a catch-all inbox on a verified sending
    domain via domain_id; its address is returned as *@your-domain.com.

Email sending

  • Sending domains expose inbound_enabled and inbound_verified; when inbound
    is enabled, dns_records includes an MX record (key: inbound_mx) to
    publish for inbound mail.
  • Email Log entries expose the threading headers rfc_message_id,
    in_reply_to, and references.
  • Correct the sending-domain dns_records example — drop the stale spf entry
    (SPF is set on the HELO domain, not per sending domain).

Summary by CodeRabbit

  • New Features
    • Added domain inbound controls with inbound enabled/verified status, including updated inbound MX verification behavior and examples.
    • Introduced inbound message actions: reply, reply-all, and forward.
    • Added inbox conversation threading support (list, view, and delete threads) with thread identifiers.
    • Extended inbound and sending email data with RFC 5322 header fields (Message-ID, In-Reply-To, References).
  • Documentation
    • Updated API examples for inbox creation, including custom-domain catch-all inbox addressing differences.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mklocek, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b5e8e7c3-a8d6-46ad-b5aa-a45cde478d7c

📥 Commits

Reviewing files that changed from the base of the PR and between dd338f1 and 864e676.

📒 Files selected for processing (2)
  • specs/email-sending.openapi.yml
  • specs/inbound.openapi.yml
📝 Walkthrough

Walkthrough

The OpenAPI specifications add inbound domain settings, custom-domain inbox contracts, RFC email metadata, reply and forwarding operations, and thread management endpoints with supporting schemas and response examples.

Changes

Inbound email API

Layer / File(s) Summary
Inbound domain controls
specs/email-sending.openapi.yml
Domain schemas and update examples expose inbound enablement and MX verification state.
Inbox and message contract
specs/inbound.openapi.yml, specs/email-sending.openapi.yml
Inbox creation documents hosted and custom-domain modes; message and sending schemas include RFC identifiers, references, and thread linkage.
Reply, forwarding, and send contracts
specs/inbound.openapi.yml
Reply, reply-all, and forward operations use new payload, result, error, and response schemas.
Thread operations
specs/inbound.openapi.yml
Thread listing, retrieval, deletion, pagination, and message visibility contracts are added.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • mailtrap/mailtrap-openapi#38: Both PRs update inbound API documentation, including RFC message identifiers and inbound message or thread endpoints.

Suggested reviewers: leonid-shevtsov, vladimirtaytor

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant InboundAPI
  participant ThreadStore
  participant SendingAPI
  Client->>InboundAPI: List inbound messages
  InboundAPI->>ThreadStore: Resolve thread_id
  ThreadStore-->>InboundAPI: Return thread messages
  Client->>InboundAPI: Reply, reply_all, or forward
  InboundAPI->>SendingAPI: Submit SendMessageInput
  SendingAPI-->>InboundAPI: Return send result or error
  InboundAPI-->>Client: Return action response
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is relevant, but it does not follow the required template and omits Motivation, How to test, and Images and GIFs sections. Add the required Motivation, Changes, How to test, and Images and GIFs sections in the repo template format, with basic test steps and before/after links or N/A.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: documenting the Inbound Email v2 API.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mklocek

mklocek commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@specs/email-sending.openapi.yml`:
- Around line 2955-2962: Update both RFC field definitions in
specs/email-sending.openapi.yml at lines 2955-2962 and 3052-3059: replace
nullable: true with the OpenAPI 3.1 union type [string, 'null'] for
rfc_message_id and in_reply_to, preserving their existing descriptions and RFC
header semantics.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d883f3b0-a254-4ffb-9263-661ad5dd91de

📥 Commits

Reviewing files that changed from the base of the PR and between fd7b929 and a619732.

📒 Files selected for processing (2)
  • specs/email-sending.openapi.yml
  • specs/inbound.openapi.yml

Comment thread specs/email-sending.openapi.yml
@mklocek
mklocek force-pushed the MT-23095-update-api-docs-for-inbound-inbox-v-2-release-gated branch from a619732 to 4678030 Compare July 20, 2026 10:54
@mklocek
mklocek requested a review from piobeny July 20, 2026 10:55
@mklocek
mklocek force-pushed the MT-23095-update-api-docs-for-inbound-inbox-v-2-release-gated branch from 4678030 to 2459ef1 Compare July 20, 2026 13:04
@mklocek
mklocek requested a review from leonid-shevtsov July 20, 2026 13:14
@mklocek
mklocek marked this pull request as ready for review July 21, 2026 08:36

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
specs/inbound.openapi.yml (1)

1322-1329: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the official product name instead of "Email Sending API".

"Email Sending API" is not the sanctioned product term. Replace with Email API/SMTP (or the shortened Email API) throughout the new content — occurrences at Lines 1329, 1366, 1383, 1395-1397, 1518, and 1717-1719.

As per coding guidelines: "Use official product naming: 'Email API/SMTP' (can shorten to 'Email API' or 'API/SMTP')".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@specs/inbound.openapi.yml` around lines 1322 - 1329, Update the descriptions
and documentation around SendMessageInput and the other referenced new content
to replace every occurrence of “Email Sending API” with the sanctioned product
name “Email API/SMTP” or “Email API,” preserving the existing meaning and
address shape documentation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@specs/inbound.openapi.yml`:
- Around line 621-628: Update the descriptions near the reply-to-message
references to replace each relative `#operation/replyToInboundMessage` anchor
with the corresponding absolute `docs.mailtrap.io` documentation URL, including
both occurrences while preserving the surrounding text.

---

Nitpick comments:
In `@specs/inbound.openapi.yml`:
- Around line 1322-1329: Update the descriptions and documentation around
SendMessageInput and the other referenced new content to replace every
occurrence of “Email Sending API” with the sanctioned product name “Email
API/SMTP” or “Email API,” preserving the existing meaning and address shape
documentation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 595d3dc7-ac2a-4a83-9fa5-d9caaf681940

📥 Commits

Reviewing files that changed from the base of the PR and between a619732 and 2459ef1.

📒 Files selected for processing (2)
  • specs/email-sending.openapi.yml
  • specs/inbound.openapi.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • specs/email-sending.openapi.yml

Comment thread specs/inbound.openapi.yml
mklocek added 4 commits July 21, 2026 15:10
List, show, and delete. The list response uses the same cursor envelope as inbound messages ({ data, total_count, last_id }); the show response returns the thread at the root.
thread_id links an inbound message to its thread; message_group_id groups a thread message with the reply it belongs to.
Exposes the message's RFC 5322 Message-ID header as rfc_message_id on message and thread-message responses, avoiding a name collision with the Email Log message_id (the message UUID).
@mklocek
mklocek force-pushed the MT-23095-update-api-docs-for-inbound-inbox-v-2-release-gated branch from 2459ef1 to dd338f1 Compare July 21, 2026 13:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
specs/inbound.openapi.yml (1)

593-600: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Add the full x-codeSamples language set to the new operations. The new inbound operations ship only a cURL sample; the guideline requires x-codeSamples in the priority order cURL → Node.js → PHP → Python → Ruby → .NET (C#) → Java, using official Mailtrap SDKs (with a comment noting any SDK gaps). Keep using YOUR_API_KEY placeholders in every added sample.

  • specs/inbound.openapi.yml#L593-L600: add Node.js/PHP/Python/Ruby/.NET/Java samples for replyToInboundMessage.
  • specs/inbound.openapi.yml#L642-L649: add the remaining language samples for replyAllToInboundMessage.
  • specs/inbound.openapi.yml#L697-L704: add the remaining language samples for forwardInboundMessage.
  • specs/inbound.openapi.yml#L750-L755: add the remaining language samples for listInboundThreads.
  • specs/inbound.openapi.yml#L820-L825: add the remaining language samples for getInboundThread.
  • specs/inbound.openapi.yml#L919-L924: add the remaining language samples for deleteInboundThread.

As per coding guidelines: "Include code samples in OpenAPI specs in this priority order: cURL (shell), Node.js (JavaScript), PHP, Python, Ruby, .NET (C#), Java" and "Use official Mailtrap SDKs for language-specific code examples in x-codeSamples."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@specs/inbound.openapi.yml` around lines 593 - 600, Add the complete
x-codeSamples language set in the required order—cURL, Node.js, PHP, Python,
Ruby, .NET (C#), and Java—to replyToInboundMessage, replyAllToInboundMessage,
forwardInboundMessage, listInboundThreads, getInboundThread, and
deleteInboundThread in specs/inbound.openapi.yml at ranges 593-600, 642-649,
697-704, 750-755, 820-825, and 919-924 respectively. Use official Mailtrap SDKs
for each language, document any SDK gaps in comments, and retain YOUR_API_KEY
placeholders in every sample.

Sources: Coding guidelines, Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@specs/inbound.openapi.yml`:
- Around line 593-600: Add the complete x-codeSamples language set in the
required order—cURL, Node.js, PHP, Python, Ruby, .NET (C#), and Java—to
replyToInboundMessage, replyAllToInboundMessage, forwardInboundMessage,
listInboundThreads, getInboundThread, and deleteInboundThread in
specs/inbound.openapi.yml at ranges 593-600, 642-649, 697-704, 750-755, 820-825,
and 919-924 respectively. Use official Mailtrap SDKs for each language, document
any SDK gaps in comments, and retain YOUR_API_KEY placeholders in every sample.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fee73268-6760-44ed-a53f-e07a2934c772

📥 Commits

Reviewing files that changed from the base of the PR and between 2459ef1 and dd338f1.

📒 Files selected for processing (2)
  • specs/email-sending.openapi.yml
  • specs/inbound.openapi.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • specs/email-sending.openapi.yml

mklocek added 3 commits July 21, 2026 15:52
Adds inbound_enabled/inbound_verified on the sending domain and the domain_id/catch-all inbox flow (InboxCreateInput, *@your-domain.com addresses).
Adds rfc_message_id, in_reply_to, and references to the Email Log message and list schemas.
SPF is set on the HELO domain, not per sending domain, so the domains API's dns_records never includes an SPF entry.
@mklocek
mklocek force-pushed the MT-23095-update-api-docs-for-inbound-inbox-v-2-release-gated branch from dd338f1 to 864e676 Compare July 21, 2026 13:55
@mklocek
mklocek merged commit b2eacd2 into main Jul 21, 2026
1 of 2 checks passed
@mklocek
mklocek deleted the MT-23095-update-api-docs-for-inbound-inbox-v-2-release-gated branch July 21, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants