API Reference
Analytics
Query delivery stats, event logs, and cohort analysis via the API.
The analytics API provides delivery statistics, event logs, and cohort analysis for your email sends.
Get stats
GET /v1/analytics/stats
Requires read_only scope.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | Yes | Start date (ISO 8601), e.g., 2025-01-01. |
to | string | Yes | End date (ISO 8601), e.g., 2025-01-31. |
granularity | string | No | Time bucket: hour, day (default), week, month. |
tag | string | No | Filter by tag name. |
domain | string | No | Filter by sending domain. |
Response
{
"summary": {
"sent": 15000,
"delivered": 14700,
"opened": 6174,
"clicked": 1764,
"bounced": 300,
"complained": 15,
"delivery_rate": 0.98,
"open_rate": 0.42,
"click_rate": 0.12,
"bounce_rate": 0.02,
"complaint_rate": 0.001
},
"timeseries": [
{
"date": "2025-01-01",
"sent": 500,
"delivered": 490,
"opened": 205,
"clicked": 60,
"bounced": 10,
"complained": 0
}
]
}
Rates are decimal values between 0 and 1 (e.g., 0.42 = 42%).
Get event logs
GET /v1/analytics/logs
Requires read_only scope.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
email_id | string | Filter by a specific email ID. | |
type | string | Filter by event type: delivered, bounced, opened, clicked, complained. | |
to | string | Filter by recipient email address. | |
from_date | string | Events from this date (ISO 8601). | |
to_date | string | Events until this date (ISO 8601). | |
limit | number | 50 | Results per page (1–100). |
cursor | string | Pagination cursor. |
Response
{
"data": [
{
"id": "evt_abc123",
"email_id": "em_abc123",
"type": "delivered",
"recipient": "user@example.com",
"metadata": null,
"created_at": "2025-03-12T09:00:05Z"
},
{
"id": "evt_abc124",
"email_id": "em_abc123",
"type": "opened",
"recipient": "user@example.com",
"metadata": {
"user_agent": "Mozilla/5.0...",
"ip": "1.2.3.4"
},
"created_at": "2025-03-12T09:15:30Z"
}
],
"has_more": true,
"next_cursor": "evt_abc100"
}
Export logs
GET /v1/analytics/export
Requires read_only scope. Available on Pro and higher plans. Returns a CSV or JSON export of event logs for a date range.
Query parameters
Same as event logs, plus:
| Parameter | Type | Default | Description |
|---|---|---|---|
format | string | csv | Export format: csv or json. |
Analytics retention
Log retention varies by plan:
| Plan | Log retention | Analytics retention |
|---|---|---|
| Free | 1 day | 7 days |
| Pro | 7 days | 90 days |
| Business | 30 days | 1 year |
| Enterprise | 90 days | Unlimited |
Benchmarks
GET /v1/analytics/benchmarks
Requires read_only scope. Available on Pro and higher plans.
Returns anonymized cross-organization benchmark data to compare your delivery rates, open rates, and click rates against industry averages by domain category.
SDK example
const { summary, timeseries } = await sendr.analytics.stats({
from: "2025-01-01",
to: "2025-01-31",
granularity: "week",
});
console.log(`Delivery rate: ${(summary.delivery_rate * 100).toFixed(1)}%`);
console.log(`Open rate: ${(summary.open_rate * 100).toFixed(1)}%`);
const logs = await sendr.analytics.logs({
email_id: "em_abc123",
});