# Alert endpoints

> Check and cancel an escalating alert, and receive the signed callback when someone acknowledges it.

A push with `escalate` creates an alert. If nobody acknowledges it, Opush moves through the steps you chose (push again, call the phone, text, phone call) every few minutes. These endpoints let the sender follow the alert. For the parameters and what the phone does, see [Call alerts](/docs/push/call-alerts).

| Method | Path | What it does |
|---|---|---|
| `GET` | `/alerts/{alert_id}` | Current status and the result of each step |
| `DELETE` | `/alerts/{alert_id}` | Stop escalating |

The alert ID (`al_` plus 20 characters) is the secret. You get it in the push response as `data.escalation.alert_id`, together with the full `status_url`.

## Create an alert [#create-an-alert]

```bash
curl "https://opu.sh/YOUR_KEY/Database%20down?escalate=voice,sms,phone&escalate_after=3&voice=down&callback_url=https://example.com/ack"
```

```json
{
  "code": 200,
  "message": "success",
  "timestamp": 1793546000,
  "data": {
    "escalation": {
      "alert_id": "al_9Qx2LmT4vB7nKp3RfZ8c",
      "steps": ["voice", "sms", "phone"],
      "every_minutes": 3,
      "next_at": "2026-11-04T09:33:00Z",
      "status_url": "https://opu.sh/alerts/al_9Qx2LmT4vB7nKp3RfZ8c",
      "callback_secret": "ocs_…"
    }
  }
}
```

The first push goes out right away. Each step then runs `every_minutes` apart, until someone acknowledges the alert or the steps run out.

## GET /alerts/\{alert_id\} [#get-alertsalert_id]

```bash
curl https://opu.sh/alerts/al_9Qx2LmT4vB7nKp3RfZ8c
```

```json
{
  "alert_id": "al_9Qx2LmT4vB7nKp3RfZ8c",
  "status": "acked",
  "steps": ["voice", "sms", "phone"],
  "next_step": null,
  "next_at": null,
  "acked_at": "2026-11-04T09:34:10Z",
  "acked_by": "call",
  "acked_account_id": "acc_…",
  "channel_id": null,
  "history": [
    { "step": "voice", "at": "2026-11-04T09:33:00Z", "result": "called" }
  ],
  "created_at": "2026-11-04T09:30:00Z"
}
```

| Field | Description |
|---|---|
| `status` | `active` (still escalating), `acked`, `done` (all steps ran, no one acknowledged), or `cancelled` |
| `steps` | The steps in order: `push`, `voice`, `sms`, `phone`, and `team` for on-call channel pushes |
| `next_step`, `next_at` | The next step and when it runs. `null` unless `active` |
| `acked_at`, `acked_by` | When and how it was acknowledged: `notification`, `app`, `call`, `phone`, or `mcp` |
| `acked_account_id` | The account that acknowledged it. On an [on-call](/docs/teams/on-call) alert, this can be another channel member |
| `channel_id` | Set for on-call alerts from a team channel |
| `history` | One entry per step that ran, with `step`, `at`, and `result` |
| `created_at` | When the first push was sent |

`result` describes what happened, for example `sent`, `called`, `sent 1` (texts sent to one number), `called 1`, or a reason the step was skipped, like `not_enabled` (call alerts are off on the device), `no_numbers`, `quota`, or `rate_limited`. Treat it as a readable note, not a fixed list.

A `done` alert can still be acknowledged for one hour after the last step. Alerts are deleted after 7 days.

## DELETE /alerts/\{alert_id\} [#delete-alertsalert_id]

Stops an active alert. No more steps run. Returns the alert in the same format as `GET`, with `status: "cancelled"`. If the alert had already ended, nothing changes.

```bash
curl -X DELETE https://opu.sh/alerts/al_9Qx2LmT4vB7nKp3RfZ8c
```

Recalling the push with `delete=1` and the same `id` cancels the alert too.

## Ways to acknowledge [#ways-to-acknowledge]

- Tap **Got it** on the notification (after unlocking the phone).
- Tap **Got it** on the message in the app.
- Answer a call alert from the escalation.
- Press 1 during a phone call from the escalation.
- An agent calls the MCP tool `ack_alert`.

## Callback [#callback]

If you passed `callback_url`, Opush sends one `POST` when the alert is acknowledged:

```http
POST /ack HTTP/1.1
Content-Type: application/json
User-Agent: Opush/1.0
X-Opush-Signature: sha256=8a3e…

{"alert_id":"al_9Qx2LmT4vB7nKp3RfZ8c","status":"acked","acked_at":"2026-11-04T09:34:10Z","acked_by":"call","acked_account_id":"acc_…"}
```

`X-Opush-Signature` is `sha256=` plus the hex HMAC-SHA256 of the raw body, keyed with `callback_secret` from the push response. Verify it the same way as [question callbacks](/docs/agents/ask#get-a-callback).

The callback is sent once, with a 10-second timeout, and isn't retried. Nothing is sent when an alert finishes without acknowledgment or is cancelled. Poll `GET /alerts/{alert_id}` if you need those states.

## Errors [#errors]

```json
{ "error": { "code": "not_found", "message": "Alert not found." } }
```

| Status | Code | When |
|---|---|---|
| `404` | `not_found` | Unknown or deleted alert ID |

Invalid `escalate` values are rejected when you send the push, with a `400` in the push response format. See [Push endpoints](/docs/api/push#errors).
