> ## 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.

# Get Entitlements

Retrieves all entitlements for a customer, providing a complete picture of their feature access.

<Tip>
  To benefit from Stigg's low-latency capabilities, use the [Sidecar](/api-and-sdks/integration/backend/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](https://node-sdk-docs.stigg.io/classes/stigg) provides equivalent low-latency caching natively in-process.
</Tip>

## Query

<CodeGroup>
  ```graphql Query theme={null}
  query GetEntitlements($query: FetchEntitlementsQuery!) {
    entitlements(query: $query) {
      feature {
        refId
        displayName
        featureType
        featureUnits
        featureUnitsPlural
      }
      isGranted
      hasUnlimitedUsage
      usageLimit
      currentUsage
      resetPeriod
      usagePeriodStart
      usagePeriodEnd
      hasSoftLimit
      enumValues
      summaries {
        isEffectiveEntitlement
        plan {
          refId
          displayName
        }
        featurePackageEntitlement {
          usageLimit
        }
        addonQuantity
      }
    }
  }
  ```

  ```json Variables theme={null}
  {
    "query": {
      "customerId": "customer-123"
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "entitlements": [
        {
          "feature": {
            "refId": "feature-api-calls",
            "displayName": "API Calls",
            "featureType": "NUMBER",
            "featureUnits": "call",
            "featureUnitsPlural": "calls"
          },
          "isGranted": true,
          "hasUnlimitedUsage": false,
          "usageLimit": 10000,
          "currentUsage": 4532,
          "resetPeriod": "MONTH",
          "usagePeriodStart": "2024-01-01T00:00:00Z",
          "usagePeriodEnd": "2024-02-01T00:00:00Z",
          "hasSoftLimit": false,
          "enumValues": null,
          "summaries": [
            {
              "isEffectiveEntitlement": true,
              "plan": {
                "refId": "plan-pro",
                "displayName": "Pro Plan"
              },
              "featurePackageEntitlement": {
                "usageLimit": 10000
              },
              "addonQuantity": null
            }
          ]
        },
        {
          "feature": {
            "refId": "feature-sso",
            "displayName": "Single Sign-On",
            "featureType": "BOOLEAN",
            "featureUnits": null,
            "featureUnitsPlural": null
          },
          "isGranted": true,
          "hasUnlimitedUsage": false,
          "usageLimit": null,
          "currentUsage": null,
          "resetPeriod": null,
          "usagePeriodStart": null,
          "usagePeriodEnd": null,
          "hasSoftLimit": false,
          "enumValues": null,
          "summaries": [
            {
              "isEffectiveEntitlement": true,
              "plan": {
                "refId": "plan-pro",
                "displayName": "Pro Plan"
              },
              "featurePackageEntitlement": {
                "usageLimit": null
              },
              "addonQuantity": null
            }
          ]
        }
      ]
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="query" type="FetchEntitlementsQuery" required>
  Query parameters for fetching entitlements

  <Expandable title="properties">
    <ParamField body="customerId" type="String" required>
      The customer's reference ID
    </ParamField>

    <ParamField body="resourceId" type="String">
      Resource ID for multi-resource entitlements
    </ParamField>

    <ParamField body="environmentId" type="UUID">
      Environment ID
    </ParamField>
  </Expandable>
</ParamField>

## Return Type

Returns an array of `EntitlementWithSummary` objects containing:

| Field               | Type                   | Description               |
| ------------------- | ---------------------- | ------------------------- |
| `feature`           | EntitlementFeature     | Feature details           |
| `isGranted`         | Boolean                | Whether access is granted |
| `hasUnlimitedUsage` | Boolean                | Unlimited usage flag      |
| `usageLimit`        | Float                  | Maximum allowed usage     |
| `currentUsage`      | Float                  | Current consumption       |
| `resetPeriod`       | EntitlementResetPeriod | When usage resets         |
| `hasSoftLimit`      | Boolean                | Soft vs hard limit        |
| `enumValues`        | \[String]              | Values for enum features  |
| `summaries`         | \[EntitlementSummary]  | Breakdown by source       |

## Common Use Cases

<AccordionGroup>
  <Accordion title="Initialize app permissions">
    Fetch all entitlements on app load to configure feature flags.
  </Accordion>

  <Accordion title="Display feature access">
    Show customers what features they have access to.
  </Accordion>

  <Accordion title="Usage dashboard">
    Build usage dashboards showing all metered features.
  </Accordion>
</AccordionGroup>

## Example: Initialize Feature Flags

```javascript theme={null}
const { data } = await client.query({
  query: GET_ENTITLEMENTS,
  variables: {
    query: { customerId: user.customerId }
  }
});

const featureFlags = {};

data.entitlements.forEach(e => {
  featureFlags[e.feature.refId] = {
    enabled: e.isGranted,
    limit: e.hasUnlimitedUsage ? Infinity : e.usageLimit,
    usage: e.currentUsage || 0
  };
});

// Use in app
if (featureFlags['feature-sso'].enabled) {
  enableSSO();
}
```

## Related Operations

* [Get Entitlement](/api-and-sdks/api-reference/queries/get-entitlement) - Get specific entitlement
* [Entitlements State](/api-and-sdks/api-reference/queries/entitlements-state) - With access state
