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

# Features Overview

> Features define what each plan unlocks for your customers — usage limits, boolean flags, and custom entitlements.

Features are the entitlement layer of Fluxrate. They sit between your raw usage meters and your billing plans, letting you precisely define what a customer can do on a given plan.

## Why Features?

Instead of just billing customers per unit, you can also **control access** to capabilities. A "Starter" plan might include:

* ✅ Up to 10,000 API calls/month (meter feature with limit)
* ✅ Access to the Analytics dashboard (switch feature = true)
* ✅ 1 workspace (custom feature = "1")
* ❌ Advanced exports (switch feature = false)

Features attached to plans create a complete picture of what each tier offers.

## Feature Types

<CardGroup cols={3}>
  <Card title="Meter" icon="gauge" href="/guide/features/meter-features">
    Quantitative entitlements backed by usage tracking. Set limits and reset periods.
  </Card>

  <Card title="Switch" icon="toggle-on" href="/guide/features/switch-features">
    Boolean on/off flags for capabilities that are simply enabled or disabled.
  </Card>

  <Card title="Custom" icon="sliders" href="/guide/features/custom-features">
    Arbitrary text or numeric values. Use for seats, workspace limits, retention periods, etc.
  </Card>
</CardGroup>

## Creating Features

Features are created in **Dashboard → Features** or via the API.

<Tabs>
  <Tab title="Meter Feature">
    ```bash theme={null}
    curl -X POST https://api.fluxrate.co/api/v1/features \
      -H "Content-Type: application/json" \
      -H "Cookie: access_token=<token>" \
      -d '{
        "name": "API Calls",
        "lookup_key": "api_calls",
        "type": "meter",
        "meter_name": "api_calls",
        "property_name": "call_count",
        "aggregation_type": "SUM",
        "unit": "calls"
      }'
    ```
  </Tab>

  <Tab title="Switch Feature">
    ```bash theme={null}
    curl -X POST https://api.fluxrate.co/api/v1/features \
      -H "Content-Type: application/json" \
      -H "Cookie: access_token=<token>" \
      -d '{
        "name": "Analytics Dashboard",
        "lookup_key": "analytics_dashboard",
        "type": "switch"
      }'
    ```
  </Tab>

  <Tab title="Custom Feature">
    ```bash theme={null}
    curl -X POST https://api.fluxrate.co/api/v1/features \
      -H "Content-Type: application/json" \
      -H "Cookie: access_token=<token>" \
      -d '{
        "name": "Max Workspaces",
        "lookup_key": "max_workspaces",
        "type": "custom"
      }'
    ```
  </Tab>
</Tabs>

## Feature Lifecycle

1. **Create** a feature (choose type)
2. **Attach** the feature to a plan with entitlement rules (limit, enabled/disabled, value)
3. **Customer subscribes** to the plan → inherits feature entitlements
4. **Check entitlements** in your app using the Fluxrate API to gate features

## Attaching Features to Plans

When adding a feature to a plan, you configure the specific entitlement for that plan tier:

```bash theme={null}
curl -X POST https://api.fluxrate.co/api/v1/plans/<plan_id>/features \
  -H "Content-Type: application/json" \
  -H "Cookie: access_token=<token>" \
  -d '{
    "feature_id": "<feature_id>",
    "is_enabled": true,
    "usage_limit": 10000,
    "usage_reset_period": "month",
    "is_soft_limit": false
  }'
```

| Field                | Description                                              |
| -------------------- | -------------------------------------------------------- |
| `is_enabled`         | Whether this feature is on for this plan                 |
| `usage_limit`        | For meter features: max usage allowed (null = unlimited) |
| `usage_reset_period` | When the limit resets: `day`, `week`, `month`, `year`    |
| `is_soft_limit`      | If `true`, access is not blocked when limit is exceeded  |
| `static_value`       | For custom features: the entitlement value (e.g., "5")   |

<Warning>
  A feature cannot be deleted if it is associated with any active plans. Remove it from all plans first.
</Warning>
