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

# OpsGenie

> Connect OpsGenie so OpenSRE can read active alerts and incident context

## Overview

OpenSRE queries OpsGenie for active alerts and alert details so the agent can
correlate on-call incidents with infrastructure events.

There is **no** `opensre integrations setup opsgenie` handler today. Configure OpsGenie
with environment variables or the integration store, then verify with
`opensre integrations verify opsgenie`.

## Prerequisites

* OpsGenie account (Atlassian or standalone)
* API key with read access

## Setup

### Option 1: Environment variables

```bash theme={null}
OPSGENIE_API_KEY=your-api-key
OPSGENIE_REGION=us   # or "eu" for EU accounts
```

| Variable           | Default | Description                    |
| ------------------ | ------- | ------------------------------ |
| `OPSGENIE_API_KEY` | —       | **Required.** OpsGenie API key |
| `OPSGENIE_REGION`  | `us`    | Region: `us` or `eu`           |

### Option 2: Persistent store

```json theme={null}
{
  "version": 1,
  "integrations": [
    {
      "id": "opsgenie-prod",
      "service": "opsgenie",
      "status": "active",
      "credentials": {
        "api_key": "your-api-key",
        "region": "us"
      }
    }
  ]
}
```

## Credentials

1. In OpsGenie, go to **Settings** → **API key management**
2. Click **Add new API key**
3. Name it `opensre` and enable **Read** access
4. Copy the key

<Info>
  EU accounts use a different endpoint. Set `OPSGENIE_REGION=eu` if your OpsGenie URL
  is `app.eu.opsgenie.com`.
</Info>

## Tools

| Tool                    | What it does                           |
| ----------------------- | -------------------------------------- |
| `opsgenie_alerts`       | List and search active OpsGenie alerts |
| `opsgenie_alert_detail` | Fetch full detail for one alert by ID  |

Run `opsgenie_alerts` first to find an alert ID, then call `opsgenie_alert_detail`
when you need deeper context.

## Verify

```bash theme={null}
opensre integrations verify opsgenie
```

Expected output:

```
Service: opsgenie
Status: passed
Detail: Connected to OpsGenie (US region); API key accepted.
```

## Troubleshooting

| Symptom                               | Fix                                                          |
| ------------------------------------- | ------------------------------------------------------------ |
| **401 Unauthorized**                  | Check the API key and confirm it has Read access             |
| **404 Not Found**                     | Set `OPSGENIE_REGION=eu` if you use the EU instance          |
| **Rate limited**                      | OpsGenie enforces per-minute limits — reduce query frequency |
| `opensre integrations setup opsgenie` | Not available — use env vars or the store                    |

## Security

* Use a **read-only API key** — OpsGenie supports granular permission scopes.
* Store the API key in `.env` or your secret manager — not in source control.
