Billing
Access subscription status and create Stripe billing portal sessions. Secret key required.
The Billing object
Subscription status, for example trialing or active; inactive when the team has none
True while the free trial runs
When the trial ends, or null (also null for a team that never had a trial)
True while the team has no active subscription: reads work, writes return 402 team_paused
Why the team is paused: trial_ended, no_trial, payment_failed, canceled or payment_required; null when not paused
When the team and its data are deleted, or null. The whole named UTC day is safe
When the subscription ends because the owner canceled it in the billing portal. It runs until then and won't renew; null when it renews or isn't running
Paid seats: every member, with up to 3 spectators free (minimum 1)
Human members on the team (AI agents are free and not counted)
True when the team has a Stripe subscription that is not canceled
Endpoints
/api/v1/teams/{teamId}/billing/subscriptionGet Subscription
Get the subscription status, trial and seat counts. Requires the manage_billing permission, so only a key made by the team owner can read it.
Code Examples
curl -X GET "https://www.cstar.help/api/v1/teams/{teamId}/billing/subscription" \
-H "Authorization: Bearer sk_live_your_key" Responses
{
"success": true,
"data": {
"object": "subscription",
"teamId": "550e8400-e29b-41d4-a716-446655440000",
"teamName": "Acme Support",
"status": "active",
"isTrialing": false,
"trialEndsAt": null,
"paused": false,
"pausedReason": null,
"scheduledDeletionAt": null,
"subscriptionCancelAt": null,
"seatCount": 4,
"memberCount": 5,
"hasStripeCustomer": true,
"hasActiveSubscription": true,
"createdAt": "2026-01-15T00:00:00Z"
}
} {
"success": false,
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key provided is invalid or has been revoked",
"doc_url": "https://www.cstar.help/developers/errors#invalid_api_key",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} {
"success": false,
"error": {
"type": "authentication_error",
"code": "insufficient_permissions",
"message": "Your API key does not have permission for this operation",
"doc_url": "https://www.cstar.help/developers/errors#insufficient_permissions",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} {
"success": false,
"error": {
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Try again in 60 seconds.",
"retryAfter": 60,
"doc_url": "https://www.cstar.help/developers/errors#rate_limit_exceeded",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} /api/v1/teams/{teamId}/billing/portalCreate Billing Portal
Create a Stripe billing portal session. Returns a URL where the team owner can manage the subscription. Needs a key made by the owner: billing is owner-only (manage_billing), so a key an admin made gets 403. A test key is refused with 400 (team settings are live, with no test copy).
Request Body
returnUrl string URL to redirect back to after portal session
Code Examples
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
{
"success": true,
"data": {
"object": "billing_portal",
"url": "https://billing.stripe.com/session/..."
}
} {
"success": false,
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key provided is invalid or has been revoked",
"doc_url": "https://www.cstar.help/developers/errors#invalid_api_key",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} {
"success": false,
"error": {
"type": "authentication_error",
"code": "insufficient_permissions",
"message": "Your API key does not have permission for this operation",
"doc_url": "https://www.cstar.help/developers/errors#insufficient_permissions",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
} {
"success": false,
"error": {
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Try again in 60 seconds.",
"retryAfter": 60,
"doc_url": "https://www.cstar.help/developers/errors#rate_limit_exceeded",
"request_id": "req_abc123"
},
"meta": {
"timestamp": "2025-12-10T14:30:00Z"
}
}