Billing

GET /api/v1/billing/plans

List available plans and tiers. Response:
{
  "plans": [
    {
      "id": "uuid",
      "name": "Free",
      "tier": "free",
      "storage_bytes": 1073741824,
      "price_cents": 0,
      "overage_bytes": 0,
      "overage_price_cents": 0
    }
  ]
}

GET /api/v1/billing/subscription

Return the active subscription for the current organization. Response:
{
  "subscription": {
    "id": "uuid",
    "customer_id": "uuid",
    "organization_id": "uuid",
    "plan_id": "uuid",
    "status": "active",
    "provider_customer_id": "cus_...",
    "provider_subscription_id": "sub_...",
    "current_period_start": "2026-06-01T00:00:00Z",
    "current_period_end": "2026-07-01T00:00:00Z",
    "cancel_at": null,
    "created_at": "2026-06-01T00:00:00Z",
    "updated_at": "2026-06-01T00:00:00Z"
  }
}

POST /api/v1/billing/checkout

Create a Stripe checkout session to upgrade the organization plan. Request body:
{
  "tier": "pro"
}
Response:
{
  "session_id": "cs_...",
  "url": "https://checkout.stripe.com/..."
}

GET /api/v1/billing/checkout/success

Stripe success callback. The portal creates or activates the subscription and redirects to the dashboard billing page.

GET /api/v1/billing/checkout/cancel

Stripe cancel callback. Redirects back to the dashboard billing page.

POST /api/v1/billing/portal

Create a Stripe customer portal session to manage payment details. Response:
{
  "url": "https://billing.stripe.com/session/..."
}

POST /api/v1/billing/cancel

Cancel the active subscription at the end of the current period. Returns 200 OK on success.