npm packages are not installable yet: [email protected] can be published after 2026-09-16 10:30 UTC. Details
Tollstile

Access policies

Decide whether a caller has to pay, and from what.

Public Beta · early access

Policies run in order for each request. The first applicable decision wins; if a reserve decision cannot reserve enough balance, core releases that attempt and continues to the next policy.

DecisionMeaningBuilt-in
grantLet the caller through with no chargesubscriber({ active })
reservePay from a balance: reserve, then commit or releasecredits({ balance })
payRequire a payment on a railpayPerCall()
skipLet the next policy decide
toll.price("$0.01", {
  access: [subscriber({ active }), credits({ balance }), payPerCall()],
});
  • Omit access to require payment from everyone.
  • If access is set and nothing grants, reserves, or asks for payment, the request is denied with 403.
  • Policies receive the normalized context — the Web Request, the authenticated principal, and MCP details — never a framework object.

Tollstile evaluates the pricing and access policy you define; it does not decide what your service should cost.

Credits participate in Idempotency using the policy account as payer. Subscriber grants create no charge and do not deduplicate the handler.