> For the complete documentation index, see [llms.txt](https://docs.mailtrap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailtrap.io/developers/promotional/campaign-stats.md).

# Campaign Stats

Retrieve campaign statistics

## Get email campaign statistics

> Returns aggregated performance metrics for a single campaign: counts and rates for\
> deliveries, opens, clicks, bounces, spam complaints, and unsubscriptions.\
> \
> If the campaign has never been started, all counts and rates are returned as \`0\`.\
> Statistics are aggregated asynchronously and may be slightly delayed for recently sent\
> campaigns.\
> \
> By default, statistics are aggregated over the whole period since the campaign was last\
> started. Use the optional \`start\_date\` and \`end\_date\` query parameters to narrow the\
> aggregation window.

```json
{"openapi":"3.1.0","info":{"title":"Email Campaigns","version":"2.0.0"},"tags":[{"name":"Campaign Stats","description":"Retrieve campaign statistics"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","description":"Pass the API token as a Bearer token in the Authorization header","scheme":"bearer"}},"parameters":{"email_campaign_id":{"name":"email_campaign_id","description":"Unique identifier of the email campaign","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1}},"start_date":{"name":"start_date","description":"Start of the aggregation window (inclusive), in `YYYY-MM-DD` format. Defaults to the day\nthe campaign was last started. Values earlier than the account creation date are clamped\nto it.","in":"query","required":false,"schema":{"type":"string","format":"date"}},"end_date":{"name":"end_date","description":"End of the aggregation window (inclusive), in `YYYY-MM-DD` format. Defaults to the current date.","in":"query","required":false,"schema":{"type":"string","format":"date"}}},"responses":{"EmailCampaignStatsResponse":{"description":"Aggregated campaign statistics.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EmailCampaignStats"}}}}}},"UNAUTHENTICATED":{"description":"Authentication failed — missing or invalid API token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"The API token does not have permission to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionDeniedResponse"}}}},"NOT_FOUND":{"description":"The requested email campaign was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"RATE_LIMITED":{"description":"Too many requests. The public API is rate limited to 150 requests per 10 seconds per\nAPI token. Retry after the window resets (see the `x-ratelimit-reset` header).","headers":{},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedResponse"}}}}},"schemas":{"EmailCampaignStats":{"type":"object","description":"Aggregated campaign performance metrics. Counts and rates are `0` when the campaign has not been started.","properties":{"delivery_count":{"type":"integer"},"open_count":{"type":"integer"},"click_count":{"type":"integer"},"bounce_count":{"type":"integer"},"unsubscription_count":{"type":"integer"},"sent_count":{"type":"integer"},"spam_count":{"type":"integer"},"message_count":{"type":"integer"},"reject_count":{"type":"integer"},"delivery_rate":{"type":"number","format":"float","description":"Share of sent messages that were delivered (0–1)."},"open_rate":{"type":"number","format":"float"},"click_rate":{"type":"number","format":"float"},"bounce_rate":{"type":"number","format":"float"},"spam_rate":{"type":"number","format":"float"},"unsubscription_rate":{"type":"number","format":"float"}}},"UnauthenticatedResponse":{"type":"object","properties":{"error":{"type":"string"}}},"PermissionDeniedResponse":{"type":"object","properties":{"errors":{"type":"string"}}},"NotFoundResponse":{"type":"object","properties":{"error":{"type":"string"}}},"RateLimitedResponse":{"type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/api/email_campaigns/{email_campaign_id}/stats":{"get":{"operationId":"getEmailCampaignStats","summary":"Get email campaign statistics","description":"Returns aggregated performance metrics for a single campaign: counts and rates for\ndeliveries, opens, clicks, bounces, spam complaints, and unsubscriptions.\n\nIf the campaign has never been started, all counts and rates are returned as `0`.\nStatistics are aggregated asynchronously and may be slightly delayed for recently sent\ncampaigns.\n\nBy default, statistics are aggregated over the whole period since the campaign was last\nstarted. Use the optional `start_date` and `end_date` query parameters to narrow the\naggregation window.","tags":["Campaign Stats"],"parameters":[{"$ref":"#/components/parameters/email_campaign_id"},{"$ref":"#/components/parameters/start_date"},{"$ref":"#/components/parameters/end_date"}],"responses":{"200":{"$ref":"#/components/responses/EmailCampaignStatsResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"},"429":{"$ref":"#/components/responses/RATE_LIMITED"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mailtrap.io/developers/promotional/campaign-stats.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
