Analytics
Analytics — methods, parameters, and examples for easy-sdk (pip).
Read aggregated metrics for your account. All five methods take the
same shape (period, start_date, end_date) and return the raw
data payload as a dict — the response shape varies per metric, so
the SDK doesn't strongly type it.
Namespace: client.analytics.
| Method | Underlying endpoint |
|---|---|
transactions(...) | GET /analytics/transactions |
disputes(...) | GET /analytics/disputes |
settlements(...) | GET /analytics/settlements |
revenue(...) | GET /analytics/revenue |
revenue_recovery(...) | GET /analytics/revenue-recovery |
Methods
Every method has the same signature:
client.analytics.transactions(
period=None, # e.g. "7d", "30d", "month"
start_date=None, # ISO-8601
end_date=None, # ISO-8601
)Pass period= for a relative window or start_date= + end_date= for
an explicit range. Returns a dict whose shape depends on the metric.
transactions
data = client.analytics.transactions(period="30d")
print(data["total_count"], data["total_volume_cents"])disputes
data = client.analytics.disputes(start_date="2026-01-01", end_date="2026-04-01")settlements
data = client.analytics.settlements(period="7d")revenue
data = client.analytics.revenue(period="month")revenue_recovery
data = client.analytics.revenue_recovery(period="90d")Object shape
Responses come back as dict[str, Any] rather than typed models —
analytics endpoints intentionally have flexible, metric-specific
shapes. See the
Easy Labs API reference for the
canonical schema per endpoint.
Examples
Build a daily revenue dashboard widget
revenue = client.analytics.revenue(period="30d")
print(f"30-day revenue: ${revenue['total_cents'] / 100:,.2f}")Compare disputes month over month
this_month = client.analytics.disputes(period="month")
last_month = client.analytics.disputes(
start_date="2026-04-01",
end_date="2026-04-30",
)
delta = this_month["count"] - last_month["count"]
log.info("disputes vs. last month: %+d", delta)Audit recovery effectiveness
recovery = client.analytics.revenue_recovery(period="90d")
print(recovery)