# Create a plan

`POST /api/v1/plans`

Needs the `catalog:write` scope, or a full-access key.

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | optional | A unique value for this operation, chosen by you. A retry with the same key and the same body returns the first response instead of running again. The same key with a different body answers 409 `idempotency_key_reused`; a key whose first request is still running answers 409 `idempotency_in_progress`. |

## Request body

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "product_id": {
      "type": "string",
      "format": "uuid",
      "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "code": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "pricing_model": {
      "type": "string",
      "enum": [
        "flat",
        "per_seat",
        "metered",
        "tiered",
        "volume",
        "package"
      ]
    },
    "interval": {
      "type": "string",
      "enum": [
        "monthly",
        "quarterly",
        "annual",
        "one_time"
      ]
    },
    "amount_cents": {
      "type": "string",
      "pattern": "^\\d+$",
      "description": "Plan price, in minor units, serialized as a decimal string (also accepted as a plain integer on input).",
      "example": "1999"
    },
    "currency": {
      "type": "string",
      "enum": [
        "USD",
        "AUD",
        "CAD",
        "GBP",
        "EUR",
        "INR",
        "NPR"
      ],
      "example": "USD"
    },
    "included_units": {
      "type": "string",
      "pattern": "^\\d+$",
      "description": "Included usage units before metered overage applies, serialized as a decimal string.",
      "example": "1999"
    },
    "package_size": {
      "type": "integer",
      "exclusiveMinimum": 0
    },
    "unit_name": {
      "type": "string",
      "maxLength": 50
    },
    "billing_timing": {
      "type": "string",
      "enum": [
        "advance",
        "arrears"
      ],
      "description": "`advance` (default for new plans) invoices each period at its START; `arrears` at its end. Metered usage is always billed in arrears."
    }
  },
  "required": [
    "product_id",
    "name",
    "code",
    "pricing_model",
    "interval",
    "amount_cents",
    "currency"
  ]
}
```

## Responses

### 201

Plan created.

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        }
      },
      "required": [
        "id"
      ]
    },
    "_agent": {
      "type": "object",
      "properties": {
        "summary": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok"
          ]
        },
        "next_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "summary",
        "status",
        "next_actions",
        "warnings"
      ]
    },
    "api_version": {
      "type": "string",
      "example": "2026-07-01"
    }
  },
  "required": [
    "data",
    "_agent",
    "api_version"
  ]
}
```
