# Buy capacity

URL: https://heaven.dev/docs/reference/capacity/buy
Updated: 2026-11-21

Buy CPU, RAM and storage capacity for your organization. The first purchase creates a pool. Monthly billing is the default. The first monthly purchase returns a payment page. Later monthly purchases can charge the prorated amount through renewal. With `months`, pay for that many months upfront and renew for the same length. See `plan view` for the prices and upfront discounts. Hourly capacity is paid from the wallet by the minute with a one-hour minimum.

`POST /v1/organization/capacity/create`

## Parameters

- `plan` (string): The plan number to purchase, from `plan view`.
- `monthly` (boolean): Pay through the account's monthly subscription (default).
- `hourly` (boolean): Pay from your wallet by the minute, with a minimum charge of one hour.
- `months` (string): Length of the prepaid monthly term, in months. Choose 1 (default) or 12. See `plan view` for the discount.
- `offer` (string): Offer code for this purchase.
- `dry_run` (boolean): Preview the change without applying it.
- `server` (string): Server identifier from `capacity view`. Defaults to the server with the most room.
- `organization` (string): Organization name or ID. A credential, named resource or sole membership can select the organization for you.

## Returns

- `data` (object, always present): The result or preview of buying or releasing capacity.
  - `charged_cents` (integer): Charge now, or the previewed charge for a dry run, in cents. May be omitted.
  - `checkout_url` (string): Page to pay for a first monthly purchase. May be omitted.
  - `dry_run` (boolean): True for a preview; no purchase or release is made. May be omitted.
  - `id` (string): Capacity purchase ID. Absent when a dry run made no purchase. May be omitted.
  - `invoice_url` (string): Invoice to pay when an additional purchase needs payment action. May be omitted.
  - `kind` (string, always present): Hourly or monthly billing.
  - `plan` (integer, always present): Plan number being bought or released.
  - `pool` (string): Initial pool created for the account. May be omitted.
  - `price_micros` (integer): Purchase's price per hour or month, in millionths of a dollar. May be omitted.
  - `refunded_cents` (integer): Refund issued by this release, in cents. May be omitted.
  - `released` (boolean): Whether the purchase has been released. May be omitted.
  - `released_at` (string (date-time)): Time this purchase was released. May be omitted.
  - `releases_at` (string (date-time)): When a scheduled monthly release takes effect. It can be canceled before that time. May be omitted.
  - `stopping` (string[]): Pools that stop if their allocations still exceed capacity when the release takes effect. May be omitted.
  - `unknown` (boolean): Whether the payment response was lost. Read `capacity view` before retrying. May be omitted.
  - `wallet_micros` (integer): Wallet balance after an hourly purchase, in millionths of a dollar. May be omitted.

## Errors

Each code is explained in full at https://heaven.dev/docs/reference/errors.

| Code | Status | What happened |
|---|---:|---|
| `invalid` | 400 | An input is missing or invalid. |
| `unauthenticated` | 401 | The credential is missing, invalid, expired or revoked. |
| `denied` | 403 | The caller lacks permission for this action. |
| `not_found` | 404 | The resource is absent or inaccessible to this caller. |
| `conflict` | 409 | The request conflicts with the current resource state or an earlier request. |
| `over_capacity` | 409 | The request exceeds a resource or credential allowance. |
| `access_list_full` | 409 | The change would exceed the access-list allowance. |
| `payment_required` | 402 | Payment or credit is required. |
| `rate_limited` | 429 | The caller's request rate exceeds its limit. |
| `busy` | 429 | Too much work is in progress to accept this request. |
| `unknown` | 503 | The outcome is unconfirmed; a change may have happened. |
| `unavailable` | 503 | The service or requested feature is unavailable. |

## Notes

- CLI: `heaven login` with `HEAVEN_API_KEY` unset. MCP: Heaven sign-in. cURL: `HEAVEN_SIGN_IN_KEY` from approved device sign-in (`POST /v1/auth/create`).
- A key limited to a command list cannot run this command.
- For retries, reuse the original `Idempotency-Key` and inputs.

## Examples

```sh tab="heaven CLI"
heaven capacity buy
  [--plan N]
  [--monthly]
  [--hourly]
  [--months MONTHS]
  [--offer OFFER]
  [--dry-run]
  [--server SERVER]
  [--request-id ID]
  [--organization ORGANIZATION]
```

```sh tab="SSH"
ssh cli@heaven.dev capacity buy
  [--plan N]
  [--monthly]
  [--hourly]
  [--months MONTHS]
  [--offer OFFER]
  [--dry-run]
  [--server SERVER]
  [--request-id ID]
  [--organization ORGANIZATION]
```

```sh tab="cURL"
curl https://heaven.dev/v1/organization/capacity/create \
  -H "Authorization: Bearer $HEAVEN_SIGN_IN_KEY" \
  -H "Idempotency-Key: capacity-buy-2" \
  --json '{"plan": "2", "hourly": true}'
```

```json tab="MCP"
{ "tool": "capacity_buy",
  "arguments": { "plan": "2", "hourly": true, "request_id": "capacity-buy-2" } }
```

Response:

```json title="Response excerpt"
{
  "version": 1,
  "data": {
    "id": "cap-9fb88d913e9ac165",
    "kind": "hourly",
    "plan": 2,
    "price_micros": 82192,
    "wallet_micros": 1010000000
  }
}
```
