Replace Sending Domains API with Domains API#37
Conversation
📝 WalkthroughWalkthroughThis 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. ChangesDomain Terminology Rename
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
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 winUse 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 toos.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
📒 Files selected for processing (1)
specs/email-sending.openapi.yml
| /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 |
There was a problem hiding this comment.
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.
| - `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. |
There was a problem hiding this comment.
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.
| [Webhooks](https://docs.mailtrap.io/email-api-smtp/advanced/webhooks). | ||
| paths: | ||
| /api/accounts/{account_id}/sending_domains: | ||
| /api/accounts/{account_id}/domains: |
There was a problem hiding this comment.
Should we remove /accounts/{account_id} ?
There was a problem hiding this comment.
Thats in a different PR
Motivation
Replace Sending Domains API with Domains API
Changes
How to test
Summary by CodeRabbit