--- title: "Create a plan" openapi: "openapi POST /v1/plans.create" --- import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; Creates a new plan with optional base price and feature configurations. See [How plans work](/documentation/pricing/plans) for concepts and [Adding features to plans](/documentation/pricing/plan-features) for item configuration. ### Plan Configuration A plan consists of: - **Base price** - optional recurring charge for the plan itself - **Items** - feature configurations defining what customers get and how they're billed ### Configuring Items Each item in the `items` array configures a single feature. There are two types: **Consumable features** (API calls, messages, credits): - Set `included` for free units that reset each period - Set `reset.interval` to define when balance resets to `included` - Optionally add `price` for usage beyond included amount **Non-consumable features** (seats, storage): - Set `included` for the base allocation - Do NOT set `reset` - usage persists across billing cycles - Use `billing_method: "prepaid"` for upfront payment per unit ### Common Use Cases ```typescript Free plan with auto-enable await autumn.plans.create({ planId: "free_plan", name: "Free", autoEnable: true, // Automatically attached on customer creation items: [ { featureId: "messages", included: 100, reset: { interval: "month" } } ] }); ``` ```typescript Paid plan with base price + usage-based feature await autumn.plans.create({ planId: "pro_plan", name: "Pro Plan", price: { amount: 10, interval: "month" }, items: [ { featureId: "messages", included: 1000, reset: { interval: "month" }, price: { amount: 0.01, interval: "month", billingUnits: 1, billingMethod: "usage_based" } } ] }); ``` ```typescript Plan with prepaid seats await autumn.plans.create({ planId: "team_plan", name: "Team Plan", price: { amount: 49, interval: "month" }, items: [ { featureId: "seats", included: 5, // No reset - seats persist across billing cycles price: { amount: 10, interval: "month", billingUnits: 1, billingMethod: "prepaid" } } ] }); ``` ```typescript Add-on plan await autumn.plans.create({ planId: "analytics_addon", name: "Advanced Analytics", addOn: true, // Can be attached alongside other plans price: { amount: 20, interval: "month" } }); ``` ```typescript Plan with tiered pricing await autumn.plans.create({ planId: "api_plan", name: "API Plan", items: [ { featureId: "api_calls", included: 1000, reset: { interval: "month" }, price: { tiers: [ { to: 10000, amount: 0.001 }, { to: 100000, amount: 0.0005 }, { to: "inf", amount: 0.0001 } ], interval: "month", billingUnits: 1, billingMethod: "usage_based" } } ] }); ``` ```typescript Plan with free trial await autumn.plans.create({ planId: "premium_plan", name: "Premium", price: { amount: 99, interval: "month" }, freeTrial: { durationLength: 14, durationType: "day", cardRequired: true } }); ``` ### Body Parameters The ID of the plan to create. Group identifier for organizing related plans. Plans in the same group are mutually exclusive. Display name of the plan. Optional description of the plan. If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. If true, plan is automatically attached when a customer is created. Use for free tiers. Base recurring price for the plan. Omit for free or usage-only plans. Base price amount for the plan. Billing interval (e.g. 'month', 'year'). Number of intervals per billing cycle. Defaults to 1. Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. The ID of the feature to configure. Number of free units included. Balance resets to this each interval for consumable features. If true, customer has unlimited access to this feature. Reset configuration for consumable features. Omit for non-consumable features like seats. Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. Number of intervals between resets. Defaults to 1. Pricing for usage beyond included units. Omit for free features. Price per billing_units after included usage. Either 'amount' or 'tiers' is required. Tiered pricing. Either 'amount' or 'tiers' is required. Billing interval. For consumable features, should match reset.interval. Number of intervals per billing cycle. Defaults to 1. Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. Proration settings for prepaid features. Controls mid-cycle quantity change billing. Billing behavior when quantity increases mid-cycle. Credit behavior when quantity decreases mid-cycle. Rollover config for unused units. If set, unused included units carry over. Max rollover units. Omit for unlimited rollover. When rolled over units expire. Number of periods before expiry. Free trial configuration. Customers can try this plan before being charged. Number of duration_type periods the trial lasts. Unit of time for the trial ('day', 'month', 'year'). If true, payment method required to start trial. Customer is charged after trial ends. ### Response Unique identifier for the plan. Display name of the plan. Optional description of the plan. Group identifier for organizing related plans. Plans in the same group are mutually exclusive. Version number of the plan. Incremented when plan configuration changes. Whether this is an add-on plan that can be attached alongside a main plan. If true, this plan is automatically attached when a customer is created. Used for free plans. Base recurring price for the plan. Null for free plans or usage-only plans. Base price amount for the plan. Billing interval (e.g. 'month', 'year'). Number of intervals per billing cycle. Defaults to 1. Display text for showing this price in pricing pages. Main display text (e.g. '$10' or '100 messages'). Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. The ID of the feature this item configures. The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. The name of the feature. The type of the feature Singular and plural display names for the feature. The singular display name for the feature. The plural display name for the feature. Credit cost schema for credit system features. The ID of the metered feature (should be a single_use feature). The credit cost of the metered feature. Whether or not the feature is archived. Number of free units included. For consumable features, balance resets to this number each interval. Whether the customer has unlimited access to this feature. Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. Number of intervals between resets. Defaults to 1. Pricing configuration for usage beyond included units. Null if feature is entirely free. Price per billing_units after included usage is consumed. Mutually exclusive with tiers. Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. Billing interval for this price. For consumable features, should match reset.interval. Number of intervals per billing cycle. Defaults to 1. Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. Display text for showing this item in pricing pages. Main display text (e.g. '$10' or '100 messages'). Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). Rollover configuration for unused units. If set, unused included units roll over to the next period. Maximum rollover units. Null for unlimited rollover. When rolled over units expire. Number of periods before expiry. Free trial configuration. If set, new customers can try this plan before being charged. Number of duration_type periods the trial lasts. Unit of time for the trial duration ('day', 'month', 'year'). Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. Unix timestamp (ms) when the plan was created. Environment this plan belongs to ('sandbox' or 'live'). Whether the plan is archived. Archived plans cannot be attached to new customers. If this is a variant, the ID of the base plan it was created from. Whether a free trial is available for this customer. The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). ```json 200 { "id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "addOn": false, "autoEnable": false, "price": { "amount": 10, "interval": "month", "display": { "primaryText": "$10", "secondaryText": "per month" } }, "items": [ { "featureId": "messages", "included": 100, "unlimited": false, "reset": { "interval": "month" }, "price": { "amount": 0.5, "interval": "month", "billingUnits": 100, "billingMethod": "usage_based", "maxPurchase": null }, "display": { "primaryText": "100 messages", "secondaryText": "then $0.5 per 100 messages" } }, { "featureId": "users", "included": 0, "unlimited": false, "reset": null, "price": { "amount": 10, "interval": "month", "billingUnits": 1, "billingMethod": "prepaid", "maxPurchase": null }, "display": { "primaryText": "$10 per Users" } } ], "createdAt": 1771513979217, "env": "sandbox", "archived": false, "baseVariantId": null } ```