# Buy a bandwidth block

`POST https://console.advinservers.com/api/v1/client/bandwidth-blocks`

### Overview

Buys extra bandwidth. **In a prepaid team, payment is taken from account credit.** In a postpaid team nothing is charged now and account credit is not checked: the price is added to the monthly postpaid invoice as a one-off charge, and the purchase is refused with 402 if it would take the monthly recurring cost past its `limit`. Send `region`, `terabytes` and the `quote_token` to use the quoted price. The block is returned awaiting payment. The purchase is placed and paid in the background, and the block becomes `active` when the payment clears. In a prepaid team, if account credit is insufficient, `status_label` reads `Needs funds` and `progress_message` says how much is missing. Add funds before the deadline or the purchase expires.

### Permissions

Requires the `billing.purchase` (Make purchases) permission for the selected team. Resources outside that team return 404.

## Authorization

Send `Authorization: Bearer <token>` with the request. Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

## Body

Sent as `application/json`.

- `region` (string, required): The value of `region`. One of: `us_eu`, `apac`.
- `terabytes` (integer, required): The value of `terabytes`. 1 to 100
- `quote_token` (string, required): The value of `quote_token`. At most 20000 characters

## Response 201

The record, as a JSON object. There is no envelope.

- `uuid` (string, required): The uuid UUID.
- `uuid_short` (string, required): The value of `uuid_short`.
- `region` (string, required): The value of `region`. One of: `us_eu`, `apac`.
- `region_label` (string, required): The value of `region_label`.
- `size` (integer, required): The value of `size`.
- `consumed` (integer, required): The value of `consumed`.
- `remaining` (integer, required): The value of `remaining`.
- `terabytes` (integer, required): The value of `terabytes`.
- `status` (string, required): The value of `status`. One of: `pending_payment`, `active`, `expired`, `cancelled`, `payment_review`, `revoked`.
- `status_label` (string, required): The value of `status_label`.
- `progress_message` (string | null, required): One sentence about why a purchase is waiting, most often how much the account is short by. Null once there is nothing to say.
- `needs_funds` (boolean, required): Whether the purchase is waiting for enough account credit.
- `assignment` (string, required): Whether the block is assigned to individual servers or a city.
- `servers` (object[], required): The value of `servers`.
  - `id` (string, required): The id ID.
  - `uuid` (string, required): The uuid UUID.
  - `name` (string, required): The name shown to customers.
  - `hostname` (string, required): The fully qualified hostname.
  - `template_name` (string | null, required): What a badge or a picker paints the machine with, the same as the dashboard.
  - `template_icon_url` (string | null, required): The value of `template_icon_url`.
  - `windows` (boolean, required): The value of `windows`.
  - `address` (string | null, required): The machine's primary IPv4, so a picker names it the way a customer does.
  - `location` (string | null, required): The city it sits in, or null when its location is unknown.
- `servers_in_other_teams` (integer, required): The rest of what it covers, counted rather than named. Nought for the account holder, who is shown every one of them, and for anyone else not standing inside a single team.
- `attachable_servers` (integer | null, required): How many of the account's servers this block could still be put behind: metered, in the region it was bought for, and not already covered by it. Null where it was not counted, which is not the same as none.
- `location` (object | null, required): The value of `location`.
  - `id` (integer, required): The id ID.
  - `name` (string, required): The name shown to customers.
- `unit_price` (string, required): The value of `unit_price`.
- `billing` (object, required): The value of `billing`.
  - `service_id` (integer | null, required): The customer's service number, once a recurring service exists.
  - `invoice_id` (integer | null, required): The customer's invoice number, once an invoice exists.
  - `invoice_url` (string | null, required): A complete URL where the invoice can be paid.
  - `checkout_uuid` (string | null, required): The checkout UUID, or null when no checkout is available.
  - `checkout_uuid_short` (string | null, required): The value of `checkout_uuid_short`.
  - `invoice_status` (string | null, required): The current invoice status, or null before an invoice exists.
  - `amount` (string | null, required): The amount in the currency shown by `currency`.
  - `currency` (string | null, required): The three-letter currency code used for `amount`.
  - `billing_cycle` (string | null, required): How often the service renews, or null for a one-time charge.
  - `payment_due_at` (string | null, required): When payment is due before the reservation is released.
  - `payment_window_minutes` (integer | null, required): How many minutes the original payment window allowed.
  - `paid_at` (string | null, required): When the charge was paid, or null while payment is outstanding.
- `can_cancel` (boolean, required): Whether the customer can cancel.
- `created_at` (string | null, required): The date and time for created at, in UTC.
- `cancellation_refund` (string, required): The value of `cancellation_refund`.
- `refund_amount` (string | null, required): The value of `refund_amount`.
- `refund_pending` (boolean, required): The value of `refund_pending`.

```json
{
  "uuid": "43d8f113-27e0-4491-b131-39029b69c5d7",
  "uuid_short": "Uuid short",
  "region": "us_eu",
  "region_label": "Americas & EMEA",
  "size": 2199023255552,
  "consumed": 0,
  "remaining": 2199023255552,
  "terabytes": 2,
  "status": "pending_payment",
  "status_label": "Provisioning",
  "progress_message": null,
  "needs_funds": false,
  "assignment": "unassigned",
  "servers": [],
  "servers_in_other_teams": 0,
  "attachable_servers": null,
  "location": null,
  "unit_price": "1.00",
  "billing": {
    "service_id": null,
    "invoice_id": null,
    "invoice_url": null,
    "checkout_uuid": null,
    "invoice_status": null,
    "amount": "2.00",
    "currency": "USD",
    "billing_cycle": null,
    "payment_due_at": "2026-09-14T17:12:09+00:00",
    "payment_window_minutes": 30,
    "paid_at": null
  },
  "can_cancel": true,
  "created_at": "2026-09-14T16:42:09+00:00",
  "cancellation_refund": "2.00",
  "refund_amount": null,
  "refund_pending": false
}
```

## Errors

- `401`: The key was missing, malformed, revoked, or belongs to an account that no longer exists.
- `402`: The account credit, or in a postpaid team the postpaid spending limit, does not cover this purchase.
- `403`: Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
- `422`: A field is missing or invalid, or the resource cannot accept this change in its current state. Check `message` for details. Field validation also includes an `errors` object keyed by field name.
- `429`: Too many requests. The `Retry-After` header says how many seconds to wait. Limits are per account, so several keys on one account share them.

## Example request

```bash
curl --request POST \
  --url 'https://console.advinservers.com/api/v1/client/bandwidth-blocks' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "region": "us_eu",
  "terabytes": 2,
  "quote_token": "eyJpdiI6InVlNzU5eGpSTitidlhBTGhxVEhzbGc9PSIsInZhbHVlIjoiRTVQSlpwWW9VRk5RWVRzcTMzbWRUQURxVVJCM2xmMVZ5UHlhMXQ5b3Y0eTVRSWFpTk5FdnJwWldEVEpPUkk1dEtkWXlScGwwVEZUcEJrRGRHaEVybzYyUlwvUzNJbG9jUjlld3U2dWllNjZlQU8yU3JTNFdZdXJVV0dSSjBHN2xGIiwibWFjIjoiMTNmODI5MWJjOTJmOWRhM2EzNjU4ZGM2NzgzYTdmNjIxZGE5NzQ2YjVmODRhODdjZWYyZTM5NDA5ZTFjODBmMyIsInRhZyI6IiJ9"
}'
```
