- Base URL
https://api.pocketsflow.com,Authorization: Bearer pk_live_…(orpk_test_…for test mode). - Requires the Pro plan: below it, writes answer
403 FEATURE_LOCKED(details.requiredPlan: "tier3"). Reading usage stays available after a downgrade. - Money is integer cents in your account currency.
{id}on the subscriber endpoints is the subscriber_idfromGET /subscriptions/subscribersor its membership id (mem_…). On/usage-pricingit is the subscription offer id.
The SDK methods below ship in the next
pocketsflow release. Until then,
call the endpoints directly (curl examples) or use the MCP tools.Set seats and meters on an offer
PUT /subscriptions/{id}/usage-pricing replaces the offer’s usage pricing.
Sending { "seats": { "enabled": false }, "meters": [] } switches back to flat
pricing (always allowed). The same usagePricing object is also accepted by
POST /subscriptions when you create an offer.
At most 5 meters per offer.
Report usage
POST /subscriptions/{id}/usage
Idempotency. The first report with a key answers
201 with
replayed: false. Retrying the same key with the same body answers 200 with
the original record and replayed: true — it is counted once, even when
retries race. The same key with a different body is refused with
409 IDEMPOTENCY_KEY_REUSED. Without a key every request counts.
Rate limit. 300 reports per minute per subscriber (inside the account’s
600 requests per minute). Aggregate before reporting — one report with
quantity: 500 costs the same as 500 reports with quantity: 1.
Response 201
Read usage
GET /subscriptions/{id}/usage?limit=20 returns the current period’s running
totals and upcoming overage, a per-day series, the latest reports (limit,
max 100) and the last 12 closed periods with their charge status.
Response (trimmed)
periods[].charge.status is not_due, processing, paid, failed, due
or uncollectible. Failed and due charges are retried 1, 3, 5 and 7 days
after the first failure (retries, nextRetryAt); a paid overage is an order
(saleId, billingReason: "usage" on GET /orders and the subscriber’s
payments).
The seats line counts seat-periods above the seats bought at checkout:
two extra seats held for 80% of the period are 1.6.
Change seats
POST /subscriptions/{id}/seats with { "quantity": 5 }. Takes effect at
once; seats above the quantity bought at checkout are billed at the end of the
period, prorated. Below the bought quantity answers
409 BELOW_PURCHASED_SEATS; an inactive subscription 409 SUBSCRIPTION_INACTIVE;
outside the offer’s min / max 400.
Errors
MCP tools
The MCP server exposes the same operations:update_usage_pricing, report_usage, get_subscription_usage and
update_subscription_seats.
Webhooks
usage.recorded (each new report) and usage.period_closed (totals and the
overage charge) — payloads in Webhook events.