Mailtrap has officially released the Stats API, a set of endpoints that allows you to retrieve the stats of your sent emails over the Mailtrap API. This way, you can track the performance of your emails without having to open Mailtrap Stats from the UI.
It’s been one of our most requested features, and now it’s live for all users (Soon to be available in our SDKs too)!
What’s included
The Stats API gives you access to five endpoints, each designed to fetch your sending data in a different way:
/stats— Aggregated sending stats across your account/stats/domains— Stats broken down by sending domain/stats/categories— Stats by email category (e.g., welcome emails, password resets)/stats/email_service_providers— Stats by mailbox provider (Gmail, Yahoo, Outlook, etc.)/stats/date— Stats broken down by date
Each endpoint returns metrics for delivery, bounce, open, click, and spam. This includes both counts and rates.
Filtering
All endpoints support optional filters so you can get the exact data you need:
- Date range (required) — specify
start_dateandend_date - Sending domains — filter by one or more domain IDs
- Sending streams — narrow down to
transactional,bulk, or both - Categories — isolate specific email types
- Email service providers — focus on specific mailbox providers
Example
To paint you a picture of how you could use the Sending Stats API, let’s imagine you need to pull your overall sending stats for Q1 2025. Here’s what you would use:
GET /api/accounts/{account_id}/stats?start_date=2025-01-01&end_date=2025-03-31 HTTP/1.1
Host: mailtrap.io
Api-Token: YOUR_API_KEY
And here is the response that you would get:
{
"delivery_count": 190,
"delivery_rate": 0.95,
"bounce_count": 10,
"bounce_rate": 0.05,
"open_count": 171,
"open_rate": 0.9,
"click_count": 133,
"click_rate": 0.7,
"spam_count": 3,
"spam_rate": 0.02
}
For more information on the new Sending Stats API, consult our official documentation.
