# Incident response

**Last updated:** 2026-11-27T14:16:11-03:00 (UTC-3)

[Security and trust](/docs/security/trust/) · [Threat model](/docs/security/threat-model/) · [Continuity](/docs/security/business-continuity/) · [Operations](/docs/operate/operations/)

m7gtw's security incident runbook: how to contain, investigate and recover. Each step uses a product feature, and the sequence was simulated on the local gateway (below).

## 1. Contain

| Situation | Action | Effect |
|---|---|---|
| Widespread misuse, unknown origin, costs spiking | **Emergency stop:** `POST /api/v1/admin/panic` with a reason, or the button in the console | All inference stops on every replica, with 503. The console and the admin API stay up so you can investigate |
| A leaked key | **Revoke:** `POST /api/v1/admin/keys/{id}/revoke` | The key gets 401 on the next request |
| A compromised team | A team policy with no models, or deleting the team | All of the team's keys stop |
| A compromised console user | Deactivate: `DELETE /api/v1/admin/users/{id}`, or through SCIM | Their sessions drop on the next request |
| A leaked provider credential | Rotate it at the provider and update it in the console (Providers) or in the vault | The new key takes effect immediately; with a vault, on the next read |
| A provider or model with problems | Deactivate the alias, or let the circuit breaker open | Traffic goes to the fallback, if there is one |

The emergency stop is the first step when the origin is unclear: it stops everything without deleting anything. Releasing it is `DELETE /api/v1/admin/panic`.

## 2. Investigate

- **By request:** every request has a `request_id` and a `traceparent`. **Request logs** filters by `request_id`, key, team, model, status, end user and session, and exports CSV. [Observability](/docs/features/observability/).
- **By change:** the audit explorer shows who changed keys, teams, providers, flags and policies, with the change's `request_id`. ADR 0020.
- **By cost:** Analytics and valuation show usage and cost per key, team and model over the period.
- **External trail:** OTLP traces and log destinations (S3, GCS, Datadog and others) keep the journey outside the gateway, even if the database is affected.

The gateway does not store prompts or responses in logs. If the content is needed for the investigation, only eval captures and [content captures](/docs/features/content-capture/) have it, and only if a capture policy was turned on for the team. What a responder may reveal of a content capture follows their role's [content permissions](/docs/features/content-capture/#who-can-read) (the received view needs the administrator, the organization admin or a `content:read` grant), and every reveal is itself audited.

## 3. Recover

1. Rotate the exposed credentials: client keys with [rotation](/docs/features/key-rotation/), and provider credentials at the provider.
2. Release the emergency stop.
3. Watch Analytics and the alerts to confirm usage is back to normal.
4. If data was lost or altered, restore the backup ([continuity](/docs/security/business-continuity/)).

## 4. Record

Record what happened, when, the cause, what was exposed and what changes so it does not happen again. If the cause was a gateway defect, the fix comes with a test and goes into the CHANGELOG. If a trust boundary changed, it gets an ADR and goes into the [threat model](/docs/security/threat-model/).

Alerts help you detect problems earlier: a budget close to its limit, a guardrail block and provider failures can go to a webhook, Slack, Teams, email or PagerDuty ([alerts](/docs/features/alerting/)).

## Simulation performed

On 2026-10-27, on the local gateway, with a test key created for this purpose:

| Step | Result |
|---|---|
| Normal call with the key | 200 |
| Request logs search by `request_id` | 1 event, with principal, model, status and key |
| Emergency stop triggered | Recorded with actor and reason, propagated through the database |
| Call during the stop | **503** |
| Stop released and a new call | 200 |
| Key revoked and a new call | **401** |
| Test key deleted | — |

## Limits

- The emergency stop is global: there is no stop for a single team or a single model yet.
- There is no automatic blocking on usage anomalies: the alert warns you, and containment is manual.
- Without a capture policy turned on before the incident, request content is not available for the investigation.

## Admin API routes

Every route below needs a console session or an admin Bearer token, the role's permission and, for writes, the `X-CSRF-Token` header; the full contract is in the [API reference](/docs/api/).

| Route | What it does |
| --- | --- |
| `GET /api/v1/admin/panic` | Reads the emergency stop state |
