---
title: Billing
description: "Manage subscriptions, checkout, and billing portal."
---

# Billing

Manage your subscription and billing through the API.

## Get Subscription

```bash
curl https://api.caged.dev/v1/billing/subscription \
  -H "Authorization: Bearer caged_sk_..."
```

**Response** `200 OK`

```json
{
  "plan": "pro",
  "status": "active",
  "current_period_end": "2026-07-08T00:00:00Z",
  "usage": {
    "compute_hours": 12.5,
    "llm_cost_usd": 3.42,
    "total_cost_usd": 5.67,
    "sandboxes_created": 8
  }
}
```

## Plans

| Plan | Price | Sandboxes | Compute | Support |
|------|-------|-----------|---------|---------|
| Free | $0/mo | 2 concurrent | 10 hrs/mo | Community |
| Pro | $29/mo | 10 concurrent | 100 hrs/mo | Email |
| Team | $99/mo | 50 concurrent | 500 hrs/mo | Priority |
| Enterprise | Custom | Unlimited | Custom | Dedicated |

## Create Checkout Session

Creates a Stripe checkout session for subscription upgrade.

<ParamField body="plan" type="string" required>
  Plan to subscribe to: `pro`, `team`, or `enterprise`.
</ParamField>

```bash
curl -X POST https://api.caged.dev/v1/billing/checkout \
  -H "Authorization: Bearer caged_sk_..." \
  -H "Content-Type: application/json" \
  -d '{"plan": "pro"}'
```

**Response** `200 OK`

```json
{
  "url": "https://checkout.stripe.com/c/pay/..."
}
```

## Create Billing Portal

Creates a Stripe billing portal link for managing payment methods, invoices, and plan changes.

```bash
curl -X POST https://api.caged.dev/v1/billing/portal \
  -H "Authorization: Bearer caged_sk_..."
```

**Response** `200 OK`

```json
{
  "url": "https://billing.stripe.com/p/session/..."
}
```

## Cancel Subscription

Cancels the subscription at the end of the current billing period.

```bash
curl -X POST https://api.caged.dev/v1/billing/cancel \
  -H "Authorization: Bearer caged_sk_..."
```

**Response** `200 OK`

```json
{
  "status": "canceled",
  "effective_at": "2026-07-08T00:00:00Z"
}
```
