Skip to main content

Subscribe

Subscribe to a paid plan. Requires a payment method on file.

POST /api/v1/billing/subscribe

Authentication

JWT Bearer Token required via Authorization header.

Request Body

FieldTypeRequiredDescription
planIdstringYesPlan identifier: plan_starter, plan_pro, plan_enterprise

Example Request

{
"planId": "plan_pro"
}

Response

201 Created

{
"subscription": {
"id": "sub_abc123",
"planId": "plan_pro",
"status": "active",
"currentPeriodStart": "2026-03-29T00:00:00Z",
"currentPeriodEnd": "2026-04-29T00:00:00Z"
}
}

409 Conflict

{
"error": {
"code": "ALREADY_SUBSCRIBED",
"message": "You already have an active subscription. Use the change plan endpoint instead.",
"status": 409
}
}

Code Examples

cURL

curl -X POST https://api.audiospliter.com/api/v1/billing/subscribe \
-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/subscribe',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${jwtToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ planId: 'plan_pro' }),
}
);
const { subscription } = await response.json();
console.log(`Subscribed: ${subscription.status}`);

Python

import requests

response = requests.post(
'https://api.audiospliter.com/api/v1/billing/subscribe',
headers={'Authorization': f'Bearer {jwt_token}'},
json={'planId': 'plan_pro'},
)
sub = response.json()['subscription']
print(f"Subscribed: {sub['status']}")