Skip to content

Update suppressions API spec#32

Open
VladimirTaytor wants to merge 4 commits intomainfrom
update-suppressions-api
Open

Update suppressions API spec#32
VladimirTaytor wants to merge 4 commits intomainfrom
update-suppressions-api

Conversation

@VladimirTaytor
Copy link
Copy Markdown
Contributor

@VladimirTaytor VladimirTaytor commented Apr 27, 2026

Motivation

Update specs/email-sending.openapi.yml to reflect Suppressions API changes (new POST endpoint, cursor pagination, admin-only access) and fix pre-existing schema inaccuracies that did not match the actual API responses.

Changes

  • GET /api/suppressions — added last_id cursor pagination query param; clarified parameter descriptions; noted 10 rpm rate limit
  • POST /api/suppressions — new endpoint (admin-only, 10 rpm); body: email, domain_id, sending_stream, optional type (defaults to manual import)
  • DELETE /api/suppressions/{suppression_id} — added admin-only note
  • suppression_id path parameter: integerstring / uuid
  • Suppression schema: id is now a uuid string; reason field renamed to type with values [hard bounce, unsubscription, spam complaint, manual import]; added sending_stream, domain_name, and ten nullable message_* fields
  • DeleteSuppressionResponse now references Suppression (previously a {success, message} shape that did not match the API)
  • New CreateSuppressionResponse wrapping Suppression in a data key

How to test

  • GitBook preview renders the new POST endpoint and updated Suppression schema correctly
  • Verify domain_id (integer) matches the public API implementation

Summary by CodeRabbit

  • New Features
    • Added cursor-based pagination for suppression listings (last_id) and a new endpoint to create suppressions.
  • Documentation
    • Clarified rate limits (10 requests/min per account) and refined filtering semantics for email and time range.
    • Documented admin-level note for suppression deletion.
    • Updated suppression format: ID is UUID, introduced suppression "type" values, expanded sending/domain and message fields, and adjusted create/delete response formats.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9e7a7a2a-bb34-4ad6-9797-2d6393a70b17

📥 Commits

Reviewing files that changed from the base of the PR and between e4e8041 and 6d05852.

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

📝 Walkthrough

Walkthrough

OpenAPI spec updates for the suppressions endpoints: list gains cursor pagination (last_id), create endpoint added, delete docs clarified, suppression IDs switched to UUIDs, and the Suppression schema plus related responses were revised.

Changes

Suppressions API spec updates

Layer / File(s) Summary
Data Shape
specs/email-sending.openapi.yml
components.schemas.Suppression: id changed to string (format: uuid); removed reason; added type enum [hard bounce, unsubscription, spam complaint, manual import]; added/expanded sending_stream, domain_name, and nullable message_* fields; message_created_at typed as date-time. components.parameters.suppression_id changed from integerstring (uuid).
Operations / Contract
specs/email-sending.openapi.yml
GET /api/accounts/{account_id}/suppressions: added last_id (UUID) cursor param; clarified email is exact case-insensitive match; start_time/end_time filter by created_at (ISO 8601); documented 10 requests/min per-account rate limit. POST /api/accounts/{account_id}/suppressions: new operation requiring email, domain_id, sending_stream, optional type (default manual import); admin-access warning and rate-limit note; responses include 201 (CreateSuppressionResponse) and standard 401/403/422/429 mappings. DELETE /api/accounts/{account_id}/suppressions/{suppression_id}: admin-access warning added.
Responses / Examples
specs/email-sending.openapi.yml
Added components.responses.CreateSuppressionResponse (application/json { data: Suppression }, 201). Updated components.responses.DeleteSuppressionResponse to return application/json body with a Suppression object instead of prior {success,message} style.
Docs / Descriptions
specs/email-sending.openapi.yml
Endpoint descriptions updated to document cursor-based pagination, parameter semantics (email, start_time, end_time), admin-access notes, and explicit per-account rate limits.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • IgorDobryn
  • DagonWat
  • Ma-Anna
  • i7an

Poem

🐇 I nibble specs beneath the moon,

UUID seeds and cursors bloom,
POST arrives with careful care,
DELETE now warns the admin there,
I hop away with JSON crumbs of plume.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Update suppressions API spec' directly relates to the main change, which updates the suppressions API specification in the OpenAPI document.
Description check ✅ Passed The description covers motivation, changes, and testing instructions. It follows the template structure and provides comprehensive information about the API updates.
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 update-suppressions-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.

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: 1

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)

1203-1204: ⚠️ Potential issue | 🟡 Minor

DELETE code samples still use a non-UUID placeholder for suppression_id.

Now that suppression_id is typed as string/format: uuid (lines 1678–1680), the literal "abc123-def456" used across the DELETE samples is not a valid UUID and may confuse readers or break copy-paste-style validators. Consider using the same example UUID already present elsewhere (e.g. 64d71bf3-1276-417b-86e1-8e66f138acfe).

✏️ Example fix (apply to each language sample)
-              const suppressionId = "abc123-def456";
+              const suppressionId = "64d71bf3-1276-417b-86e1-8e66f138acfe";
-            $suppressionId = 'abc123-def456';
+            $suppressionId = '64d71bf3-1276-417b-86e1-8e66f138acfe';
-            suppression_id = "abc123-def456"
+            suppression_id = "64d71bf3-1276-417b-86e1-8e66f138acfe"
-            suppression_id = 'abc123-def456'
+            suppression_id = '64d71bf3-1276-417b-86e1-8e66f138acfe'
-            var suppressionId = "abc123-def456";
+            var suppressionId = "64d71bf3-1276-417b-86e1-8e66f138acfe";
-            String suppressionId = "abc123-def456";
+            String suppressionId = "64d71bf3-1276-417b-86e1-8e66f138acfe";

Also applies to: 1223-1223, 1236-1236, 1251-1251, 1263-1263, 1282-1282

🤖 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 1203 - 1204, Replace the
invalid non-UUID placeholder used for suppressionId with a valid example UUID
across all DELETE code samples; specifically update the variable assignment
(e.g., const suppressionId = "64d71bf3-1276-417b-86e1-8e66f138acfe") used before
calling client.suppressions.delete(suppressionId) so it matches the
suppression_id schema (string, format: uuid) and apply the same replacement to
the other listed samples (lines referenced in the review).
🧹 Nitpick comments (1)
specs/email-sending.openapi.yml (1)

2126-2174: Consider adding a top-level example to the Suppression schema.

Sister schemas (SendingDomain, CompanyInfo, EmailLogsListResponse, SendingMessage, …) all carry an example block. With the substantial reshape here (UUID id, new type, sending_stream, domain_name, ten message_* nullable fields), an example would make the GitBook preview and SDK docs much easier to read and would also serve as a sanity check that the field set is internally consistent.

🤖 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 2126 - 2174, Add a top-level
example object to the Suppression schema that demonstrates valid values for id,
type, created_at, email, sending_stream, domain_name and the nullable message_*
fields (either realistic strings or null where appropriate) so the
OpenAPI/GitBook preview and generated SDK docs show a complete, internally
consistent suppression record; update the Suppression schema's YAML to include
an example block with representative values (e.g., UUID for id, one of the enum
values for type and sending_stream, RFC3339 timestamp for created_at, a sample
email, and either plausible strings or nulls for message_bounce_category,
message_category, message_client_ip, message_created_at, message_esp_response,
message_esp_server_type, message_outgoing_ip, message_recipient_mx_name,
message_sender_email, and message_subject).
🤖 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 1157-1162: The request body defines the suppression reason as the
field named "reason" while the response schema "Suppression" uses "type"; align
these by renaming the response schema's "type" property to "reason" (or
alternatively rename the request property to "type" if you prefer that canonical
name), update the enum, default, description and example to use the chosen name,
and ensure both the POST request body and the Suppression response schema
reference the identical property name and matching description so there is no
naming inconsistency.

---

Outside diff comments:
In `@specs/email-sending.openapi.yml`:
- Around line 1203-1204: Replace the invalid non-UUID placeholder used for
suppressionId with a valid example UUID across all DELETE code samples;
specifically update the variable assignment (e.g., const suppressionId =
"64d71bf3-1276-417b-86e1-8e66f138acfe") used before calling
client.suppressions.delete(suppressionId) so it matches the suppression_id
schema (string, format: uuid) and apply the same replacement to the other listed
samples (lines referenced in the review).

---

Nitpick comments:
In `@specs/email-sending.openapi.yml`:
- Around line 2126-2174: Add a top-level example object to the Suppression
schema that demonstrates valid values for id, type, created_at, email,
sending_stream, domain_name and the nullable message_* fields (either realistic
strings or null where appropriate) so the OpenAPI/GitBook preview and generated
SDK docs show a complete, internally consistent suppression record; update the
Suppression schema's YAML to include an example block with representative values
(e.g., UUID for id, one of the enum values for type and sending_stream, RFC3339
timestamp for created_at, a sample email, and either plausible strings or nulls
for message_bounce_category, message_category, message_client_ip,
message_created_at, message_esp_response, message_esp_server_type,
message_outgoing_ip, message_recipient_mx_name, message_sender_email, and
message_subject).
🪄 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: b30482de-f75b-49ef-8193-56fc0d55b071

📥 Commits

Reviewing files that changed from the base of the PR and between 51060e4 and 827a7b3.

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

Comment thread specs/email-sending.openapi.yml Outdated
@VladimirTaytor VladimirTaytor force-pushed the update-suppressions-api branch from 827a7b3 to 81c8394 Compare April 27, 2026 13:55
@VladimirTaytor VladimirTaytor changed the base branch from main to remove-account-id April 27, 2026 13:55
Base automatically changed from remove-account-id to main April 29, 2026 16:25
Aligns the create request body field name with the response field name.
Falcon-side change: railsware/falcon#10169 (MT-21943).
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 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 1108-1120: The POST suppression endpoint's x-codeSamples currently
only contains a cURL example; add the missing six language-specific samples in
the required priority order (shell/cURL, Node.js (JavaScript), PHP, Python,
Ruby, .NET (C#), Java) under the same x-codeSamples array for the POST operation
so the docs render all tabs; for each language use the official Mailtrap SDK
snippet invoking the suppressions create/send method (or the closest SDK method)
and if an SDK lacks the exact method, include a generated HTTP example or a
short comment noting the SDK limitation per guidelines.
- Around line 3075-3090: The CreateSuppressionResponse and
DeleteSuppressionResponse shapes are inconsistent: CreateSuppressionResponse
nests the Suppression under data while DeleteSuppressionResponse returns the
Suppression directly; confirm the backend and then make the spec consistent by
choosing one of two fixes — Option A: wrap DeleteSuppressionResponse to match
CreateSuppressionResponse by changing DeleteSuppressionResponse content schema
to an object with a data property that $ref:s the Suppression schema (same shape
as CreateSuppressionResponse), or Option B: unwrap CreateSuppressionResponse to
match DeleteSuppressionResponse and GetSuppressionsResponse by replacing its
object-with-data schema with a direct $ref to the Suppression schema; update the
components for CreateSuppressionResponse and DeleteSuppressionResponse in
specs/email-sending.openapi.yml accordingly.
🪄 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: 15a1723c-d571-43aa-9a96-abb810f58c41

📥 Commits

Reviewing files that changed from the base of the PR and between 827a7b3 and e4e8041.

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

Comment thread specs/email-sending.openapi.yml
Comment thread specs/email-sending.openapi.yml
Resolve conflict in specs/email-sending.openapi.yml: keep new
createSuppression POST operation; adopt main's account-scoped
DELETE path /api/accounts/{account_id}/suppressions/{suppression_id};
update POST cURL example to use the account-scoped URL.
type: string
format: email
example: suppressed@example.com
reason:
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.

Actually it was a mistake we never had reason here filed should be named type and all SDKs support type

@VladimirTaytor VladimirTaytor requested review from i7an and piobeny May 6, 2026 11:14
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.

2 participants