Skip to main content
Retrieves all entitlements for a customer along with the overall access state, including reasons for denied access.

Query

query GetEntitlementsState($query: FetchEntitlementsQuery!) {
  entitlementsState(query: $query) {
    accessDeniedReason
    entitlements {
      feature {
        refId
        displayName
        featureType
        featureUnits
      }
      isGranted
      hasUnlimitedUsage
      usageLimit
      currentUsage
      resetPeriod
      usagePeriodEnd
      accessDeniedReason
    }
  }
}

Parameters

query
FetchEntitlementsQuery
required
Query parameters for fetching entitlements state

Return Type

Returns an EntitlementsState object with:
FieldTypeDescription
accessDeniedReasonEntitlementsStateAccessDeniedReasonGlobal access denial reason
entitlements[Entitlement]List of entitlements

Global Access Denied Reasons

ReasonDescription
CustomerNotFoundCustomer doesn’t exist
CustomerIsArchivedCustomer is archived
NoActiveSubscriptionNo active subscription

Common Use Cases

Recommended for initial entitlement fetch - provides both entitlements and overall access state.
Global accessDeniedReason helps handle cases where customer has no subscription.

Example: Handling Access State

const { data } = await client.query({
  query: GET_ENTITLEMENTS_STATE,
  variables: {
    query: { customerId: user.customerId }
  }
});

const { accessDeniedReason, entitlements } = data.entitlementsState;

if (accessDeniedReason === 'CustomerNotFound') {
  // Customer doesn't exist in Stigg
  redirectToSignup();
  return;
}

if (accessDeniedReason === 'NoActiveSubscription') {
  // Customer exists but needs a subscription
  showPricingPage();
  return;
}

if (accessDeniedReason === 'CustomerIsArchived') {
  // Customer account is deactivated
  showReactivationPrompt();
  return;
}

// Process entitlements normally
initializeFeatureFlags(entitlements);