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

# Create an Opsgenie notifier

> Create an Opsgenie notifier with Palo Alto Networks Cortex XCOR, Chronoctl, or Terraform.

To create an Opsgenie notifier, set up Opsgenie and then create the notifier in
Palo Alto Networks Cortex XCOR.

Before you begin, make sure you have your Opsgenie API key and API URL.

## Set up Opsgenie

Before creating an Opsgenie notifier in Cortex XCOR, generate an API key.
Refer to the [Opsgenie documentation](https://docs.opsgenie.com/docs/api-integration)
for instructions.

Next, [create an Opsgenie notifier](#create-an-opsgenie-notifier-in-cortex-xcor)
in Cortex XCOR.

## Create an Opsgenie notifier in Cortex XCOR

After [setting up Opsgenie](#set-up-opsgenie), you can create an Opsgenie notifier in
Cortex XCOR.

Select from the following methods to create an Opsgenie notifier. You can use
[variables](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/notifiers#use-variables-in-notifiers) in your
notifiers.

> [tab] Web
>
> To create an Opsgenie notifier:
>
> 1. In the navigation menu select
>    \*\* Alerting > Notifiers\*\*.
>
> 2. Click **Create notifier**.
>
> 3. Enter a descriptive name for the notifier.
>
> 4. Select **Opsgenie** as the type of notifier you want to create.
>
> 5. In the **API Key** field, enter the value of your Opsgenie API key.
>
> 6. In the **API URL** field, enter the following URL, which is called as a `POST`
>    request:
>
>    ```text theme={null}
>    https://api.opsgenie.com/
>    ```
>
> 7. Optional: Select **Notify when resolved** to send a resolved alert notification.
>
> 8. Click **Save**.

> [tab] Chronoctl
>
> To create one or more notifiers using [Chronoctl](https://docs-xcor.paloaltonetworks.com/tooling/chronoctl), create a YAML file
> that defines them and apply the configuration to your instance.
>
> > [!NOTE]
> >
> > You can use the `notifiers scaffold` command to generate an example notifier, and
> > then copy the resource definition for your notifier type:
> >
> > ```shell theme={null}
> > chronoctl notifiers scaffold
> > ```
>
> 1. Define the resource definition for your Opsgenie notifier:
>
>    ```yaml Chronoctl example icon="square-terminal" /NAME/ /SLUG/ /API_KEY/ /API_URL/ theme={null}
>    api_version: v1/config
>    kind: Notifier
>    spec:
>      name: NAME
>      slug: SLUG
>      skip_resolved: true
>      ops_genie:
>        api_key: 'API_KEY'
>        api_url: API_URL
>    ```
>
>    Replace the following:
>
>    * *`NAME`*: A descriptive name, such as `test-opsgenie`.
>    * *`SLUG`*: A unique identifier, such as `test-opsgenie`.
>    * *`API_KEY`*: Your OpsGenie API key.
>    * *`API_URL`*: Your OpsGenie API URL.
>
> 2. Enter your Opsgenie API key in the `api_key` field.
>
> 3. Enter the following URL in the `api_url` field:
>
>    ```text theme={null}
>    https://api.opsgenie.com/
>    ```
>
> 4. Apply the changes:
>
>    ```shell /FILE_NAME/ theme={null}
>    chronoctl apply -f FILE_NAME.yaml
>    ```
>
>    Replace *`FILE_NAME`* with the name of your notifier YAML file.

> [tab] Terraform
>
> To create an Opsgenie notifier:
>
> 1. Create an Opsgenie notifier with [Terraform](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform) by using the
>    `chronosphere_opsgenie_alert_notifier` type followed by a name in a resource
>    declaration:
>
>    ```terraform expandable Terraform example icon="square-terminal" theme={null}
>    resource "chronosphere_opsgenie_alert_notifier" "opsgenie_notifier" {
>      name = "Opsgenie Notifier"
>
>      # Optional slug of the Opsgenie notifier.
>      slug = "opsgenie-notifier"
>
>      ## Notifier-specific required configuration
>      # Detailed definitions can be found at: https://prometheus.io/docs/alerting/latest/configuration/#opsgenie_config
>      api_key = "API_KEY"
>
>      ## Notifier-specific optional configurations
>      api_url     = "https://API_URL"
>      message     = "custom message"
>      description = "description"
>      source      = "source"
>      tags        = ["tag-1", "tag-2"]
>      note        = "note"
>      priority    = "P1"
>
>      details = {
>        "first_detail" = "interesting detail"
>      }
>
>      # Can have multiple responders.
>      responder {
>       # Set one of the [id, name, username] fields
>        name = "Productivity Platform - Compute"
>        type = "TEAM" # Or: USER, ESCALATION, SCHEDULE
>      }
>
>      ## (Optional) Base configuration common to all notifiers
>      send_resolved = true # The default value
>
>      ## (Optional) HTTP configuration common to HTTP notifiers
>      basic_auth_username = "username"
>      basic_auth_password = "strong+p@ssword"
>      # Can use bearer_token instead of basic auth
>      tls_insecure_skip_verify = false
>    }
>    ```
>
> 2. Enter your Opsgenie API key in the `api_key` field.
>
> 3. Enter the following URL in the `api_url` field:
>
>    ```text theme={null}
>    https://api.opsgenie.com/
>    ```
>
> 4. Run `terraform apply` to create the notifier resource:
>
>    ```shell theme={null}
>    terraform apply
>    ```

> [tab] API
>
> To complete this action with the Cortex XCOR API, use the `ops_genie` object in the
> [`CreateNotifier`](https://docs-xcor.paloaltonetworks.com/tooling/api-info/definition/operations/CreateNotifier) endpoint.
>
> Because the Cortex XCOR API requires authentication, include an API token with your
> `curl` request, as shown in the following example. For more details, see
> [Create an API token](https://docs-xcor.paloaltonetworks.com/tooling/api-info.md#create-an-api-token).
>
> ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null}
> export CHRONOSPHERE_API_TOKEN="TOKEN"
> export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io"
>
> curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
>      -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH"
> ```
>
> Replace the following:
>
> * *`TOKEN`*: Your API token.
> * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance.
> * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`.
> * *`ENDPOINT_PATH`*: The specific endpoint you want to access.


## Related topics

- [Notifiers](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/notifiers.md)
- [CreateNotifier](https://docs-xcor.paloaltonetworks.com/tooling/api-info/definition/operations/CreateNotifier.md)
- [Notifier connections](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/external-connections.md)
- [Create a discard notifier](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/notifiers/discard.md)
- [Create a Slack notifier](https://docs-xcor.paloaltonetworks.com/investigate/alerts/notifications/notifiers/slack.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.