Skip to main content
POST
Create a subscription

Authorizations

Authorization
string
header
required

Your account's secret key: Authorization: Bearer sk_test_… or sk_live_…. Server-side only.

Headers

Idempotency-Key
string

A unique key per operation (a UUID works). Retrying with the same key returns the original response.

Path Parameters

productID
string<uuid>
required

Product ID.

Body

application/json
customerId
string<uuid>
required

The customer's enrollment id for this product.

productVersionId
string<uuid> | null

The product version the subscription bills. Defaults to the latest published version.

anchor
string<date-time> | null

When the billing cycle starts, which sets the day of later charges. Defaults to the time of creation.

items
object[]

What the subscription bills, item by item. Each item has a kind: recurring_fee (a fixed fee, with timing advance to bill at the start of the period or arrears to bill at the end; defaults to advance), credit_grant (credits granted each cycle) or metered_usage (metered usage, billed at the end of the period). Only recurring_fee takes timing. When omitted, items follow the product's pricing model: a prepaid product bills the fee up front and grants credits; any other bills the fee and usage at the end of the period.

Response

Created.

subscription
object
period
object

One billing window of a subscription. Metered usage lands in the open period.