# Approvals

When a call's decision is `approve`, Godelgate holds the agent's request open and waits for a person. The agent simply sees a slow tool call. When someone decides, the call continues or fails.

A call needs approval when:

- its first matching [rule](/docs/policy) has `action: approve`, or no rule matches and `default: approve`, or
- it would complete the [lethal trifecta](/docs/trifecta) and `trifecta: approve`

## Deciding

Open **Approvals** in the dashboard. Each request shows the user, the tool, the reason and the arguments (with secrets redacted), plus a countdown.

| Button | What happens |
| --- | --- |
| **Approve once** | This call goes through. The next call that needs approval waits again. |
| **Approve for this session** | This call goes through, and so does the same tool for the rest of this agent session, without asking again. A new session starts asking again. |
| **Reject** | The call fails. |

| Outcome | What the agent gets | Audit status |
| --- | --- | --- |
| Approved | The tool's real result | `ok` (or `error`), with `approvedBy` (`… (for this session)` for session approvals) |
| Rejected | `Blocked by Godelgate: <name> rejected this call` | `rejected` |
| Timed out | `Blocked by Godelgate: nobody approved this call within … seconds`, with a link to Approvals | `rejected`, by `timeout` |

Later calls let through by a session approval are logged as `allow` with the reason `approved for this session (…)`.

## Getting told

A waiting agent is only useful if someone notices. On Cloud:

- **Chat alerts**: under **Settings → Approval alerts**, paste an incoming-webhook URL from Slack, Discord, Microsoft Teams or Google Chat. Each new approval is posted there with a link to the Approvals tab. Godelgate posts a test message when you save; the URL is stored encrypted.
- **Desktop alerts**: on the **Approvals** tab, click **Turn on desktop alerts**. While the dashboard is open in a tab, each new approval shows a browser notification, and the tab title shows how many are waiting.

## Timeout

```yaml
policy:
  approvalTimeoutSeconds: 300   # default
```

Keep it shorter than your client's request timeout, or the client may give up before you decide.

## Approving from scripts

```bash
# list pending approvals
curl -H "Authorization: Bearer $GODELGATE_ADMIN_TOKEN" https://your-gate/api/state | jq .approvals

# approve one
curl -X POST -H "Authorization: Bearer $GODELGATE_ADMIN_TOKEN" -H "content-type: application/json" \
  -d '{"approve": true, "by": "alice", "scope": "once"}' \
  https://your-gate/api/approvals/<id>
```

`by` is recorded in the audit log. `scope` is `once` (the default) or `session`. Pending approvals are held in memory: if Godelgate restarts, waiting calls fail and the agent can retry.
