palbaseDocs

Palbase IAP · API

GET/iap/charts/{chart}

Read a chart

One chart of the project's ledger, period by period (GET /iap/charts says what each counts). Periods are UTC days, ISO weeks (Monday to Sunday) or calendar months, the first and the last cut to from and to (both included, at most two years apart; to later than today is today). A flow counts what happened in the period, a snapshot is the state at its end (now, for the period now is in), a ratio divides its measures, a cohort follows what began in the period over its ages. The ledger is read whole each time: a refund arriving later, a renewal, a product change, a guest merged into an account and a change of the settings are in the next answer. Money is converted to the reporting currency (or currency) at the European Central Bank's reference rate of the day it was paid; what is in a currency it does not publish is left out and named (unconverted). A store's test purchases count only with sandbox=true. segment splits a segmentable chart by a dimension: the 20 largest values each a segment, the rest together in one keyed (other) (the segments' sum is the whole; a subscription changing segment is churned in one and moved in to the other); filter (repeated, one dimension:value each) keeps what has one of the values given for each dimension named. The paywall and experiment dimensions attribute each subscription once, when its first purchase is recorded: to the paywall (and the experiment's variant) its owner — or a guest merged into the owner — saw first within the 7 days before that purchase, as the experiments' results count it; one that followed none is none, its renewals in any later days included. A cohort chart follows at most 120 cohorts (by day, 120 days). Answered as CSV when the request accepts text/csv first: a row a segment and period (and age, for a cohort), its value, its measures. The ledger is read customer by customer, never held whole. A customer holding more than 20,000 transactions is refused (422 chart_too_large). The same request within a minute is answered from the replica's cache (a change of the project's settings drops it there). A replica computes two charts at once and one of a project; another is refused at once as busy (503 charts_busy, Retry-After), and so is one whose reading and computing take longer than 15 seconds. A replica computes 20 charts of a project in a row, then one each 2 seconds (30 a minute); past that a chart is refused (429 too_many_charts, Retry-After) — an answer from the cache is not counted.

Called by your server, with the project's secret key.

Path

chartstring · requiredThe chart: one of GET /iap/charts's keys.

Query

fromstring (date) · optionalThe first day, YYYY-MM-DD: 30 days, 12 weeks or 12 months before `to` unless said.
tostring (date) · optionalThe last day, YYYY-MM-DD, included: today unless said (a later day is today).
resolution"day" | "week" | "month" · optionalThe periods: day, week (ISO, Monday to Sunday) or month; day unless said.
sandboxboolean · optionalCount the stores' test purchases too (Apple's sandbox, Stripe's test mode); segment or filter by sandbox to tell them apart.
segmentstring · optionalSplit the chart by a dimension (a segmentable chart's).
filterstring[] · optionalKeep what has, for each dimension named, one of the values given: one dimension:value a parameter, repeated for more (filter=store:app_store&filter=country:TR&filter=country:DE), at most 20; the value is everything after the first colon (commas and colons are the value's). A segmentable chart's.
currencystring · optionalThe currency to report money in, for this answer: one the European Central Bank publishes a reference rate for. The project's reporting currency (settings) unless said.
revenue_type"gross" | "net_of_taxes" | "proceeds" · optionalWhat of the money a monetary chart counts: gross (what customers paid), net_of_taxes, or proceeds (net of taxes and the store's commission); gross unless said. What the ledger does not state is estimated, and the answer says so (estimated).
window_daysinteger · optionalThe conversion charts' conversion timeframe and the lifetime charts' customer lifetime, in days from a customer's first day (0: that day); to now unless said.
cohort"new_customers" | "new_paying_customers" · optionalThe cohort explorer's cohorts: new_customers (by their first day; unless said) or new_paying_customers (by their first payment).
curl
curl -X GET "https://<your-ref>.palbase.studio/iap/charts/<chart>" \
  -H "apikey: $PALBASE_SECRET_KEY"

Responses

200The chart

400`resolution` is none of them (`invalid_resolution`); `from` or `to` is no day, `from` is after `to`, or they are more than two years apart, or a cohort chart's days hold more than 120 cohorts (`invalid_range`); `sandbox` is not true or false (`invalid_request`); `revenue_type` is none of them (`invalid_revenue_type`); `segment` is no dimension (`invalid_segment`) or the chart is not segmented (`segment_unsupported`); a `filter` is not dimension:value of a dimension with a value, or there are more than 20 (`invalid_filter`), or the chart is not filtered (`filter_unsupported`); `window_days` is not 0 to 730 (`invalid_window`); `cohort` is none of them (`invalid_cohort`); `currency` is not one the European Central Bank publishes (`unsupported_currency`)

401No key, not a key of this project, or a token that is not valid (the edge's answer)

403Not the project's secret key (`secret_key_required`)

404No such chart (`chart_not_found`)

422A customer of the project — or a chain no one owns — holds more than 20,000 transactions: a chart reads a customer's whole ledger at once, and refuses one past that (`chart_too_large`, naming it)

429Past the 20 charts of the project computed in a row on this replica, one more each 2 seconds (`too_many_charts`; an answer from the cache is not counted), or over the project's request limit; Retry-After says when to try again

503The charts are busy — two being computed in this replica, or one of the project — or reading the ledger took longer than 15 seconds (`charts_busy`, Retry-After); or temporarily unavailable, retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation GetChart of iap's contract.