Analytics

Read the calculated metrics the Kaching admin shows, rather than re-deriving them from contracts and webhooks.

Subscriptions docs

Read the calculated metrics the Kaching admin shows, rather than re-deriving them from contracts and webhooks.

Get analytics

http
GET /shop-api/analytics

Permission: Analytics → View analytics (analytics:read).

Returns the metrics the Kaching admin shows on its Analytics and Billing health pages — MRR, churn rate, retention, subscription counts and payment success rates — for a preset period or a custom day range.

These are the app's own calculated figures, not raw data to re-derive: the endpoint reads them through the very same services that render those pages, so a number here and the number on the merchant's screen cannot disagree. See Matching the admin exactly for the three things that most often make them look different.

Query parameters

ParameterTypeRequiredDefaultDescription
periodstringNoLAST_30_DAYSA preset period (below). Ignored when from and to are given.
fromstringNo—First day of a custom range, YYYY-MM-DD, read in tz. Send together with to.
tostringNo—Last day of the range, inclusive. On or after from, and not after today in tz.
tzstringNothe shop'sIANA timezone name, e.g. America/New_York. Decides which instants each day covers.

Accepted period values: TODAY, YESTERDAY, LAST_24_HOURS, LAST_7_DAYS, LAST_30_DAYS, LAST_90_DAYS, LAST_365_DAYS, LAST_MONTH (previous calendar month), LAST_12_MONTHS, LAST_YEAR (previous calendar year), ALL_TIME.

There is no maximum range. period=CUSTOM is also accepted alongside from and to, so a URL copied from the admin's own address bar works unchanged.

Example

bash
curl -G "https://subscriptions.kachingappz.app/shop-api/analytics" \
  -H "Authorization: Bearer <your-api-token>" \
  --data-urlencode "from=2026-09-01" \
  --data-urlencode "to=2026-09-30" \
  --data-urlencode "tz=America/New_York"

Response (200)

json
{
  "shop": "example.myshopify.com",
  "currency": "USD",
  "timezone": "America/New_York",
  "period": null,
  "customRange": { "from": "2026-09-01", "to": "2026-09-30" },
  "range": {
    "from": "2026-09-01T04:00:00.000Z",
    "to": "2026-10-01T03:59:59.999Z"
  },
  "failedPaymentsCountAsChurn": false,
  "subscriptions": {
    "activeCount": 259,
    "pausedCount": 17,
    "cancelledCount": 48,
    "newCount": 296,
    "churnedCount": 74,
    "reactivatedCount": 12,
    "netChange": 211,
    "churnRate": 24.71,
    "averageRetentionPeriodDays": 121,
    "averageActiveSubscriptionAgeDays": 197
  },
  "revenue": {
    "mrr": 31916.2,
    "expectedCollectionsNext30Days": 25626.32,
    "upcomingRevenue": [{ "date": "2026-10-16", "revenue": 583.85 }],
    "arpu": 61.33,
    "averageOrderValue": 48.9,
    "averageOrdersPerSubscription": 4.2,
    "averageLifetimeRevenuePerSubscription": 205.4,
    "firstSubscriptionOrdersCount": 96,
    "recurringOrdersCount": 1104,
    "firstSubscriptionOrdersRevenue": 4512.0,
    "recurringOrdersRevenue": 51993.2,
    "totalSubscriptionRevenue": 56505.2,
    "subscriptionTakeRate": 0.31,
    "subscriptionRevenueShare": 0.72
  },
  "billingHealth": {
    "successRate": 94.2,
    "firstTrySuccessRate": 88.1,
    "failureRate": 5.8,
    "perCycleSuccessRate": 97.4,
    "perCycleFirstTrySuccessRate": 90.2,
    "isPerCycleRatePreferred": true,
    "totalBillingAttemptsCount": 1210,
    "successfulBillingAttemptsCount": 1140,
    "failedBillingAttemptsCount": 70,
    "firstTrySuccessCount": 1066,
    "recoveredBillingAttemptsCount": 52,
    "recoveredPaymentsValue": 2480.0,
    "lostBillingAttemptsCount": 18,
    "successCyclesCount": 1140,
    "lostCyclesCount": 31,
    "resolvedCyclesCount": 1171,
    "subscriptionsInDunningCount": 24,
    "failureReasons": {
      "rows": [{ "reason": "insufficient_funds", "count": 31, "percentage": 44.3 }],
      "truncated": false,
      "totalDistinctReasons": 6
    }
  }
}

Top-level fields

FieldTypeDescription
shopstringThe shop domain the token belongs to.
currencystringThe shop's currency. Every money figure is in it.
timezonestringThe zone the window was read in — your tz, or the shop's.
periodstring|nullThe preset read, or null when a custom range was.
customRangeobject|null{ from, to } inclusive days, or null when a preset was read.
rangeobjectThe instants the window actually covers, inclusive, as ISO-8601 UTC.
failedPaymentsCountAsChurnbooleanThe shop's churn setting — see below.

subscriptions

FieldTypeDescription
activeCountnumber|nullSubscriptions counted as active right now — not over the window. Includes or excludes contracts in dunning per the churn setting.
pausedCountnumber|nullContracts currently paused. Now, not over the window.
cancelledCountnumber|nullContracts currently cancelled. Now, not over the window.
newCountnumber|nullSubscriptions that became active during the window, summed per day. One that starts and churns the same day is excluded.
churnedCountnumber|nullSubscriptions that became inactive during the window, summed per day. One that churns and returns the same day is excluded.
reactivatedCountnumber|nullPreviously inactive subscriptions that became active again during the window.
netChangenumber|nullLast recorded active count in the window minus the first. Days without a snapshot are skipped, so for a shop younger than the window this spans only the recorded days.
churnRatenumber|nullPercent 0–100: (starting + new − ending) / (starting + new). `null` unless the window both begins and ends with a recorded snapshot — see the caution below.
averageRetentionPeriodDaysnumber|nullAverage days a subscription stayed active before churning, over those that churned in the window. null when none did.
averageActiveSubscriptionAgeDaysnumber|nullAverage age in days of currently-active subscriptions, from creation to today.

revenue

FieldTypeDescription
mrrnumber|nullMonthly Recurring Revenue: every active contract's price normalised to a month. Always active-only.
expectedCollectionsNext30Daysnumber|nullRevenue expected from orders scheduled in the next 30 days. Forward-looking: it ignores period.
upcomingRevenuearray|null{ date, revenue } per upcoming day — the daily breakdown of the figure above. Also ignores period.
arpunumber|nullAverage revenue per unique customer from subscription orders in the last 30 days. Ignores period.
averageOrderValuenumber|nullAverage value across all subscription orders, initial and recurring. All time.
averageOrdersPerSubscriptionnumber|nullAverage successful orders per subscription over its lifetime. All time.
averageLifetimeRevenuePerSubscriptionnumber|nullAverage total revenue per subscription over its lifetime. All time.
firstSubscriptionOrdersCountnumber|nullInitial orders from subscriptions created during the window.
recurringOrdersCountnumber|nullRecurring subscription orders during the window.
firstSubscriptionOrdersRevenuenumber|nullRevenue from those initial orders.
recurringOrdersRevenuenumber|nullRevenue from those recurring orders.
totalSubscriptionRevenuenumber|nullThe two above added. Includes tax and shipping, subtracts discounts; refunds are not subtracted.
subscriptionTakeRatenumber|nullRatio 0–1: first-subscription-order revenue against that plus one-time revenue.
subscriptionRevenueSharenumber|nullRatio 0–1: all subscription revenue against all revenue.

The last two are the only figures read from Shopify rather than from Kaching's own records, so they are also the only ones a Shopify rate limit can turn into null on its own. Every other field in the response is unaffected when that happens.

billingHealth

Two readings of the same window, deliberately both returned.

FieldTypeDescription
successRatenumber|nullPercent 0–100, per attempt: successful billing attempts over all attempts in the window.
firstTrySuccessRatenumber|nullPercent 0–100: attempts that succeeded first try, over all attempts.
failureRatenumber|nullPercent 0–100: failed attempts over all attempts.
perCycleSuccessRatenumber|nullPercent 0–100, per cycle: cycles that ended up paid, over cycles that resolved. Cycles still retrying are in neither.
perCycleFirstTrySuccessRatenumber|nullPercent 0–100: cycles paid on the first attempt, over resolved cycles.
isPerCycleRatePreferredbooleanWhich of the two bases the merchant's own Billing health page is currently showing.
totalBillingAttemptsCountnumber|nullBilling attempts in the window.
successfulBillingAttemptsCountnumber|nullOf those, successful.
failedBillingAttemptsCountnumber|nullOf those, failed.
firstTrySuccessCountnumber|nullOf those, successful on the first attempt.
recoveredBillingAttemptsCountnumber|nullPayments that failed and were later recovered by dunning.
recoveredPaymentsValuenumber|nullTheir total value, in currency.
lostBillingAttemptsCountnumber|nullAttempts dunning gave up on.
successCyclesCountnumber|nullCycles that resolved into a paid order in the window.
lostCyclesCountnumber|nullCycles dunning gave up on, deduplicated.
resolvedCyclesCountnumber|nullsuccessCyclesCount + lostCyclesCount — the per-cycle denominator.
subscriptionsInDunningCountnumber|nullSubscriptions currently in dunning. Now, not over the window.
failureReasonsobject|null{ rows: [{ reason, count, percentage }], truncated, totalDistinctReasons } — top 20 reasons by count.

Why the two rates differ so much. Every dunning retry writes its own failure, so a cycle that failed four times and then paid contributes one success and four failures to the per-attempt rate. The harder a shop retries, the worse that rate looks. perCycleSuccessRate counts each cycle once, and is usually what a merchant means by "how many of my charges go through".

The failed-payments setting

Merchants choose, in the Kaching admin under Settings → General, whether a subscription whose payment failed and never recovered counts as churned. failedPaymentsCountAsChurn reports that choice. It cannot be overridden per request — following the saved setting is what keeps these figures equal to the ones on the merchant's screen.

SettingWhat counts as a live subscription
falseActive and failed. A failed payment is still in dunning and can recover, so it stays alive.
trueActive only. A failure never followed by a return to active churns on the day the payment failed.

Fields that follow it: subscriptions.activeCount, averageActiveSubscriptionAgeDays, churnRate and netChange.

Fields that never follow it: revenue.mrr (always active-only), subscriptions.newCount, churnedCount, reactivatedCount, averageRetentionPeriodDays, pausedCount, cancelledCount, and everything under billingHealth.

Caching and rate limits

A successful response is cached for 5 minutes per shop, window, timezone and setting, and says so:

http
Cache-Control: private, max-age=300
X-Kaching-Analytics-Cache: hit

Changing the failed-payments setting takes effect immediately — it is part of the cache key, not merely reported in the body.

This endpoint carries its own limits in place of the global 60/60s, because one call computes around twenty separate metrics:

BucketBudgetCounts
Requests30 per 60 secondsEvery request.
Cold computations10 per 300 secondsOnly requests that miss the 5-minute response cache.

A job polling one window never touches the second budget — after the first call its requests come from cache. The second budget bounds a caller walking many different windows. Refusals carry Retry-After in seconds.

Matching the admin exactly

  • Timezone is the usual reason two numbers disagree. The admin's Analytics page reads the window in the browser's timezone; this endpoint defaults to the shop's. To reproduce a screen exactly, send the tz that browser was in.
  • Some figures ignore `period` by design. expectedCollectionsNext30Days and upcomingRevenue look 30 days forward; arpu is always the last 30 days; averageOrderValue, averageOrdersPerSubscription and averageLifetimeRevenuePerSubscription are all-time; and activeCount, pausedCount, cancelledCount and subscriptionsInDunningCount are counts of now, not of the window.
  • `ALL_TIME` and `LAST_24_HOURS` have no equivalent in the admin. Its date filter does not offer them, so those two cannot be compared against a screen. Every other period, and any custom range, can.

Validation

Unlike the admin — which quietly falls back to "Last 7 days" for a hand-edited URL — this endpoint always tells you when a parameter is wrong, so an integration never books a week's figures as the quarter it asked for.

RequestResponse
from without to (or vice versa)400 { "error": "from and to must be given together" }
to before from400 { "error": "The start date must be on or before the end date" }
A day that is not a real date400 { "error": "Not a real calendar date" }
to after today in tz400 { "error": "to must not be after today (2026-10-15 in UTC)" }
An unknown period400 listing the accepted values
period=CUSTOM without both days400 { "error": "period=CUSTOM needs both from and to" }
A tz that is not an IANA zone400 { "error": "tz must be a valid IANA timezone" }

A single metric that cannot be read is not an error — it comes back as null with the rest of the response intact.


Can’t find what you need?

Ask the Kaching team about your integration in chat.