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

# The can() Endpoint

> Deep-dive into GET /api/v1/can

The `can()` endpoint is the core of Nozle's entitlement system.

## Request

```
GET /api/v1/can?customer_id=cust_123&feature=api_calls
Authorization: Bearer sk_nozle_...
```

Call this endpoint from a trusted backend with a restricted secret key. Derive `cust_123` from the authenticated application user; publishable keys are rejected.

## Response

```json theme={null}
{
  "allowed": true,
  "used": 1500,
  "limit": 10000,
  "remaining": 8500,
  "cost_per_use_cents": 2,
  "revenue_per_use_cents": 5,
  "margin_per_use_cents": 3,
  "min_margin_percent": 20
}
```

## Field reference

| Field                   | Type      | Description                                  |
| ----------------------- | --------- | -------------------------------------------- |
| `allowed`               | `boolean` | Whether the customer can use this feature    |
| `reason`                | `string?` | Why access was denied (if `!allowed`)        |
| `used`                  | `number`  | Current usage count this billing period      |
| `limit`                 | `number`  | Usage cap for this feature                   |
| `remaining`             | `number`  | `limit - used`                               |
| `cost_per_use_cents`    | `number`  | Your cost per unit (from cost model)         |
| `revenue_per_use_cents` | `number`  | What you charge per unit (from plan pricing) |
| `margin_per_use_cents`  | `number`  | `revenue - cost` per unit                    |
| `min_margin_percent`    | `number?` | Minimum margin threshold if configured       |

## Runtime behavior

The service may cache entitlement and usage state. Always treat the returned decision as point-in-time and enforce it immediately before protected work.

## Denial reasons

* No active subscription
* Feature not included in plan
* Usage limit exceeded
* Subscription expired/cancelled

## SDK wrappers

**Node:**

```ts theme={null}
nozle.can('cust_123', 'api_calls')
```

**Python:**

```python theme={null}
nozle.can('cust_123', 'api_calls')
```

**React:** fetch the result through your authenticated backend and pass it to `FeatureGate`, `UsageGate`, or your own UI.
