---
title: Approvals · Sandboxes docs
description: Approval rules hold risky commands until a person approves or denies them in the dashboard.
url: https://www.quietrobot.ai/docs/sandboxes/approvals
---

# Approvals

Approval rules hold risky commands until a person approves or denies them in the dashboard.

> [!NOTE]
> Sandboxes is in early access. It is free to try, some parts are still in testing, and details may change.

An approval rule is a pattern. When a command matches one of your organization's rules, it doesn't run. The API answers `202` with an execution in `pending_approval`, and the command waits for a person.

## Default rules

Every new organization starts with these. You can turn them off, edit them or add your own in the dashboard under **Policy**.

| Rule | Catches, for example |
|---|---|
| Recursive force delete | `rm -rf build`, `rm -fr /tmp/x` |
| Privilege escalation | `sudo apt install …`, `su root` |
| Pushing code to a remote | `git push origin main` |
| Sending data out with curl or wget | `curl -X POST …`, `curl --data …`, `wget --post-file …` |
| Remote shell or file copy | `ssh`, `scp`, `sftp`, `rsync` |

Rules are regular expressions, matched case-insensitively against the whole command. A rule whose pattern doesn't compile holds every command, so a typo fails safe.

## What happens to a held command

1. `exec` returns `202` with `status: "pending_approval"` and `approval.reason`, the rule's description.
2. The command shows up in the dashboard under **Approvals**, with who asked (which API key or person) and the exact command.
3. A signed-in person approves or denies it, with an optional note.
   * **Approve:** the command runs then, with the `cwd`, `env` and timeout it was sent with. The execution moves to `running`, then `completed` or `failed`.
   * **Deny:** the execution becomes `denied`. It never runs.
4. Both the request and the decision are in the audit log.

**An API key can't approve.** `POST /api/v1/executions/{id}/approve` and `/deny` only work for a signed-in dashboard session. A key gets `403 forbidden`.

**Approvals guard against an agent, not against a teammate.** Any signed-in member of the organization can approve a held command, including one they sent themselves. Rules match the text of the command, so they catch the usual forms and a determined person can word around them. To limit what a sandbox can reach whatever runs in it, use the [network policy](https://www.quietrobot.ai/docs/sandboxes/network).

## Waiting for the decision

Poll `GET /api/v1/executions/{id}` until `status` is no longer `pending_approval` or `running`. The SDK does this for you:

```ts
try {
  const run = await sbx.exec("git push origin main", {
    onPending: (e) => console.log(`Waiting for a person: ${e.approval?.reason}`),
    approvalTimeoutMs: 15 * 60_000, // default 30 minutes
  });
  console.log(run.exitCode);
} catch (e) {
  if (e instanceof CommandDeniedError) console.log("Denied:", e.message);
  else throw e;
}
```

Pass `waitForApproval: false` to get the pending execution back straight away.

> [!TIP]
> Rules match the text of the command. They're a seatbelt for an agent that means well, not a wall against code that's trying to hide. The [outbound network rules](https://www.quietrobot.ai/docs/sandboxes/network) are the wall: they hold whatever the command looks like.
