latestOpenAPI 3.0.1AGPL-3.0raw.githubusercontent.com2026-08-21258508903.8 KB

d567e8585c2e

Subscriptions

Execute a plan change (v2, swap in place)

Change a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction.

change_at controls timing. Omitted or 'immediate' applies the change now. 'end_of_period' records a pending schedule that executes at the subscription's current period end: the response returns is_scheduled, schedule_id and scheduled_at instead of a completed change, and nothing is swapped or billed until the boundary.

scheduled_at is resolved from the subscription's current period end at request time. If that period end is already in the past (a backdated start date, a resumed pause, or worker downtime can all leave a subscription behind), the change is due immediately and fires on the next billing scan rather than a period away — inspect scheduled_at to see this.

Only one plan change may be pending per subscription; request a second one and this returns 400. Cancel the existing schedule via POST /subscriptions/schedules/{schedule_id}/cancel first. Pending schedules are listable via GET /subscriptions/{id}/schedules.

post/subscriptions/{id}/change/v2/execute

Path parameters

idstring required

Subscription ID

Request body

change_at'immediate' | 'end_of_period'
idempotency_keystring
metadataobject
proration_behavior'create_prorations' | 'none' required
target_plan_idstring required

Response

OK

change_type'upgrade' | 'downgrade' | 'lateral'
effective_atstring date-time
is_scheduledboolean

IsScheduled is true when the change was deferred to the period end instead of being applied immediately.

metadataobject
schedule_idstring
scheduled_atstring date-time
warningsstring[]