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

# Entitlements

> Check feature access, usage limits, and margin estimates from a trusted backend.

```go theme={null}
import nozle "github.com/nozle-dev/nozle-go"

client := nozle.New("") // reads NOZLE_SECRET_KEY

result, err := client.Can(ctx, "workspace_123", "agent_execution")
if err == nil && result.Allowed {
  // Run the permitted operation.
}
```

`Can` reads Engine `/api/v1/can`; `CanWithMetadata` also sends JSON metadata for the cost and margin estimate. For credit-backed features, `CheckUsage` provides an advisory projection and `TrackUsage` enforces and records the deduction atomically.

## Metadata

```go theme={null}
result, err := client.CanWithMetadata(ctx, "workspace_123", "model_access", map[string]any{
  "model": "example-large-model", "region": "us-east",
})
_ = result
_ = err
```

Metadata can include quantities required by a Cost Rule. It is input to the cost and margin estimate only. It does not filter usage: `Used`, `Limit` and `Remaining` always cover all of the feature's usage, whatever `model` or other properties you send.

## `CanResult`

| Field | Meaning |
| - | - |
| `Allowed`, `Reason` | Access decision and reason. |
| `Used`, `Overage` | Usage so far, and whether a soft limit is reached. `Overage` never denies by itself: the usage is billed as overage. Deny only on `Allowed == false`. |
| `Limit`, `Remaining` | `*int`. `nil` when the feature is unlimited (the API sends `null`), never `0`: a `0` allowance means none left. Check `Limit != nil` before reading either. |
| `Economics` | Optional point-in-time estimate with exact `nozle.Decimal` values, Cost Rule versions, and exclusions. |

Check immediately before protected server work. React gates are not an authorization boundary. `Can` does not reserve product credits.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.