Skip to main content

Change Plan

Upgrade or downgrade your current subscription plan. Upgrades take effect immediately with prorated charges. Downgrades take effect at the next billing period.

POST /api/v1/billing/change-plan

Authentication

JWT Bearer Token required via Authorization header.

Request Body

FieldTypeRequiredDescription
planIdstringYesTarget plan: plan_starter, plan_pro, plan_enterprise

Example Request

{
"planId": "plan_pro"
}

Response

200 OK (Upgrade)

{
"subscription": {
"id": "sub_abc123",
"planId": "plan_pro",
"status": "active",
"currentPeriodEnd": "2026-04-29T00:00:00Z"
},
"proration": {
"amount": 2450,
"currency": "usd",
"description": "Prorated upgrade from Starter to Pro"
},
"message": "Plan upgraded to Pro. Prorated charge of $24.50 applied."
}

200 OK (Downgrade)

{
"subscription": {
"id": "sub_abc123",
"planId": "plan_pro",
"scheduledPlanId": "plan_starter",
"status": "active",
"currentPeriodEnd": "2026-04-29T00:00:00Z"
},
"message": "Plan will be downgraded to Starter at the next billing period."
}

Code Examples

cURL

curl -X POST https://api.audiospliter.com/api/v1/billing/change-plan \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '{"planId": "plan_pro"}'

Node.js

const response = await fetch(
'https://api.audiospliter.com/api/v1/billing/change-plan',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${jwtToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ planId: 'plan_pro' }),
}
);
const result = await response.json();
console.log(result.message);

Python

import requests

response = requests.post(
'https://api.audiospliter.com/api/v1/billing/change-plan',
headers={'Authorization': f'Bearer {jwt_token}'},
json={'planId': 'plan_pro'},
)
print(response.json()['message'])