> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atollhq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Billing and limits

> Understand plan state, usage limits, checkout, billing portal, and PLAN_LIMIT_REACHED errors.

Owners and admins can manage billing.

Owner/admin reads sync the latest Stripe customer and subscription state before returning the billing overview. If Stripe sync or customer lookup fails, the endpoint returns `502` with `Stripe billing sync failed` instead of serving stale local billing state.

## Endpoints

| Method | Endpoint                          | Description                                               |
| ------ | --------------------------------- | --------------------------------------------------------- |
| `GET`  | `/api/orgs/{id}/billing`          | Get plan, status, usage, limits, and subscription summary |
| `POST` | `/api/orgs/{id}/billing/checkout` | Start a self-serve Stripe billing flow                    |
| `POST` | `/api/orgs/{id}/billing/portal`   | Create Stripe Billing Portal Session                      |

## Checkout

Use the checkout endpoint to select a self-serve plan. New subscribers receive a Stripe Checkout URL. Existing subscribers with an active, trialing, or past-due subscription receive a Stripe Billing Portal update-confirmation URL for the selected plan, so Atoll updates the current subscription instead of creating another one.

Current self-serve prices:

| Plan    | Price | Billing interval |
| ------- | ----: | ---------------- |
| Starter |  \$19 | Monthly          |
| Team    |  \$49 | Monthly          |
| Pro     |  \$99 | Monthly          |

```json theme={null}
{
  "plan": "starter"
}
```

or:

```json theme={null}
{
  "plan": "team"
}
```

or:

```json theme={null}
{
  "plan": "pro"
}
```

## Plan limit errors

Creation endpoints can return:

```json theme={null}
{
  "error": "Plan limit reached",
  "code": "PLAN_LIMIT_REACHED",
  "resource": "activeProjects",
  "plan": "free",
  "limit": 2,
  "usage": 2
}
```

Plan-limited resources include:

* Humans
* Agents/integrations
* Active projects
* Active issues

Current enforced limits:

| Plan       |    Humans | Agents/integrations | Active projects | Active issues |
| ---------- | --------: | ------------------: | --------------: | ------------: |
| Free       |         2 |                   2 |               1 |           100 |
| Starter    |         3 |                   3 |               3 |           250 |
| Team       |        10 |                  10 |              10 |         1,000 |
| Pro        |        25 |                  25 |              25 |         5,000 |
| Enterprise | Unlimited |           Unlimited |       Unlimited |     Unlimited |

## Local development

The app uses Stripe environment variables for billing:

```bash theme={null}
STRIPE_SECRET_KEY
STRIPE_WEBHOOK_SECRET
STRIPE_PRICE_STARTER_MONTHLY
STRIPE_PRICE_TEAM_MONTHLY
STRIPE_PRICE_PRO_MONTHLY
NEXT_PUBLIC_APP_URL
```
