---
title: Key limits and user keys
description: Let an agent resize, fork and checkpoint its own sandboxes within a budget, and limit a key to one Linux user of a sandbox.
---

A key [limited to sandboxes](/docs/account/api-keys/#keys-limited-to-sandboxes) can be narrowed further in two ways:

- **Limits** let an agent adapt its own sandboxes within a budget: resize or fork them, up to a size, a monthly spend and a number of sandboxes that an owner or admin sets.
- **A Linux user**: a key of exactly one sandbox can act as one Linux user of it, so that several agents sharing a sandbox each get a key for their own user.

## Limits

Without limits, a key limited to sandboxes may not resize or fork them. An owner or admin of the org gives it limits on the [Agents page](https://my.pols.so/account/agents): **Limits** next to the key in **Keys limited to sandboxes**. The key list shows each key's limits.

| Limit | What it does |
| --- | --- |
| Actions | which self-service actions the key may take: `resize` its sandboxes, `fork` them, `checkpoint` (create, delete and roll back to [checkpoints](/docs/sandboxes/checkpoints/)) and `port` (publish, link and close [ports](/docs/access/ports/)); any action not ticked is refused |
| Largest size | the largest [size](/docs/concepts/machine/#sizes) it may resize or fork to |
| Monthly spend, EUR | what its sandboxes, deleted ones included, may cost in CPU and RAM in a calendar month (UTC); it starts again when the next month starts |
| Sandboxes | how many sandboxes it may have that are not deleted |

Leave a cap empty for none. With limits:

- **Resize**: a key allowed `resize` may change its sandboxes' size (`PATCH /v1/sandboxes/{sandbox}` with `size` only, `pols resize`, MCP `sandbox_resize`).
- **Fork**: a key allowed `fork` may fork its sandboxes, and the fork joins the key's sandboxes. Its fork keeps the source's [egress policy](/docs/sandboxes/egress/) and [vault entries](/docs/sandboxes/vault/): setting `egress` or `secrets` on it is refused with `403 forbidden`.
- **Checkpoints and ports**: limits that leave out `checkpoint` or `port` take those away from the key, which could use them without limits.
- **Past its monthly spend**, the key may not resume, resize or fork. Its sandboxes that run keep running.

Keys without limits, which is every key until an owner or admin sets some, work as before. Limits only narrow what the org may do: its [quotas](/docs/getting-started/limits/#quotas), credit and trial limits apply too. **Remove limits** on the same form returns the key to having none.

### When a call is beyond a limit

A call beyond the key's limits answers `403` with code `key_limit`, and `error.key_limit` says which limit:

```json
{
  "error": {
    "code": "key_limit",
    "message": "...",
    "key_limit": { "limit": "monthly_spend", "action": "resume", "current": "12.3400", "max": "12.0000" }
  }
}
```

| `limit` | Meaning |
| --- | --- |
| `action` | the key may not take `action` at all; `allowed` lists the actions it may take, possibly none |
| `max_size` | `current` is the size asked for, `max` the largest the key may resize or fork to |
| `monthly_spend` | `current` is what the key's sandboxes have cost this month, `max` its cap, both in EUR |
| `max_sandboxes` | `current` is how many sandboxes the key has, `max` how many it may have |

`action` names what was refused: `resize`, `fork`, `checkpoint`, `port`, or `resume` for a key past its monthly spend. An agent can read this and ask its person to raise the limit; only an owner or admin can, on the Agents page.

## Keys limited to one Linux user

A sandbox can have more Linux users than its default `user`; add them with [`pols users add`](/docs/reference/cli/users/). A key limited to exactly one sandbox can also be limited to one of those users. Choose the user when you create the key, or a [handoff link](/docs/account/api-keys/) for one, on the [Agents page](https://my.pols.so/account/agents); the user must already exist.

Such a key acts as its user only:

- It runs commands, reads and writes [files](/docs/sandboxes/files/) and logs in over [SSH](/docs/access/ssh/) as that user, with that user's permissions. Leaving out the user means its user; asking for `root` or another user answers `403 forbidden`.
- Its desktop link, [computer use](/docs/agents/computer-use/), desktop control and CDP connections reach its user's [own desktop and Chrome](/docs/access/user-desktops/). The default desktop and other users' answer `403 forbidden`.
- It sees, reads and signals only its user's [detached processes](/docs/sandboxes/processes/).
- Of the sandbox's operations it may use only get, stats, resume, exec, files, detached processes, SSH access and its user's desktop, plus checkpoints and ports where its limits allow them (below). Everything else, which acts on the sandbox's other users too, is refused with `403 forbidden`: stopping, managing users, deleting checkpoints and rollback, and the sandbox's events, as well as ports and checkpoints when its limits do not allow them. A key with limits gets `403 key_limit` instead where its limits leave out the action: resizing, forking, creating, deleting or rolling back checkpoints, and publishing, linking or closing ports. Listing ports or checkpoints still answers `403 forbidden`.
- `pols login`, `pols org`, `GET /v1/org` and the Agents page name its user.
- Once its user is removed from the sandbox, the key stops working (`401`), even if a user of the same name is added again.

A key limited to a user can have limits too, but may never be allowed to resize or fork, nor to delete or roll back checkpoints, since those act on the whole sandbox. It starts with no actions allowed; with `checkpoint` it may create and list checkpoints, and with `port` it may list, publish, link and close ports.

This is separation at the level of Linux users, not a security boundary: a user with `sudo` can become root inside the sandbox, and every user can see the others' processes. Give agents that must not reach each other separate sandboxes.
