> ## Documentation Index
> Fetch the complete documentation index at: https://docs.billingos.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# useEntitlements

> Check entitlements, verify feature access, and monitor usage limits.

## Hooks

### useCheckEntitlement

Check a single entitlement for a customer.

```tsx theme={null}
import { useCheckEntitlement } from "@billingos/sdk";

const { data } = useCheckEntitlement("cus_123", "custom_branding");
// data.has_access: boolean
// data.limit: number | undefined
// data.usage: number | undefined
```

**Parameters:**

| Name         | Type     | Description          |
| ------------ | -------- | -------------------- |
| `customerId` | `string` | Customer ID          |
| `featureKey` | `string` | Feature key to check |

***

### useHasFeature

Boolean shorthand — returns `true` or `false`.

```tsx theme={null}
import { useHasFeature } from "@billingos/sdk";

const canExport = useHasFeature("cus_123", "export_pdf");

if (canExport) {
  // Show export button
}
```

***

### useEntitlements

List all entitlements for a customer.

```tsx theme={null}
import { useEntitlements } from "@billingos/sdk";

const { data } = useEntitlements("cus_123");

// data: Entitlement[]
```

***

### useIsApproachingLimit

Returns `true` when usage is within a threshold of the limit (default: 80%).

```tsx theme={null}
import { useIsApproachingLimit } from "@billingos/sdk";

const isNearLimit = useIsApproachingLimit("cus_123", "api_calls", 80);

if (isNearLimit) {
  // Show upgrade nudge
}
```

**Parameters:**

| Name         | Type     | Default | Description          |
| ------------ | -------- | ------- | -------------------- |
| `customerId` | `string` | —       | Customer ID          |
| `featureKey` | `string` | —       | Feature key          |
| `threshold`  | `number` | `80`    | Percentage threshold |

## Entitlement object

```typescript theme={null}
interface Entitlement {
  feature_key: string
  has_access: boolean
  limit?: number
  usage?: number
  metadata?: Record<string, string>
}
```
