Skip to main content

Billing

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

The Billin object

status string

Subscription status

plan string

Current plan

memberCount integer

Number of team members

currentPeriodEnd datetime

When the current billing period ends

Endpoints

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

Get Subscription

Get the current subscription status and plan details.

Code Examples

curl -X GET "https://www.cstar.help/api/v1/teams/{teamId}/billing/subscription" \
  -H "Authorization: Bearer sk_live_your_key"

Responses

200 Subscription details
{
  "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
{
  "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
{
  "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
{
  "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/portal

Create 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

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
{
  "success": true,
  "data": {
    "object": "billing_portal",
    "url": "https://billing.stripe.com/session/..."
  }
}
401 Authentication failed — missing or invalid API key
{
  "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
{
  "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
{
  "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"
  }
}