> ## Documentation Index
> Fetch the complete documentation index at: https://docs.happyuptime.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Opsgenie

Open and close Opsgenie alerts from monitor, incident, and vendor events.

# Opsgenie

Happy Uptime creates Opsgenie alerts via the [Alerts API](https://docs.opsgenie.com/docs/alert-api). Incident/monitor recoveries close the alert using the same `alias`.

## Get the API key

1. In Opsgenie: **Settings → API key management → Add new API key**.
2. Grant it `Create and Update Access` and `Read Access`.
3. Copy the key.

## Add the channel

```bash
curl -X POST https://happyuptime.com/api/v1/alerts/channels \
  -H "Authorization: Bearer $HU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Opsgenie — SRE",
    "type": "opsgenie",
    "config": {
      "apiKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "region": "us",
      "teamId": "team-uuid-optional"
    }
  }'
```

| Key | Purpose |
| --- | --- |
| `apiKey` | Opsgenie API integration key |
| `region` | `us` (default) or `eu` |
| `teamId` | Optional Opsgenie team to route to |

## Mapping

| Happy Uptime event | Opsgenie action | Priority |
| --- | --- | --- |
| `monitor.down` | create alert | `P1` |
| `monitor.degraded` | create alert | `P3` |
| `monitor.up` | close alert | — |
| `incident.created` (critical) | create alert | `P1` |
| `incident.created` (major) | create alert | `P2` |
| `incident.created` (minor) | create alert | `P3` |
| `incident.resolved` | close alert | — |
| `vendor.down` | create alert | severity-mapped |
| `vendor.resolved` | close alert | — |

Alias keys follow `hu:mon:<id>`, `hu:inc:<id>`, `hu:vendor:<name>` so creates and closes correlate cleanly.