Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.stigg.io/llms.txt

Use this file to discover all available pages before exploring further.

Retrieves all entitlements for a customer along with the overall access state, including reasons for denied access.
To benefit from Stigg’s low-latency capabilities, use the Sidecar — it serves entitlement checks from a local cache without a network round-trip per request, with built-in fallback handling. For Node.js applications, the Node.js SDK provides equivalent low-latency caching natively in-process.

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);