{"lexicon":1,"id":"money.atmosphere.analytics.getSubscriptionMetrics","defs":{"currencyMetrics":{"type":"object","required":["currency","activeCount","mrrCents","newCount","canceledCount"],"properties":{"currency":{"type":"string","maxLength":3},"activeCount":{"type":"integer"},"mrrCents":{"type":"integer","description":"Interval-normalized monthly recurring revenue (current active snapshot)."},"newCount":{"type":"integer","description":"Subscriptions created in the window."},"canceledCount":{"type":"integer","description":"Subscriptions cancelled in the window (by cancelledAt)."}}},"main":{"type":"query","description":"Subscription MRR / growth / churn for the calling app, per currency, scoped to its own originated subscriptions. MRR is a current interval-normalized snapshot; newCount/canceledCount are windowed by createdAt/cancelledAt. Aggregates only.","parameters":{"type":"params","properties":{"environment":{"type":"string","knownValues":["test","live"],"maxLength":8},"windowDays":{"type":"integer","minimum":1,"maximum":92,"default":30},"currency":{"type":"string","maxLength":3}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["byCurrency","window","notes"],"properties":{"byCurrency":{"type":"array","items":{"type":"ref","ref":"#currencyMetrics"}},"window":{"type":"object","required":["windowDays","from","to"],"properties":{"windowDays":{"type":"integer"},"from":{"type":"string","format":"datetime"},"to":{"type":"string","format":"datetime"}}},"notes":{"type":"array","items":{"type":"string"}}}}}}}}