Skip to content

MT-22654: Document tracking opt-outs public API#46

Open
leonid-shevtsov wants to merge 1 commit into
mainfrom
MT-22654-tracking-opt-outs-openapi
Open

MT-22654: Document tracking opt-outs public API#46
leonid-shevtsov wants to merge 1 commit into
mainfrom
MT-22654-tracking-opt-outs-openapi

Conversation

@leonid-shevtsov

@leonid-shevtsov leonid-shevtsov commented Jun 26, 2026

Copy link
Copy Markdown

Motivation

https://railsware.atlassian.net/browse/MT-22654

Changes

  • Add tracking-opt-outs tag and CRUD paths in email-sending.openapi.yml (GET/POST /api/tracking_opt_outs, DELETE /api/tracking_opt_outs/{id})
  • Document list filters (email, start_time, end_time, last_id), pagination limit, and rate limits
  • Add TrackingOptOut schema and response components matching Falcon v2 shapes
  • Document tracking_opt_out_enabled on sending domain GET/PATCH

How to test

  • New Tracking Opt-Outs section appears under Email Sending API docs after merge

Made with Cursor

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for managing tracking opt-outs through the API.
    • Introduced endpoints to list, create, and remove tracking opt-outs.
    • Added tracking opt-out settings to domain configuration, including an enable/disable option.
  • Bug Fixes

    • Clarified when recipients can opt out of open and click tracking, based on tracking being enabled.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2bbb6f0e-5550-494f-a176-2142698d006f

📥 Commits

Reviewing files that changed from the base of the PR and between a3286eb and e4694bd.

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

📝 Walkthrough

Walkthrough

The OpenAPI spec adds tracking opt-out documentation, domain setting fields, and new list/create/delete tracking opt-out endpoints with supporting parameters, schemas, and responses.

Changes

Tracking opt-out OpenAPI additions

Layer / File(s) Summary
Docs overview
specs/email-sending.openapi.yml
API descriptions and the new tracking-opt-outs tag section mention tracking opt-outs.
Domain setting
specs/email-sending.openapi.yml
Domain and UpdateDomainRequest add tracking_opt_out_enabled, and the domain PATCH example includes it.
Tracking opt-out endpoints
specs/email-sending.openapi.yml
The list, create, and delete tracking opt-out paths add filters, pagination, a path parameter, a TrackingOptOut schema, and response components.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change to document tracking opt-outs.
Description check ✅ Passed The description matches the template with Motivation, Changes, and How to test, though Images and GIFs are omitted.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MT-22654-tracking-opt-outs-openapi

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.

@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: 2

🤖 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 1422-1431: The create/delete tracking opt-outs docs only include
cURL, so the standard code sample tabs are missing for these operations. Update
the x-codeSamples blocks in the tracking_opt_outs POST/DELETE sections to follow
the repo’s usual priority order: cURL, Node.js, PHP, Python, Ruby, .NET, and
Java, and include the same explicit “SDK does not yet support tracking opt-outs”
limitation note for the unsupported SDK entries. Use the existing tracking
opt-outs sample patterns in this spec to keep the language ordering and
messaging consistent.
- Around line 1323-1368: The Node.js x-codeSamples entry for tracking opt-outs
mixes a MailtrapClient instantiation with a raw fetch call, which is misleading
because it implies SDK support that does not exist. Update the JavaScript sample
to match the other language blocks by replacing the example in the tracking
opt-outs section with an SDK-limitation note, and remove the
MailtrapClient/getTrackingOptOuts sample so readers are directed to the cURL
example until the SDK supports this endpoint.
🪄 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: 9fc7721e-0a63-4262-ab46-ae21764c1070

📥 Commits

Reviewing files that changed from the base of the PR and between 14e1854 and a3286eb.

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

Comment thread specs/email-sending.openapi.yml Outdated
Comment on lines +1422 to +1431
x-codeSamples:
- lang: shell
label: 'cURL'
source: |
curl -X POST https://mailtrap.io/api/tracking_opt_outs \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"email": "tracked@example.com"
}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the missing language sample slots for create/delete tracking opt-outs.

Line 1422 and Line 1469 only provide cURL. For spec files in this repo, x-codeSamples should still keep the standard language order, and unsupported SDK entries should be present with an explicit limitation note. Right now the POST/DELETE docs will lose the usual tabs and won’t communicate why the SDK samples are missing.

Based on learnings, populate x-codeSamples in the exact priority order with cURL first, then Node.js, PHP, Python, Ruby, .NET, and Java, using the same “SDK does not yet support tracking opt-outs” note you already added elsewhere.

Also applies to: 1469-1474

🧰 Tools
🪛 Betterleaks (1.5.0)

[high] 1426-1427: 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 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 1422 - 1431, The create/delete
tracking opt-outs docs only include cURL, so the standard code sample tabs are
missing for these operations. Update the x-codeSamples blocks in the
tracking_opt_outs POST/DELETE sections to follow the repo’s usual priority
order: cURL, Node.js, PHP, Python, Ruby, .NET, and Java, and include the same
explicit “SDK does not yet support tracking opt-outs” limitation note for the
unsupported SDK entries. Use the existing tracking opt-outs sample patterns in
this spec to keep the language ordering and messaging consistent.

Sources: Coding guidelines, Learnings

Comment thread specs/email-sending.openapi.yml Outdated
Comment thread specs/email-sending.openapi.yml Outdated
Decisions:
- Mirror suppressions path style (`/api/tracking_opt_outs`) for account-scoped v2 endpoints
- SDK samples deferred until client libraries ship tracking opt-out support

Co-authored-by: Cursor <cursoragent@cursor.com>
@leonid-shevtsov leonid-shevtsov force-pushed the MT-22654-tracking-opt-outs-openapi branch from a3286eb to e4694bd Compare July 1, 2026 10:27
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