Skip to main content
POST
Change the plan
An upgrade charges the prorated difference on the subscriber’s saved card now. Always show the preview first and echo its prorationDate; that is what makes the charge equal the quote. A downgrade charges nothing today and switches at the current period end.
Idempotent on (subscription, target plan, prorationDate): retrying the same request does not charge twice. Same plan, a subscription that is not active or trialing, a different currency, or a different billing interval return 400.

Authorizations

x-api-key
string
header
required

Your secret key, from app.agentaos.ai -> Settings -> Developers -> API Keys. The key's prefix is both its identity and its environment: sk_test_... (sandbox, free, no verification) or sk_live_... (real money, requires business verification). A missing or invalid key returns 401.

Path Parameters

id
string<uuid>
required

Subscription id.

Body

application/json

The target product's payment-link id.

prorationDate
integer
required

From the preview response.

Required range: x >= 1

Response

The applied change. Shape depends on direction.

direction
enum<string>
required
Available options:
upgrade
applied
enum<boolean>
required
Available options:
true
status
string
required

Subscription status after the change.

unitAmountMinor
integer
required

New per-cycle amount.

currency
string
required