Skip to content

Analytics API

Query email delivery statistics, per-flow performance metrics, top flows, and recent activity. Export data as CSV for reporting.

Note

For a user guide on analytics dashboards, see Analytics.


Endpoints

MethodPathDescription
GET/v1/analytics/summaryDashboard summary stats
GET/v1/analytics/flows/{id}/statsPer-flow performance
GET/v1/analytics/flows/topTop flows by metric
GET/v1/analytics/emailsEmail stats by date
GET/v1/analytics/recent-activityRecent activity feed
GET/v1/analytics/exportCSV export

Auth: All endpoints require JWT authentication and analytics:read permission (except export, which requires analytics:export).


Dashboard Summary

bash
curl "https://synapse-api.pyrx.tech/v1/analytics/summary?from_date=2026-04-01T00:00:00Z&to_date=2026-04-07T23:59:59Z&compare=true" \
-H "Authorization: Bearer <jwt>"

Query Parameters

ParameterTypeDefaultDescription
from_datedatetime--Start date (ISO 8601)
to_datedatetime--End date (ISO 8601)
comparebooleanfalseInclude comparison to previous period

Response

json
{
"period": {
"from": "2026-04-01",
"to": "2026-04-07"
},
"totals": {
"sent": 12450,
"delivered": 12301,
"opened": 4892,
"clicked": 1567,
"bounced": 89,
"suppressed": 60
},
"rates": {
"delivery_rate": 98.80,
"open_rate": 39.77,
"click_rate": 12.74,
"bounce_rate": 0.71
},
"daily": [
{
"date": "2026-04-01",
"sent": 1850,
"delivered": 1832,
"opened": 721,
"clicked": 234
},
{
"date": "2026-04-02",
"sent": 1790,
"delivered": 1774,
"opened": 698,
"clicked": 221
}
]
}

Per-Flow Stats

bash
curl "https://synapse-api.pyrx.tech/v1/analytics/flows/a1b2c3d4-e5f6-7890-abcd-ef1234567890/stats" \
-H "Authorization: Bearer <jwt>"

Response

json
{
"flow_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"flow_name": "Claim Submitted Notification",
"trips": {
"total": 542,
"active": 12,
"completed": 510,
"dropped": 20
},
"emails": {
"sent": 542,
"delivered": 536,
"opened": 312,
"clicked": 89,
"bounced": 4,
"suppressed": 2
},
"rates": {
"open_rate": 58.21,
"click_rate": 16.60,
"bounce_rate": 0.74
}
}

Top Flows

Return the highest-performing flows ranked by a metric.

bash
curl "https://synapse-api.pyrx.tech/v1/analytics/flows/top?limit=5&sort_by=emails_sent" \
-H "Authorization: Bearer <jwt>"

Query Parameters

ParameterTypeDefaultDescription
limitinteger5Number of flows to return (1--50)
sort_bystringemails_sentMetric to rank by
from_datedatetime--Start date (ISO 8601)
to_datedatetime--End date (ISO 8601)

Response

json
[
{
"flow_id": "a1b2c3d4-...",
"flow_name": "Welcome Series",
"emails_sent": 4500,
"open_rate": 42.5,
"click_rate": 15.2
}
]

Email Stats by Date

Return daily email statistics aggregated by date.

bash
curl "https://synapse-api.pyrx.tech/v1/analytics/emails?from_date=2026-04-01T00:00:00Z&to_date=2026-04-07T23:59:59Z" \
-H "Authorization: Bearer <jwt>"

Query Parameters

ParameterTypeDefaultDescription
from_datedatetime--Start date (ISO 8601)
to_datedatetime--End date (ISO 8601)

Response

json
[
{
"date": "2026-04-01",
"sent": 1850,
"delivered": 1832,
"opened": 721,
"clicked": 234,
"bounced": 12
},
{
"date": "2026-04-02",
"sent": 1790,
"delivered": 1774,
"opened": 698,
"clicked": 221,
"bounced": 8
}
]
Note

This endpoint returns aggregated daily statistics, not individual email log records. For individual email delivery records, use the Email Logs page in the dashboard or the /v1/email-logs endpoint.


Recent Activity

Return the most recent activity events for the workspace.

bash
curl "https://synapse-api.pyrx.tech/v1/analytics/recent-activity?limit=10" \
-H "Authorization: Bearer <jwt>"

Query Parameters

ParameterTypeDefaultDescription
limitinteger10Number of items to return

CSV Export

Export email analytics as a CSV download.

Auth: JWT. Requires analytics:export permission.

bash
curl "https://synapse-api.pyrx.tech/v1/analytics/export?from_date=2026-04-01T00:00:00Z&to_date=2026-04-07T23:59:59Z" \
-H "Authorization: Bearer <jwt>" \
-o analytics.csv

Query Parameters

ParameterTypeRequiredDescription
from_datedatetimeNoStart date (ISO 8601)
to_datedatetimeNoEnd date (ISO 8601)

Response

Returns a CSV file with Content-Type: text/csv and Content-Disposition: attachment headers.

csv
Date,Sent,Delivered,Opened,Clicked,Bounced
2026-04-01,1850,1832,721,234,12
2026-04-02,1790,1774,698,221,8
Note

Analytics data is updated from materialized views that refresh every 15 minutes. There may be a short delay between email delivery and stats appearing in the API.


Metrics Reference

MetricCalculation
Delivery RateDelivered / Sent * 100
Open RateOpened / Delivered * 100
Click-Through RateClicked / Delivered * 100
Bounce RateBounced / Sent * 100
SuppressedEmails not sent due to required NLT fields being null