Skip to content

Add new endpoints to the documentation#26

Open
VladimirTaytor wants to merge 1 commit intomainfrom
MT-21369-openapi-domain-setup
Open

Add new endpoints to the documentation#26
VladimirTaytor wants to merge 1 commit intomainfrom
MT-21369-openapi-domain-setup

Conversation

@VladimirTaytor
Copy link
Copy Markdown

@VladimirTaytor VladimirTaytor commented Apr 9, 2026

Motivation

Changes

- Add new endpoints to manage sending_domain settings and company_info

Summary by CodeRabbit

  • New Features
    • Added new API endpoint for updating sending domain configurations and settings
    • Introduced new API endpoints for retrieving company information associated with sending domains
    • Added new capability to modify and update company information linked to sending domains through the API
    • Enhanced overall domain management with expanded API functionality

- PATCH sending domain to change settings
- PUT / GET for company info
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

Added three new OpenAPI endpoints for managing sending domains: PATCH to update domain settings, GET and PUT operations for company information. Introduced four new schema definitions (UpdateSendingDomainRequest, CompanyInfo, CompanyInfoRequest) and one response component to support these operations.

Changes

Cohort / File(s) Summary
OpenAPI Specification Updates
specs/email-sending.openapi.yml
Added PATCH endpoint for updating sending domain settings, and GET/PUT endpoints for managing company information associated with sending domains. Introduced corresponding request/response schemas and components.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Sending domains dance with grace,
New endpoints bloom in their place,
Company info finds its way,
Patches and schemas save the day! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete, missing the Motivation section and the 'How to test' and 'Images and GIFs' sections required by the template, though the Changes section is partially filled. Complete the description by adding: a Motivation section explaining why these endpoints were added, test procedures with checkboxes, and any relevant images/GIFs following the template structure.
Title check ❓ Inconclusive The title 'Add new endpoints to the documentation' is vague and generic, using non-descriptive language that doesn't specify which endpoints or what functionality is being added. Revise the title to be more specific, such as 'Add sending domain and company info management endpoints' or 'Add PATCH/PUT/GET endpoints for domain configuration'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 MT-21369-openapi-domain-setup

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.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@specs/email-sending.openapi.yml`:
- Around line 771-818: The docs for the GET and PUT sending domain company_info
endpoints (see the GET block and the operationId updateSendingDomainCompanyInfo)
only include cURL samples—add x-codeSamples entries for the remaining languages
in the required priority order: Node.js (JavaScript), PHP, Python, Ruby, .NET
(C#), Java; for each language use the official Mailtrap SDK call that
corresponds to these endpoints (or the SDK method name if available) and show
authentication and payload for PUT (company_info object), and where an SDK does
not expose the operation include a short inline note stating the SDK limitation
and provide the equivalent generated HTTP client usage as fallback. Ensure
sample labels match existing x-codeSamples format and that PUT uses the same
company_info JSON fields shown in the cURL example.
- Around line 560-573: The new PATCH operation for the sending_domains endpoint
only includes a cURL sample under x-codeSamples, so add language-specific SDK
examples (in this priority: Node.js, PHP, Python, Ruby, .NET/C#, Java) to the
same x-codeSamples array for the PATCH
https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}
operation; for each language include an official Mailtrap SDK usage snippet that
performs the PATCH with the sending_domain JSON body (open_tracking_enabled,
click_tracking_enabled, auto_unsubscribe_link_enabled), and if any SDK lacks a
corresponding method, add a short explicit note in that language entry stating
the SDK limitation and provide the equivalent HTTP call via the SDK’s generic
request method or the GitBook-generated example.
🪄 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: 30df9ce6-91ee-4f5f-b5e3-518d94b2f912

📥 Commits

Reviewing files that changed from the base of the PR and between 8cbe777 and 7bd68db.

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

Comment on lines +560 to +573
x-codeSamples:
- lang: shell
label: 'cURL'
source: |
curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id} \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"sending_domain": {
"open_tracking_enabled": true,
"click_tracking_enabled": true,
"auto_unsubscribe_link_enabled": false
}
}'
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

Add the required SDK samples for this new PATCH operation.

This new endpoint only documents cURL, so the generated docs will be incomplete for the supported SDK surfaces. Please add Node.js, PHP, Python, Ruby, .NET, and Java samples here as well, or explicitly note any SDK limitation if one of them cannot express the call.

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; if SDK doesn't support a method, use GitBook generation or add a comment noting SDK limitations".

🧰 Tools
🪛 Betterleaks (1.1.1)

[high] 564-565: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@specs/email-sending.openapi.yml` around lines 560 - 573, The new PATCH
operation for the sending_domains endpoint only includes a cURL sample under
x-codeSamples, so add language-specific SDK examples (in this priority: Node.js,
PHP, Python, Ruby, .NET/C#, Java) to the same x-codeSamples array for the PATCH
https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}
operation; for each language include an official Mailtrap SDK usage snippet that
performs the PATCH with the sending_domain JSON body (open_tracking_enabled,
click_tracking_enabled, auto_unsubscribe_link_enabled), and if any SDK lacks a
corresponding method, add a short explicit note in that language entry stating
the SDK limitation and provide the equivalent HTTP call via the SDK’s generic
request method or the GitBook-generated example.

Comment on lines +771 to +818
x-codeSamples:
- lang: shell
label: 'cURL'
source: |
curl -X GET https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}/company_info \
-H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/sending_domain_id'
responses:
'200':
$ref: '#/components/responses/CompanyInfoResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'

put:
summary: Update company info
description: |
Create or update company information for a sending domain / account.
Company info is required for domain compliance verification.
operationId: updateSendingDomainCompanyInfo
tags:
- domains
x-codeSamples:
- lang: shell
label: 'cURL'
source: |
curl -X PUT https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}/company_info \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"company_info": {
"name": "Mailtrap",
"address": "123 Main St",
"city": "San Francisco",
"country": "US",
"zip_code": "94105",
"phone": "+1-555-0100",
"website_url": "https://mailtrap.io",
"privacy_policy_url": "https://mailtrap.io/privacy",
"terms_of_service_url": "https://mailtrap.io/terms",
"info_level": "business"
}
}'
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

Complete the company_info examples across the required languages.

Both new company_info operations currently stop at cURL. That leaves the docs inconsistent with the rest of the spec and with the repo’s required sample ordering. Please add the remaining official SDK examples for both GET and PUT, or call out unsupported SDK methods inline.

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; if SDK doesn't support a method, use GitBook generation or add a comment noting SDK limitations".

🧰 Tools
🪛 Betterleaks (1.1.1)

[high] 775-776: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 802-803: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@specs/email-sending.openapi.yml` around lines 771 - 818, The docs for the GET
and PUT sending domain company_info endpoints (see the GET block and the
operationId updateSendingDomainCompanyInfo) only include cURL samples—add
x-codeSamples entries for the remaining languages in the required priority
order: Node.js (JavaScript), PHP, Python, Ruby, .NET (C#), Java; for each
language use the official Mailtrap SDK call that corresponds to these endpoints
(or the SDK method name if available) and show authentication and payload for
PUT (company_info object), and where an SDK does not expose the operation
include a short inline note stating the SDK limitation and provide the
equivalent generated HTTP client usage as fallback. Ensure sample labels match
existing x-codeSamples format and that PUT uses the same company_info JSON
fields shown in the cURL example.

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.

1 participant