Billing

Access subscription status and create Stripe billing portal sessions. Secret key required.

The Billing object

status string

Subscription status, for example trialing or active; inactive when the team has none

isTrialing boolean

True while the free trial runs

trialEndsAt datetime

When the trial ends, or null (also null for a team that never had a trial)

paused boolean

True while the team has no active subscription: reads work, writes return 402 team_paused

pausedReason string

Why the team is paused: trial_ended, no_trial, payment_failed, canceled or payment_required; null when not paused

scheduledDeletionAt datetime

When the team and its data are deleted, or null. The whole named UTC day is safe

subscriptionCancelAt datetime

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

seatCount integer

Paid seats: every member, with up to 3 spectators free (minimum 1)

memberCount integer

Human members on the team (AI agents are free and not counted)

hasActiveSubscription boolean

True when the team has a Stripe subscription that is not canceled

Endpoints

GET /api/v1/teams/{teamId}/billing/subscription

Get 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

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",
    "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"
  }
}

401 Authentication failed: missing or invalid API key
json
{
  "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"
  }
}

403 Insufficient permissions: wrong key type or team access
json
{
  "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"
  }
}

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.",
    "retryAfter": 60,
    "doc_url": "https://www.cstar.help/developers/errors#rate_limit_exceeded",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

POST /api/v1/teams/{teamId}/billing/portal

Create 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

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": "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"
  }
}

403 Insufficient permissions: wrong key type or team access
json
{
  "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"
  }
}

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.",
    "retryAfter": 60,
    "doc_url": "https://www.cstar.help/developers/errors#rate_limit_exceeded",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}