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

# Create Feature

> Add a new feature to a project

Creates a new feature in the specified project. Each project can have a maximum of 50 features.

## Endpoint

```
POST /api/v1/projects/{slug}/features
```

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer token with your API key. Requires `read_write` permission.
</ParamField>

## Path Parameters

<ParamField path="slug" type="string" required>
  The project's URL-friendly slug identifier.
</ParamField>

## Body Parameters

<ParamField body="name" type="string" required>
  Feature display name.
</ParamField>

<ParamField body="description" type="string">
  Description of the feature.
</ParamField>

<ParamField body="basePrice" type="number" required>
  Base price for this feature. Must be `>= 0`.
</ParamField>

<ParamField body="isCountable" type="boolean">
  Whether this feature tracks usage or has limits.
</ParamField>

<ParamField body="featureType" type="string">
  Type of feature. One of:

  * `"Standart"` — simple included/not-included feature
  * `"Limits"` — feature with a usage limit
  * `"Usage Based"` — metered usage feature
</ParamField>

<ParamField body="usageCount" type="number">
  Default usage count or limit value. Relevant for `"Limits"` and `"Usage Based"` types.
</ParamField>

<ParamField body="condition" type="string">
  Condition label displayed with the count (e.g. `"Up to"`, `"Unlimited"`).
</ParamField>

<ParamField body="countPrice" type="number">
  Price per unit of usage. Relevant for `"Usage Based"` type.
</ParamField>

<ParamField body="eventAggregationMethod" type="string">
  How usage events are aggregated (e.g. `"count"`, `"sum"`).
</ParamField>

## Response

Returns the created feature object with status `201 Created`.

## Example — Standard Feature

```bash theme={null}
curl -X POST https://cuprice.io/api/v1/projects/my-saas-app/features \
  -H "Authorization: Bearer cpk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Priority Support",
    "description": "24/7 priority email and chat support",
    "basePrice": 20,
    "featureType": "Standart",
    "isCountable": false
  }'
```

```json theme={null}
{
  "id": 104,
  "name": "Priority Support",
  "description": "24/7 priority email and chat support",
  "basePrice": 20,
  "featureType": "Standart",
  "isCountable": false,
  "countableData": null,
  "createdAt": "2025-10-01T09:00:00.000Z",
  "updatedAt": "2025-10-01T09:00:00.000Z"
}
```

## Example — Usage-Based Feature

```bash theme={null}
curl -X POST https://cuprice.io/api/v1/projects/my-saas-app/features \
  -H "Authorization: Bearer cpk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "API Calls",
    "description": "Monthly API request quota",
    "basePrice": 15,
    "featureType": "Usage Based",
    "isCountable": true,
    "usageCount": 10000,
    "condition": "Up to",
    "countPrice": 0.001,
    "eventAggregationMethod": "count"
  }'
```

```json theme={null}
{
  "id": 105,
  "name": "API Calls",
  "description": "Monthly API request quota",
  "basePrice": 15,
  "featureType": "Usage Based",
  "isCountable": true,
  "countableData": {
    "usageCount": 10000,
    "condition": "Up to",
    "countPrice": 0.001,
    "eventAggregationMethod": "count"
  },
  "createdAt": "2025-10-01T09:05:00.000Z",
  "updatedAt": "2025-10-01T09:05:00.000Z"
}
```

## Errors

| Status | Description                                               |
| ------ | --------------------------------------------------------- |
| `400`  | Missing `name` or `basePrice`, or `basePrice` is negative |
| `400`  | Project already has 50 features (maximum reached)         |
| `401`  | Invalid or missing API key                                |
| `403`  | API key does not have `read_write` permission             |
| `404`  | Project with the given slug not found                     |
