---
title: Create a new Opsgenie account
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Opsgenie Integration
---

# Create a new Opsgenie account{% #create-a-new-opsgenie-account %}
Copy pageCopied
{% tab title="v2" %}

| Datadog site      | API endpoint                                                            |
| ----------------- | ----------------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/integration/opsgenie/accounts |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/integration/opsgenie/accounts |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/integration/opsgenie/accounts      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/integration/opsgenie/accounts      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/integration/opsgenie/accounts  |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/integration/opsgenie/accounts     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/integration/opsgenie/accounts |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/integration/opsgenie/accounts |

### Overview

Create a new Opsgenie account in the Datadog Opsgenie integration. This endpoint requires the `manage_integrations` permission.

### Request

#### Body Data (required)

Opsgenie account payload.

{% tab title="Model" %}

| Parent field | Field                        | Type   | Description                                                              |
| ------------ | ---------------------------- | ------ | ------------------------------------------------------------------------ |
|              | data [*required*]       | object | Opsgenie account data for a create request.                              |
| data         | attributes [*required*] | object | The Opsgenie account attributes for a create request.                    |
| attributes   | api_key [*required*]    | string | The Opsgenie API key for your Opsgenie account.                          |
| attributes   | region [*required*]     | enum   | The region for the Opsgenie service. Allowed enum values: `us,eu,custom` |
| data         | type [*required*]       | enum   | Opsgenie account resource type. Allowed enum values: `opsgenie-account`  |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "api_key": "00000000-0000-0000-0000-000000000000",
      "region": "us"
    },
    "type": "opsgenie-account"
  }
}
```

{% /tab %}

### Response

{% tab title="201" %}
CREATED
{% tab title="Model" %}
Response containing an Opsgenie account.

| Parent field | Field                        | Type   | Description                                                              |
| ------------ | ---------------------------- | ------ | ------------------------------------------------------------------------ |
|              | data [*required*]       | object | Opsgenie account data from a response.                                   |
| data         | attributes [*required*] | object | The attributes from an Opsgenie account response.                        |
| attributes   | region                       | enum   | The region for the Opsgenie service. Allowed enum values: `us,eu,custom` |
| data         | id [*required*]         | string | The ID of the Opsgenie account.                                          |
| data         | type [*required*]       | enum   | Opsgenie account resource type. Allowed enum values: `opsgenie-account`  |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "region": "us"
    },
    "id": "596da4af-0563-4097-90ff-07230c3f9db3",
    "type": "opsgenie-account"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \## default
# 
 \# Curl command curl -X POST "https://api.datadoghq.com/api/v2/integration/opsgenie/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "api_key": "00000000-0000-0000-0000-000000000000",
      "region": "us"
    },
    "type": "opsgenie-account"
  }
}
EOF 
                
{% /tab %}
