Repository navigation
Conversation
The API reads sending_domain_ids[] and silently ignores domain_ids[], so a client following the spec got stats for every domain instead of the ones it asked for. The stream filter now says that omitting it means both API/SMTP streams: campaign and automation traffic is in neither stream and is reported by GET /api/marketing/stats.
Aggregated Email Marketing stats (campaigns and automations) for a date range, filterable by sending domain, source and email service provider. The engagement rates divide by delivery_count, unlike the per-campaign stats endpoint, so the description says so rather than letting the two disagree silently. The 429 copies the templates shape: this endpoint's per-account limit and the global throttle answer with different keys, and RateLimitedResponse gains required: [error] so the oneOf can tell them apart. The SDK samples describe the methods the SDKs are adding; merge once each SDK has released its method.
|
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
Merge Risk:
|
Decisions: - Samples read the API key from MAILTRAP_API_KEY, as the repo's sample rules require - Campaign stats example rates now divide by sent_count, matching what the new text says that endpoint does - Required lists on the stats payload and 400 body, so generated clients don't type every metric as optional - The stats tag says campaign and automation traffic moved to GET /api/marketing/stats - Marketing-only 400/429 responses carry the endpoint in their names; the domain filter key matches its wire name - Dropped the sources[] sentence the parameter table already states Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - Go sample uses the SDK's exported source constant, as the repo's Go sample rules ask - .NET sample formats dates with the invariant culture, so non-Gregorian locales don't send a wrong year - The zero-result note stays only on the MarketingStats schema, which already states it - sources[] reads like the sibling filters: one sentence on what omitting it means - The spec's info description now covers the account-wide Email Marketing stats, not just campaigns Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
Decisions: - Drop SendingDomainIDs from the Go stats/date sample: the released SDK sends it as domain_ids[], which the API ignores - State what the 400 rejects and that an unknown provider matches nothing instead of failing - Say "from 30 days ago through today", since both dates are inclusive and the window is 31 days - Give every campaign stats rate its sent_count denominator, so the contrast with marketing stats is visible on both Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - The marketing stats endpoint is described by its own tag, so the spec-level summary keeps its original wording Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - mailtrap-go v0.5.0 sends the filter as sending_domain_ids[], so the reason for dropping it from the sample is gone - The sample is now identical to main again; it compiles against v0.5.0 (gofmt, go vet, go build) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decisions: - The API returns sending_domain_id in stats by domain and email logs, and only reads filters[sending_domain_id]; filters[domain_id] is dropped, so a filtered request returned every domain's logs - The domain_id names came from a docs-only rename the API never followed, the same one this branch reverses for sending_domain_ids[] - Suppressions, tracking opt-outs and webhooks keep domain_id, the name their endpoints use Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Motivation
The API gets an endpoint for the aggregated Email Marketing stats (campaigns and automations), the numbers shown on Email Marketing > Stats Overview. Campaign and automation traffic is no longer counted under
GET /api/stats, which now covers the Email API/SMTP streams only. This PR documents both sides of that split.Changes
GET /api/marketing/statsis documented under a new Marketing Stats page: requiredstart_date/end_date, optionalsending_domain_ids[],sources[](campaigns/automations) andemail_service_providers[], returning{data: {...}}with 13 counts and ratessources[]value narrows to that source; none or both mean all Email Marketing trafficdelivery_count, unlike the per-campaign stats endpoint, which divides every rate bysent_count; the description says so, so the two don't seem to disagree400lists the four validation messages,403covers tokens limited to sending domains or sandboxes, and429documents both limits (10/min per account on this endpoint, plus the global throttle), which return different keysthe stats domain filter is documented as
sending_domain_ids[], the name the API reads;domain_ids[]was silently ignored, so filtered requests returned every domainthe sending domain in the
GET /api/stats/domainsitems, the email log responses and the email logs filter is documented assending_domain_id, the name the API returns and reads;filters[domain_id]was dropped, so filtered requests returned every domain's logsthe
sending_streams[]description says that omitting it means both API/SMTP streams, and points campaign and automation traffic to the new endpointdomain_id, so itsDomainStats.DomainID(printed by the Go by-domain sample) andEmailLogMessage.DomainIDstay 0 until its fix ships.How to test
You'll need an API token with viewer or admin access to an account that sends campaigns and automations, plus a second token limited to one sending domain.
sources[]. Expect200withdataholding exactly the 13 fields, matching Email Marketing > Stats Overview for the same 30 dayssources[]=campaignsandsources[]=automationseach match the Source select on that page, and the two add up to the unfiltered totalssending_domain_ids[]=<id>andemail_service_providers[]=Googlenarrow the totals0start_date,end_date=2026-13-01, an unknown sending domain id,sources[]=newsletters. Each returns theerrorsmessage documented on the 400 response403 {"errors":"Access forbidden"}{"errors":"Rate limit exceeded"}, whileGET /api/statsstill answersGET /api/statsdomain filter:sending_domain_ids[]=<id>returns only that domain's numberssending_domain_id: eachGET /api/stats/domainsitem and each email log hassending_domain_id, andGET /api/email_logswithfilters[sending_domain_id][operator]=equal&filters[sending_domain_id][value][]=<id>returns only that domain's logsSummary by CodeRabbit
sending_domain_ids[]instead ofdomain_ids[], with access and default-filter behavior documented.