Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Analytics

Get the revenue sync

The state of the revenue sync from the workspace's payment providers (Stripe, Lemon Squeezy, Polar and Paddle) and the Payment API. It gives when the sync last read a provider, and how many payments it tied to a visitor. It also gives how many payments of the last 30 days it could not tie: they had no troopy_visitor_id, checkout id or email to match. Then it gives the reads that the Stripe key lacks, and the last error of each provider.

get/api/v1/analytics/revenue

Authorization

HeaderAuthorization: Bearer <API key>
Or the headerX-API-Key: <API key>
API keyMake one in Troopy under Settings > API keys. It acts as you, in its workspace.

Other ways to call it

CLItroopy analytics revenue
MCP tooltroopy_get_analytics_revenue
Rate limit120 calls in 60 seconds, for each key

Response

200 · application/json
data*object
7 properties
syncedAt*string | null
attributed*integer

Payments that Troopy tied to a visitor, all time

unattributed*integer

Payments of the last 30 days that Troopy could not tie to a visit

unattributedRevenue*integer

The sum of those payments, in minor units

missing*string | null

The reads that the keys do not have, with the provider of each, like "Refunds in Polar". Give each key those reads, or replace it

error*string | null
subscriptions*object | null

The sum of the subscriptions of every connected provider. Troopy reads them once an hour at most. null before the first read

8 properties
mrr*integer

Monthly recurring revenue, in minor units: active and past-due subscriptions, after their coupons

mrrBefore*integer | null

MRR about 30 days ago, if Troopy has that history

currency*string | null
subscribers*integer
trials*integer | null

Subscriptions in their free trial. null on a reading from before Troopy counted trials

churnRate*number

The share of the subscriptions that paid 30 days ago and ended since, 0 to 1. A trial counts from its first payment

ltv*integer | null

Revenue per subscriber divided by the monthly churn, in minor units

at*string

ISO 8601 date and time

Errors

401 unauthorizedSend an API key as `Authorization: Bearer tr_live_...`. Create one in Troopy under Settings.
403 forbiddenThe key lacks a scope this operation needs, or its owner lacks the role. detail says which; create a key with the scope, or ask an organization owner or admin.
429 rate_limitedWait the number of seconds in Retry-After, then retry.