palbaseDocs

Palbase IAP · API

POST/iap/placements/{placement}/exposures

Report a paywall shown

Counts that the app showed a version of a paywall at a placement, to the signed-in user (a guest included) or else the installation (X-Palbase-Installation; 400 installation_required without either). variant and rule_id are what the answer named — claims, checked against the placement as it is: the rule is written when it is one of the placement's and shows the paywall reported (or sends to the experiment of the variant counted); the variant counts when its experiment runs for the whole placement, or the rule reported sends to it, and it is the subject's own variant there. A claim that does not hold leaves the exposure to the paywall alone — none is refused: what was shown before the viewer bought, before a schedule turned, before the rules were edited still counts. The same subject, paywall version and placement count once in ten minutes; in a project, one address (an IPv6 /64 is one) reports at most 60 a minute, and at most 20 a minute are taken for one subject (429 too_many_exposures, Retry-After); another project's are its own, and reading the placement's paywall is never limited by them. Purchases are never reported here: they are the ones the stores confirmed, read from the ledger.

Called by your app, with the publishable key; or a signed-in user of your app, with their token and the publishable key; or your server, with the project's secret key.

Path

placementstring · requiredThe placement's key: the place in the app a paywall is shown, as the app names it.

Headers

X-Palbase-Installationstring · optionalThe installation's id, as the SDK keeps it: who the paywall is shown to before anyone signs in. A signed-in user (a guest included) is who it is shown to, the installation aside.

Request body

paywall_idstring (uuid) · requiredThe paywall.
rule_idstring (uuid) · optionalThe rule the answer named, when it named one.
variantstring · optionalThe variant the answer named, when it named one.
versioninteger · requiredIts version.
curl
curl -X POST "https://<your-ref>.palbase.studio/iap/placements/<placement>/exposures" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"paywall_id":"00000000-0000-0000-0000-000000000000","version":1}'

Responses

204Counted

400No signed-in user and no X-Palbase-Installation (`installation_required`); an installation that is not one (`invalid_installation`); a user id longer than 128 (`invalid_user`); or the body is malformed; rule_id is not a rule's id (`invalid_rule`)

401Not a key of the project (`key_required`), or the edge refused the key or token

404No such placement (`placement_not_found`)

413The request body is too large (`request_too_large`)

422The paywall has no such version (`unknown_paywall_version`)

429Over 60 exposures a minute from this address or 20 for this subject, in this project (`too_many_exposures`), or over the project's request limit; Retry-After says when to try again

503Temporarily unavailable; retrying is safe after Retry-After

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

Operation RecordPaywallExposure of iap's contract.