Skip to main content
An entitlement tells your application whether a customer can use a feature right now, and how much of its allowance remains. Plans define the entitlements; Orvlin keeps the consumption up to date as usage arrives.

Check an entitlement

Call the SDK before the work you want to gate:
The amount is how much the request will consume. remaining is null when the feature has no cap.

Read all entitlements

How answers are cached

Entitlement checks sit on your request path, so the SDKs answer from a local cache: A stale answer is used for up to staleTtlMs (default 24 hours). After that, the SDK falls back to onUnavailable.
onUnavailable: 'allow' lets unknown customers use features while Orvlin is down. Only use it where a short outage is cheaper than blocking paying customers.

Warm the cache

Prefetch the customers you expect to see, such as the ones active at deploy time, so the first request does not wait:
Save the cache with snapshot() and restore it with restore() to warm a new process from a previous one.

Invalidate after a change

When you change a customer’s plan or grant them something, drop the cached answer so the next check is live:
Orvlin also sends subscription.plan_change webhooks. Invalidate on those if you cache outside the SDK.

Grant access directly

To give a customer a feature or a higher limit outside their plan, add an entitlement grant:
featureId is required. limit, reason, and expiresAt are optional. expiresAt must be in the future. Grants are invalidated in the SDK cache automatically when the API creates them. Remove a grant with DELETE /v1/entitlement-grants/:grantId.

React

In a React app, wrap components with <Feature> to show or hide them by entitlement. See React SDK.