---
title: "Change the plan (upgrades are invoiced right away, downgrades credit the next invoice; Free = cancel at period end). Dashboard session only"
method: POST
path: "/billing/subscription"
tags: ["Billing"]
---

# Change the plan (upgrades are invoiced right away, downgrades credit the next invoice; Free = cancel at period end). Dashboard session only

`POST /billing/subscription`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/billing/subscription`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Query parameters

- `orgId` string: Organization id (required when you belong to several)
- `lang` 'en' | 'sv': Language of labels and Stripe pages (default en)

## Request body

- object
  - `planId` 'free' | 'pro' | 'business', required
  - `interval` 'month' | 'year'
  - `prorationDate` integer

## Response `200`

Result

- object
  - `status` 'updated' | 'pending_payment' | 'cancel_scheduled' | 'resumed' | 'unchanged', required
  - `paymentUrl` string, nullable, required: when a payment needs the customer (pending_payment): the hosted invoice page
  - `subscription` object, nullable, required
    - `status` 'incomplete' | 'incomplete_expired' | 'trialing' | 'active' | 'past_due' | 'canceled' | 'unpaid' | 'paused', required
    - `planId` 'free' | 'pro' | 'business', required
    - `interval` 'month' | 'year', required
    - `currency` string, required: the currency the subscription is billed in; fixed for its lifetime (plan changes keep it)
    - `currentPeriodStart` string, nullable, required: ISO-8601 timestamp
    - `currentPeriodEnd` string, nullable, required: ISO-8601 timestamp
    - `cancelAtPeriodEnd` boolean, required
    - `cancelAt` string, nullable, required: ISO-8601 timestamp
    - `trialEnd` string, nullable, required: ISO-8601 timestamp
    - `pendingUpdate` boolean, required: a plan change waits for a payment to succeed (see paymentUrl)
    - `paymentUrl` string, nullable, required: hosted page of the latest open invoice when it needs payment or authentication

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Authenticated but not permitted (code forbidden); details.requiresSession for plan/payment changes over a token
- `404`: Not found or not visible to the caller (code not_found)
- `409`: Conflicting state, e.g. a subscription already exists (code conflict)
- `429`: Too many requests (code rate_limited); see Retry-After
- `501`: Billing is not set up on this server (code not_configured)
- `503`: The payment provider is unavailable (code provider_unavailable)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
