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

# Add Features to Plan

> Assign one or more features to a pricing plan

Assigns features to a pricing plan. You can add a single feature or multiple features in a batch request. Features that are already assigned to the plan are silently skipped.

## Endpoint

```
POST /api/v1/projects/{slug}/plans/{planId}/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>

<ParamField path="planId" type="number" required>
  The plan's unique ID.
</ParamField>

## Body Parameters

You can use **either** the single-feature format or the batch format.

### Single Feature

<ParamField body="featureId" type="number" required>
  The ID of the feature to assign to the plan.
</ParamField>

<ParamField body="multiplier" type="number">
  Multiplier for the feature (e.g. `3` means 3x the base limit). Defaults to `1`.
</ParamField>

### Batch (Multiple Features)

<ParamField body="features" type="array">
  Array of feature assignments to add in a single request.

  <Expandable title="Feature assignment object">
    <ParamField body="features[].featureId" type="number" required>
      The ID of the feature to assign.
    </ParamField>

    <ParamField body="features[].multiplier" type="number">
      Multiplier for the feature. Defaults to `1`.
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="added" type="number">
  Number of features newly assigned to the plan.
</ResponseField>

<ResponseField name="skipped" type="number">
  Number of features skipped because they were already assigned.
</ResponseField>

<ResponseField name="features" type="array">
  Updated list of all plan-feature associations with full feature details.
</ResponseField>

## Example — Single Feature

```bash theme={null}
curl -X POST https://cuprice.io/api/v1/projects/my-saas-app/plans/201/features \
  -H "Authorization: Bearer cpk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "featureId": 103,
    "multiplier": 2
  }'
```

```json theme={null}
{
  "added": 1,
  "skipped": 0,
  "features": [
    {
      "id": 301,
      "multiplier": 5,
      "feature": {
        "id": 101,
        "name": "AI Prompts",
        "featureType": "Limits",
        "basePrice": 10
      }
    },
    {
      "id": 302,
      "multiplier": 1,
      "feature": {
        "id": 102,
        "name": "Team Members",
        "featureType": "Standart",
        "basePrice": 5
      }
    },
    {
      "id": 310,
      "multiplier": 2,
      "feature": {
        "id": 103,
        "name": "API Calls",
        "featureType": "Usage Based",
        "basePrice": 15
      }
    }
  ]
}
```

## Example — Batch Add

```bash theme={null}
curl -X POST https://cuprice.io/api/v1/projects/my-saas-app/plans/200/features \
  -H "Authorization: Bearer cpk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "features": [
      { "featureId": 101, "multiplier": 1 },
      { "featureId": 102, "multiplier": 3 },
      { "featureId": 104, "multiplier": 1 }
    ]
  }'
```

```json theme={null}
{
  "added": 2,
  "skipped": 1,
  "features": [
    {
      "id": 300,
      "multiplier": 1,
      "feature": {
        "id": 101,
        "name": "AI Prompts",
        "featureType": "Limits",
        "basePrice": 10
      }
    },
    {
      "id": 311,
      "multiplier": 3,
      "feature": {
        "id": 102,
        "name": "Team Members",
        "featureType": "Standart",
        "basePrice": 5
      }
    },
    {
      "id": 312,
      "multiplier": 1,
      "feature": {
        "id": 104,
        "name": "Priority Support",
        "featureType": "Standart",
        "basePrice": 20
      }
    }
  ]
}
```

<Note>
  In the batch example, feature `101` was already assigned to the plan, so it was skipped (`added: 2, skipped: 1`).
</Note>

## Errors

| Status | Description                                   |
| ------ | --------------------------------------------- |
| `400`  | Missing `featureId` or invalid feature IDs    |
| `401`  | Invalid or missing API key                    |
| `403`  | API key does not have `read_write` permission |
| `404`  | Project, plan, or feature not found           |
