CustomDomain™ docs
API referenceBilling

Move a running subscription to another self-serve plan

POST
/billing/change-plan

Swaps the price of the workspace's running Stripe subscription (Stripe prorates the difference). Self-serve plans only; a workspace without a running subscription gets 409 and subscribes through /billing/checkout. Requires billing:manage.

AuthorizationBearer <token>

Long-lived tenant API key, cd_live_… (production) or cd_test_… (staging, development), stored hashed. Keys created before the switch to cd_ start with sk_live_… / sk_test_… and are still accepted. Scoped to the owning application's tenant.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/billing/change-plan" \  -H "Content-Type: application/json" \  -d '{    "plan": "starter"  }'
{  "tenant_id": "string",  "state": "trialing",  "reason": "string",  "restricted": true,  "first_domain_free": true,  "attention": true,  "setup_required": true,  "days_left": 0,  "price_cents": 0,  "currency": "string",  "trial_ends_at": "2019-08-24T14:15:22Z",  "grace_started_at": "2019-08-24T14:15:22Z",  "grace_ends_at": "2019-08-24T14:15:22Z",  "current_period_end": "2019-08-24T14:15:22Z",  "cancel_at_period_end": true,  "ended_at": "2019-08-24T14:15:22Z",  "comped": true,  "comped_until": "2019-08-24T14:15:22Z",  "payment_failed": true,  "payment_failed_at": "2019-08-24T14:15:22Z",  "has_billing_account": true,  "portal_available": true,  "can_change_plan": true,  "mode": "test",  "plan": {    "id": "starter",    "name": "string",    "price_cents": 0,    "public_price": true,    "domains_per_year": 0,    "domains_per_month": 0,    "hard_cap": true,    "retired": true  },  "next_charge": {    "at": "2019-08-24T14:15:22Z",    "amount_cents": 0,    "currency": "string"  },  "checkout": {    "available": true,    "trial_days": 0,    "trial_end": "2019-08-24T14:15:22Z",    "first_charge_at": "2019-08-24T14:15:22Z",    "default_plan": "starter"  },  "usage": {    "used": 0,    "quota": 0,    "period_start": "2019-08-24T14:15:22Z",    "period_end": "2019-08-24T14:15:22Z"  },  "payment_method": {    "type": "card",    "brand": "string",    "last4": "string",    "exp_month": 0,    "exp_year": 0,    "wallet": "apple_pay",    "email": "string"  }}
{  "code": "string",  "title": "string",  "details": "string"}
{  "code": "string",  "title": "string",  "details": "string"}
{  "code": "string",  "title": "string",  "details": "string"}
{  "code": "string",  "title": "string",  "details": "string"}