Billing
Access subscription status and create Stripe billing portal sessions. Secret key required.
The Billin object
Subscription status
Current plan
Number of team members
When the current billing period ends
Endpoints
GET
/api/v1/teams/{teamId}/billing/subscriptionGet Subscription
Get the current subscription status and plan details.
Code Examples
bash
curl -X GET "https://www.cstar.help/api/v1/teams/{teamId}/billing/subscription" \
-H "Authorization: Bearer sk_live_your_key" Responses
200 Subscription details
json
{
"success": true,
"data": {
"object": "subscription",
"status": "active",
"plan": "team",
"memberCount": 5,
"currentPeriodEnd": "2026-01-15T00:00:00Z",
"cancelAtPeriodEnd": false
}
} 401 Authentication failed: missing or invalid API key
json
{
"success": false,
"error": {
"type": "authentication_error",
"code": "authentication_required",
"message": "Invalid or expired API key",
"doc_url": "https://www.cstar.help/developers/api-reference#authentication",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} 403 Insufficient permissions: wrong key type or team access
json
{
"success": false,
"error": {
"type": "authorization_error",
"code": "insufficient_permissions",
"message": "Secret key required for this endpoint",
"doc_url": "https://www.cstar.help/developers/api-reference#authentication",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} 429 Rate limit exceeded
json
{
"success": false,
"error": {
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Try again in 60 seconds",
"doc_url": "https://www.cstar.help/developers/api-reference#rate-limiting",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} POST
/api/v1/teams/{teamId}/billing/portalCreate Billing Portal
Create a Stripe billing portal session. Returns a URL where the team admin can manage their subscription.
Request Body
returnUrl string URL to redirect back to after portal session
Code Examples
bash
curl -X POST "https://www.cstar.help/api/v1/teams/{teamId}/billing/portal" \
-H "Authorization: Bearer sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"returnUrl":"https://www.cstar.help/team/acme/settings"}' Responses
200 Portal URL
json
{
"success": true,
"data": {
"object": "billing_portal",
"url": "https://billing.stripe.com/session/..."
}
} 401 Authentication failed: missing or invalid API key
json
{
"success": false,
"error": {
"type": "authentication_error",
"code": "authentication_required",
"message": "Invalid or expired API key",
"doc_url": "https://www.cstar.help/developers/api-reference#authentication",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} 403 Insufficient permissions: wrong key type or team access
json
{
"success": false,
"error": {
"type": "authorization_error",
"code": "insufficient_permissions",
"message": "Secret key required for this endpoint",
"doc_url": "https://www.cstar.help/developers/api-reference#authentication",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} 429 Rate limit exceeded
json
{
"success": false,
"error": {
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Try again in 60 seconds",
"doc_url": "https://www.cstar.help/developers/api-reference#rate-limiting",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
}