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

# The Feature object

> Define, list, update, and manage catalog features that gate access and power entitlements across your subscription plans.

Features are the foundational building blocks of access control in ArcenPay. A feature represents a distinct capability, gate, or metered quota in your product (e.g. `analytics_export`, `seat_limit`, `ai_tokens`).

Once defined, features can be attached to **Plans** with specific allocations, overridden at the **Company** level, or targeted dynamically via **Rules**.

***

## The Feature object

```json theme={null}
{
  "id": "cflag_01h9zabc123",
  "name": "Analytics Export",
  "featureKey": "analytics_export",
  "featureType": "boolean",
  "eventKey": "export_generated",
  "icon": "bar-chart-2",
  "description": "Ability to export reporting data to CSV, PDF, and Parquet",
  "linkedPlans": [
    {
      "id": "plan_pro",
      "name": "Pro Plan",
      "tier": "PRO"
    }
  ],
  "createdAt": "2026-03-15T12:00:00.000Z"
}
```

### Attributes

| Attribute     | Type           | Description                                                                                                       |
| ------------- | -------------- | ----------------------------------------------------------------------------------------------------------------- |
| `id`          | string         | Unique identifier for the feature (`cflag_…`).                                                                    |
| `name`        | string         | Human-readable name displayed across the dashboard and client embeds.                                             |
| `featureKey`  | string         | The immutable slug used in code access checks (`checkEntitlement("analytics_export")`).                           |
| `featureType` | string         | One of `boolean` (on/off gate), `event` (metered quota driven by events), or `trait` (attribute-based condition). |
| `eventKey`    | string \| null | When `featureType` is `event`, the event key that increments usage (e.g. `export_generated`).                     |
| `icon`        | string \| null | Lucide icon identifier for UI rendering in customer portals and checkout components.                              |
| `description` | string \| null | Internal documentation explaining the capability.                                                                 |
| `linkedPlans` | array          | Plans in your catalog that include this feature as an entitlement.                                                |
| `createdAt`   | string         | ISO 8601 creation timestamp.                                                                                      |

***

## Feature types

ArcenPay supports three primary feature types:

1. **Boolean (`boolean`)**
   Binary on/off capabilities. Either a company has access or they do not.
   *Example:* `custom_domains`, `sso_saml`, `priority_support`.

2. **Event-based / Metered (`event`)**
   Features tied to consumption counters. When an event is recorded or `/usage/consume` is called, units are deducted from the company's plan allocation or credit grant.
   *Example:* `api_calls_monthly`, `ai_credits`, `team_seats`.

3. **Trait-based (`trait`)**
   Access dynamically evaluated from company traits, wallet properties, or zkTLS verifiable credentials.
   *Example:* `beta_tester`, `country_us`, `dao_token_holder`.

***

## Endpoints

| Method   | Path                    | Description                                      |
| -------- | ----------------------- | ------------------------------------------------ |
| `GET`    | `/api/v1/features`      | List all catalog features and their linked plans |
| `POST`   | `/api/v1/features`      | Create a new feature in your catalog             |
| `PUT`    | `/api/v1/features/{id}` | Update an existing feature's metadata or type    |
| `DELETE` | `/api/v1/features/{id}` | Delete a feature from your catalog               |

***

## Usage in code

After creating features, use the ArcenPay Node.js SDK to check access server-side:

```typescript theme={null}
import { ArcenClient } from "@arcenpay/node";

const client = new ArcenClient({ apiKey: process.env.ARCENPAY_SECRET_KEY! });

// Check boolean access
const { enabled } = await client.checkEntitlement({
  companyId: "cm_acme_corp",
  featureKey: "analytics_export",
});

if (!enabled) {
  throw new Error("Upgrade required to export analytics.");
}
```
