Skip to main content
The useFeatureAccess hook lets you read a customer’s feature access and usage from your backend routes and use it directly in your UI.
Setup first: see the React integration guide.

Parameters

featureKey
keyof MyFeatures
required
Feature key to read. Returns flattened fields for that feature plus isLoading, error, and refetch.
options.enabled
boolean
Enable or disable fetching. Defaults to true.
options.errorOnNotFound
boolean
When true, a 404 is surfaced as an error instead of returning null. Defaults to false.
options.swr
SWRConfiguration<MyFeatures | null, Error>
Optional SWR config for caching/revalidation behavior.

Returns

type
boolean (literal)
Feature type.
hasAccess
boolean
Whether the customer has access to the selected boolean feature.
isLoading
boolean
Whether data is currently loading.
error
Error | null
Error from the latest request.
refetch
() => Promise<void>
Manually revalidate feature access.

Examples

Single feature access

All feature access

Displaying usage to user

Determine if limit has been hit using PriceOS

Determine if limit has been hit using your own tracking

Displaying bonuses to users