Skip to content

Replace Sending Domains API with Domains API#37

Merged
i7an merged 3 commits into
mainfrom
domains-api
May 15, 2026
Merged

Replace Sending Domains API with Domains API#37
i7an merged 3 commits into
mainfrom
domains-api

Conversation

@i7an
Copy link
Copy Markdown
Contributor

@i7an i7an commented May 5, 2026

Motivation

Replace Sending Domains API with Domains API

Changes

  • Replaced Sending Domains API with Domains API

How to test

  • Test all new api endpoints

Summary by CodeRabbit

  • Refactor
    • Domain management API endpoints have been restructured and renamed for improved naming consistency across the platform.
    • Query parameters and response fields updated for domain and email filtering operations.
    • Code integration updates required for affected API calls.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

📝 Walkthrough

Walkthrough

This PR performs a contract-wide rename of domain terminology in the email-sending OpenAPI specification, changing all references from "sending domains" to "domains" across paths, operationIds, parameters, schemas, and filters. The update affects domain management endpoints, stats filtering, email logs, and related component definitions.

Changes

Domain Terminology Rename

Layer / File(s) Summary
API documentation and metadata
specs/email-sending.openapi.yml
Top-level description, server info, and tag metadata updated from "sending domains" to "domains" wording.
Domain management endpoints
specs/email-sending.openapi.yml
Domain CRUD operations (create, list, get, delete, update) moved from /sending_domains to /domains paths with operationId and parameter renames; includes company-info sub-endpoints and setup-instructions endpoint, with request/response schema references updated.
Stats endpoints and filtering updates
specs/email-sending.openapi.yml
All stats endpoints (by domain, category, email service provider, date) updated to use DomainIDsQueryFilter instead of SendingDomainIDsQueryFilter; response payloads rename sending_domain_id to domain_id; suppression endpoint description updated to reference domain IDs.
Email logs endpoint and message schema
specs/email-sending.openapi.yml
Email logs listing endpoint updated to filter using domain_id instead of sending_domain_id in request samples; get-message endpoint description and message schema payloads use domain_id field.
Component definitions and schemas
specs/email-sending.openapi.yml
Component parameters, query filters, and model schemas updated throughout: new domain_id path parameter and DomainIDsQueryFilter introduced; model schema renamed from SendingDomain to Domain with compliance-status documentation updated; request/response schemas renamed (UpdateDomainRequest, DomainResponse, DomainsResponse); email-log filters and message payloads reference new domain_id field and FilterDomainId.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • mailtrap/mailtrap-openapi#26: The main PR's contract-wide rename from sending_domains/{sending_domain_id} to domains/{domain_id} (including company_info endpoints and related request/response schema names) directly overlaps the newly added endpoints in this PR.
  • mailtrap/mailtrap-openapi#25: Both PRs modify the compliance_status schema in specs/email-sending.openapi.ymlUpdate compliance_status value descriptions #25 expands/updates the compliance_status enum + description, while the main PR updates the corresponding documentation as part of renaming SendingDomainDomain.
  • mailtrap/mailtrap-openapi#29: Both PRs modify domain endpoints in specs/email-sending.openapi.yml: the main PR renames sending_domainsdomains and sending_domain_iddomain_id, while this PR also restructures those same paths.

Suggested reviewers

  • IgorDobryn
  • VladimirTaytor
  • DagonWat
  • Ma-Anna

Poem

🐰 From sending to domain, the terms leap and bound,
Paths renamed with precision, consistency found,
Schemas and filters all march in a line,
Contract evolution, terminology—divine!
One hop through the specs, the refactor is sound. 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is minimal and lacks comprehensive detail. While it follows the template structure, the 'Changes' section only restates the title, and 'How to test' provides minimal guidance without specific endpoint names or testing scenarios. Expand the Changes section with specific endpoint renames (e.g., /sending_domains → /domains, operationId changes) and provide detailed testing steps for the API endpoints.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: replacing the Sending Domains API with the Domains API, which matches the primary objective of the changeset.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch domains-api

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@i7an i7an marked this pull request as ready for review May 14, 2026 15:27
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
specs/email-sending.openapi.yml (1)

72-181: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use environment variables for API keys in the non-shell samples.

Several changed Python, .NET, and Java examples still pass "YOUR_API_KEY" directly. That contradicts the repo guideline and encourages insecure copy-paste usage in the public docs. Please switch those samples to os.environ, Environment.GetEnvironmentVariable(...), System.getenv(...), etc.

As per coding guidelines "Use environment variables for API keys in code samples (e.g., process.env.MAILTRAP_API_KEY)".

Also applies to: 222-321, 338-435, 455-548, 621-741

🤖 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/email-sending.openapi.yml` around lines 72 - 181, Replace hard-coded
API key literals in the code samples with environment variable lookups: update
the Python client instantiation (mt.MailtrapClient token="YOUR_API_KEY") to use
os.environ['MAILTRAP_API_KEY'] (or os.getenv), change the .NET
MailtrapClientFactory("YOUR_API_KEY") usage to
Environment.GetEnvironmentVariable("MAILTRAP_API_KEY"), and change the Java
MailtrapConfig.Builder().token("YOUR_API_KEY") call to use
System.getenv("MAILTRAP_API_KEY"); apply the same pattern to any other samples
in the diff that pass "YOUR_API_KEY" directly so all examples read the API token
from environment variables instead of hard-coded strings.
🤖 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 58-69: The API spec renames /sending_domains to
/api/accounts/{account_id}/domains and replaces operationId and identifiers
(e.g., old operationId names, component/schema names, and sending_domain_id →
domain_id), which is a breaking contract change; restore backward-compatible
aliases by keeping the original path (/sending_domains) as a deprecated endpoint
that forwards to the new /api/accounts/{account_id}/domains, add the old
operationId values as x-deprecated or duplicate operations pointing to the new
createDomain operationId, retain the old schema/component names as deprecated
$ref aliases mapping to the new components, and add sending_domain_id as a
deprecated property that references domain_id (or include both properties with
deprecation notes) so generated clients continue to work for one release or add
explicit versioning notes in the spec to indicate the breaking change.
- Around line 2192-2196: The schema description still uses the old visible label
"Sending Domain Setup" in the `unverified_dns` bullet; update the visible link
text to use the new public term (e.g., change "Sending Domain Setup" to "Domain
Setup" or "Domains Setup") so the user-facing label matches the renamed surface
"domains" while keeping the existing URL unchanged; locate the string "Sending
Domain Setup" in the `unverified_dns` list item and replace it accordingly.

---

Outside diff comments:
In `@specs/email-sending.openapi.yml`:
- Around line 72-181: Replace hard-coded API key literals in the code samples
with environment variable lookups: update the Python client instantiation
(mt.MailtrapClient token="YOUR_API_KEY") to use os.environ['MAILTRAP_API_KEY']
(or os.getenv), change the .NET MailtrapClientFactory("YOUR_API_KEY") usage to
Environment.GetEnvironmentVariable("MAILTRAP_API_KEY"), and change the Java
MailtrapConfig.Builder().token("YOUR_API_KEY") call to use
System.getenv("MAILTRAP_API_KEY"); apply the same pattern to any other samples
in the diff that pass "YOUR_API_KEY" directly so all examples read the API token
from environment variables instead of hard-coded strings.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: c1468f1e-09d7-4484-a804-68470ee7f99f

📥 Commits

Reviewing files that changed from the base of the PR and between d05e08b and 9cbbe4f.

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

Comment on lines +58 to +69
/api/accounts/{account_id}/domains:
post:
summary: Create sending domain
summary: Create domain
description: |
Create a sending domain for email authentication. After creation, verify the domain by adding DNS records.
Create a domain for email authentication. After creation, verify the domain by adding DNS records.

**Process:**
1. Create the domain
2. Add DNS records (SPF, DKIM, DMARC)
3. Verify the records
4. Start sending emails
operationId: createSendingDomain
operationId: createDomain
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Treat this rename as a breaking contract change.

Removing /sending_domains, renaming operationIds, schema/component names, and replacing sending_domain_id with domain_id will break generated clients and any consumers pinned to the previous spec surface. Please either keep deprecated aliases for one release or make the versioning/migration step explicit before merging.

Also applies to: 217-219, 331-335, 450-452, 563-566, 614-618, 772-777, 799-804, 866-871, 2042-2049, 2097-2109, 2174-2335, 3569-3596

🤖 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/email-sending.openapi.yml` around lines 58 - 69, The API spec renames
/sending_domains to /api/accounts/{account_id}/domains and replaces operationId
and identifiers (e.g., old operationId names, component/schema names, and
sending_domain_id → domain_id), which is a breaking contract change; restore
backward-compatible aliases by keeping the original path (/sending_domains) as a
deprecated endpoint that forwards to the new /api/accounts/{account_id}/domains,
add the old operationId values as x-deprecated or duplicate operations pointing
to the new createDomain operationId, retain the old schema/component names as
deprecated $ref aliases mapping to the new components, and add sending_domain_id
as a deprecated property that references domain_id (or include both properties
with deprecation notes) so generated clients continue to work for one release or
add explicit versioning notes in the spec to indicate the breaking change.

Comment on lines +2192 to +2196
- `unverified_dns` - Domain DNS records have not been verified yet. Open your domain on the [Domains](https://mailtrap.io/domains) page and follow the [Sending Domain Setup](https://docs.mailtrap.io/email-api-smtp/setup/sending-domain) guide.
- `missing_company_info` - Account is missing required company information. Go to [Company Information](https://mailtrap.io/settings/account?current_tab=company_information) and fill in the required details.
- `under_review` - Domain is undergoing automatic compliance review. No action needed — typically completes within 2 minutes.
- `awaiting_questionnaire` - Automatic review required additional information. Open your domain on the [Sending Domains](https://mailtrap.io/domains) page and fill in the compliance questionnaire.
- `awaiting_card_verification` - Compliance questionnaire was submitted but credit card identity verification is still needed. Open your domain on the [Sending Domains](https://mailtrap.io/domains) page and enter card details. The charged amount is refunded immediately and the card is not stored.
- `awaiting_questionnaire` - Automatic review required additional information. Open your domain on the [Domains](https://mailtrap.io/domains) page and fill in the compliance questionnaire.
- `awaiting_card_verification` - Compliance questionnaire was submitted but credit card identity verification is still needed. Open your domain on the [Domains](https://mailtrap.io/domains) page and enter card details. The charged amount is refunded immediately and the card is not stored.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the last user-facing “Sending Domain” label.

This schema description still exposes the old term even though the PR is renaming the public surface to “domains”. The URL can stay as-is if the docs slug has not moved, but the visible link text should match the new terminology.

Suggested wording
-            - `unverified_dns` - Domain DNS records have not been verified yet. Open your domain on the [Domains](https://mailtrap.io/domains) page and follow the [Sending Domain Setup](https://docs.mailtrap.io/email-api-smtp/setup/sending-domain) guide.
+            - `unverified_dns` - Domain DNS records have not been verified yet. Open your domain on the [Domains](https://mailtrap.io/domains) page and follow the [Domain Setup](https://docs.mailtrap.io/email-api-smtp/setup/sending-domain) guide.
🤖 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/email-sending.openapi.yml` around lines 2192 - 2196, The schema
description still uses the old visible label "Sending Domain Setup" in the
`unverified_dns` bullet; update the visible link text to use the new public term
(e.g., change "Sending Domain Setup" to "Domain Setup" or "Domains Setup") so
the user-facing label matches the renamed surface "domains" while keeping the
existing URL unchanged; locate the string "Sending Domain Setup" in the
`unverified_dns` list item and replace it accordingly.

@i7an i7an requested a review from VladimirTaytor May 14, 2026 16:19
[Webhooks](https://docs.mailtrap.io/email-api-smtp/advanced/webhooks).
paths:
/api/accounts/{account_id}/sending_domains:
/api/accounts/{account_id}/domains:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we remove /accounts/{account_id} ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thats in a different PR

@i7an i7an merged commit eda1527 into main May 15, 2026
2 checks passed
@i7an i7an deleted the domains-api branch May 15, 2026 07:17
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.

4 participants