# Enable or disable bandwidth pooling for a location

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

### Overview

Enables or disables bandwidth pooling for a location in the current team. Send `location_id` and `enabled`. With pooling enabled, the team's servers there share one bandwidth allowance. Each team has its own pools, so servers in the account's other teams are not affected. Otherwise, each server is metered separately. Disabling pooling distributes recorded usage back to individual servers, attaches blocks bound to that location to each of the team's metered servers there, and keeps transfer the pool already drew from a block counting for the servers that block covers. It may immediately throttle servers over their limits. Request a preview first. Returns the team's updated figures for every location.

### Permissions

Requires the `network.update` (Change networking) 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`.

- `location_id` (integer, required): The location id ID.
- `enabled` (boolean, required): The value of `enabled`.

## Response 200

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

- `location_id` (integer, required): The city that was switched.
- `pooling` (boolean, required): Whether it pools now.
- `pooled_locations` (integer[], required): Every city where the team pools, after the change.
- `pools` (object[], required): Every city's figures, as they stand after the change.
  - `location_id` (integer, required): The location id ID.
  - `name` (string, required): The name shown to customers.
  - `region` (string, required): The value of `region`. One of: `us_eu`, `apac`.
  - `region_label` (string, required): The value of `region_label`.
  - `pooling` (boolean, required): Whether the team's servers here share one budget or are metered one by one.
  - `servers` (integer, required): The value of `servers`.
  - `shaped_servers` (integer, required): The value of `shaped_servers`.
  - `base_limit` (integer, required): What the plans alone allow here, in bytes.
  - `usage` (integer, required): The value of `usage`.
  - `capacity` (integer, required): The budget in force, plans and blocks together.
  - `covered` (integer, required): How much of that budget the team's blocks are responsible for.
  - `remaining` (integer, required): The value of `remaining`.
  - `blocks` (integer, required): The value of `blocks`.
  - `block_bytes_available` (integer, required): The value of `block_bytes_available`.
  - `exhausted` (boolean, required): With pooling on, the whole city at once. With it off, whether at least one server here has been shaped.

```json
{
  "location_id": 3,
  "pooling": false,
  "pooled_locations": [],
  "pools": [
    {
      "location_id": 3,
      "name": "Kansas City, MO",
      "region": "us_eu",
      "region_label": "Americas & EMEA",
      "pooling": false,
      "servers": 2,
      "shaped_servers": 0,
      "base_limit": 10995116277760,
      "usage": 1358993459200,
      "capacity": 12644383719424,
      "covered": 1649267441664,
      "remaining": 11285390260224,
      "blocks": 1,
      "block_bytes_available": 1649267441664,
      "exhausted": false
    }
  ]
}
```

## Errors

- `401`: The key was missing, malformed, revoked, or belongs to an account that no longer exists.
- `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 PATCH \
  --url 'https://console.advinservers.com/api/v1/client/bandwidth-blocks/pooling' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "location_id": 3,
  "enabled": false
}'
```
