Skip to content

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

Merged
leonid-shevtsov merged 1 commit into
mainfrom
MT-22654-tracking-opt-outs-openapi
Jul 16, 2026
Merged

MT-22654: Document tracking opt-outs public API#46
leonid-shevtsov merged 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
Contributor

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 API support to manage tracking opt-outs.
    • Added endpoints to list, create, and delete tracking opt-outs with filtering and pagination.
    • Added a domain setting to enable/disable tracking opt-outs support for open/click tracking.
  • Bug Fixes

    • Clarified domain behavior so tracking opt-out settings apply only when open or click tracking is enabled.
  • Documentation

    • Updated the OpenAPI specification to include the new endpoints and schemas.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 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

Suggested reviewers: mklocek, piobeny, roman-adamchik, vladimirtaytor

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: documenting the tracking opt-outs public API.
Description check ✅ Passed The description covers Motivation, Changes, and How to test, with only the optional Images and GIFs section 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.

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
@leonid-shevtsov
leonid-shevtsov force-pushed the MT-22654-tracking-opt-outs-openapi branch from a3286eb to e4694bd Compare July 1, 2026 10:27
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 e4694bd to 2a395ff Compare July 15, 2026 10:50

@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 1316-1326: Add Node.js, PHP, Python, Ruby, .NET, and Java
x-codeSamples blocks to the GET tracking opt-outs endpoint at
specs/email-sending.openapi.yml:1316-1326, each noting that the SDK does not yet
support tracking opt-outs. Add the same language slots and SDK-limitation notes
to the POST endpoint at specs/email-sending.openapi.yml:1381-1391 and DELETE
endpoint at specs/email-sending.openapi.yml:1433-1438, preserving the existing
cURL examples and required language order.
🪄 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: afc8cc8e-12ef-4690-a5e8-6dfb548a75ca

📥 Commits

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

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

Comment thread specs/email-sending.openapi.yml
@leonid-shevtsov
leonid-shevtsov merged commit fd7b929 into main Jul 16, 2026
2 checks passed
@leonid-shevtsov
leonid-shevtsov deleted the MT-22654-tracking-opt-outs-openapi branch July 16, 2026 14:28
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