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.
| Decision | Meaning | Built-in |
|---|---|---|
grant | Let the caller through with no charge | subscriber({ active }) |
reserve | Pay from a balance: reserve, then commit or release | credits({ balance }) |
pay | Require a payment on a rail | payPerCall() |
skip | Let the next policy decide | — |
toll.price("$0.01", {
access: [subscriber({ active }), credits({ balance }), payPerCall()],
});- Omit
accessto require payment from everyone. - If
accessis set and nothing grants, reserves, or asks for payment, the request is denied with403. - Policies receive the normalized context — the Web
Request, the authenticatedprincipal, 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.