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

# Gating access to features

## Overview

In this quick start guide we'll demonstrate how to gate access to features.

The functionality that’s included in each plan is defined by a combination of features and their configuration, referred to in Stigg as **entitlements**.

## Before we begin

In order to complete this guide in your application code, please make sure that you have:

* [Modeled your pricing in Stigg](/documentation/modeling-your-pricing-in-stigg/overview)
* [Installed the Stigg JavaScript client SDK](/api-and-sdks/integration/frontend/javascript#installing-the-sdk)
* [A Stigg **publishable** key](/api-and-sdks/integration/frontend/javascript#retrieving-the-publishable-key)

## Initializing the client SDK

The first step is to initialize Stigg's client SDK with the publishable key of the environment that's integrated with Stigg, and the ID of the relevant customer.

The customer ID can usually be retrieved after a customer signs-in or restores their session.

```typescript TypeScript theme={null}
import Stigg from '@stigg/js-client-sdk';

const stiggClient = await Stigg.initialize({ 
    apiKey: 'YOUR_PUBLISHABLE_KEY',
    customerId: "customer-test-id"
});

export default stiggClient; 
```

## Checking whether the customer can access the feature

Checking whether the customer has access to the feature, is achieved in 2 steps:

1. Retrieve the customer's entitlement for the feature using the feature ID that's defined in Stigg.

```typescript TypeScript   theme={null}
const entitlement = stiggClient.getMeteredEntitlement({  
    featureId: "feature-birds",  
    options: { requestedUsage: 3 }  
});  
```

<Note>
  This example demonstrates a customer's attempt to use 3 birds of their quota at once.
</Note>

2. Use the result to check whether they have access to this functionality.

```typescript TypeScript   theme={null}
if (entitlement.hasAccess) {  
    console.log("The customer can access the feature!");  
}  
```

## Additional resources

<Card title="Stigg's frontend integration" href="/api-and-sdks/integration/overview#frontend" icon="code" horizontal />
