Query
Passing
options.requestedUsage evaluates the check against a specific amount of usage before it’s consumed — the recommended way to gate an action. See Checking, gating, and reporting usage for the full pattern.Parameters
FetchEntitlementQuery
required
Query parameters for fetching the entitlement
Return Type
entitlementV2 returns a union of FeatureEntitlement or CreditEntitlement, depending on whether the query was made with featureId or currencyId. Select fields for each type using inline fragments (... on FeatureEntitlement, ... on CreditEntitlement).
Fields common to both:
FeatureEntitlement-only fields:
CreditEntitlement-only fields:
Access Denied Reasons
Common Use Cases
Feature gating
Feature gating
Check access before showing/enabling a feature.
Usage checking
Usage checking
Verify if customer can perform an action based on usage limits.
Upgrade prompts
Upgrade prompts
Check limits to show upgrade prompts when approaching limits.
Example: Check Before Action
Checking with
requestedUsage set to the exact amount you’re about to consume is what makes the gate accurate — checking currentUsage >= usageLimit against a stale cached value, or reporting usage before gating, can let one extra request through on a hard limit. See Checking, gating, and reporting usage for details.Related Operations
- Get Entitlements - Get all entitlements
- Entitlements State - Get entitlements with access state
- Report Usage - Report usage
