Tollstile

Access policies

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

Pre-release · planned API

Policies run in order for each request. The first decision that is not skip wins.

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.