# Create

`POST /api/2.0/notification-destinations`

Creates a notification destination. Requires workspace admin permissions.

API scopes: notifications

## Request body

- `display_name` (string, optional)
  The display name for the notification destination.
- `config` (object, optional)
  The configuration for the notification destination. Must wrap EXACTLY one of the nested configs.
  - `slack` (object, required)
    - `url` (string, optional)
      [Input-Only] URL for Slack destination.
      Example: `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXX`
    - `url_set` (boolean, optional)
      [Output-Only] Whether URL is set.
    - `oauth_token` (string, optional)
      [Input-Only] OAuth token for Slack authentication.
    - `oauth_token_set` (boolean, optional)
      [Output-Only] Whether OAuth token is set.
    - `channel_id` (string, optional)
      [Input-Only] Slack channel ID for notifications.
      Example: `C1234567890`
    - `channel_id_set` (boolean, optional)
      [Output-Only] Whether channel ID is set.
  - `email` (object, required)
    - `addresses` (array of string, optional)
      Email addresses to notify.
  - `generic_webhook` (object, required)
    - `url` (string, optional)
      [Input-Only] URL for webhook.
      Example: `https://my-webhook.com`
    - `url_set` (boolean, optional)
      [Output-Only] Whether URL is set.
    - `username` (string, optional)
      [Input-Only][Optional] Username for webhook.
      Example: `username`
    - `username_set` (boolean, optional)
      [Output-Only] Whether username is set.
    - `password` (string, optional)
      [Input-Only][Optional] Password for webhook.
      Example: `password`
    - `password_set` (boolean, optional)
      [Output-Only] Whether password is set.
  - `pagerduty` (object, required)
    - `integration_key` (string, optional)
      [Input-Only] Integration key for PagerDuty.
      Example: `XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
    - `integration_key_set` (boolean, optional)
      [Output-Only] Whether integration key is set.
  - `microsoft_teams` (object, required)
    - `url` (string, optional)
      [Input-Only] URL for Microsoft Teams webhook.
      Example: `https://outlook.office.com/webhook/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
    - `url_set` (boolean, optional)
      [Output-Only] Whether URL is set.
    - `app_id` (string, optional)
      [Input-Only] App ID for Microsoft Teams App.
      Example: `00000000-0000-0000-0000-000000000000`
    - `app_id_set` (boolean, optional)
      [Output-Only] Whether App ID is set.
    - `auth_secret` (string, optional)
      [Input-Only] Secret for Microsoft Teams App authentication.
      Example: `0p8S~exampleSecretValue12345`
    - `auth_secret_set` (boolean, optional)
      [Output-Only] Whether secret is set.
    - `channel_url` (string, optional)
      [Input-Only] Channel URL for Microsoft Teams App.
    - `channel_url_set` (boolean, optional)
      [Output-Only] Whether Channel URL is set.
    - `tenant_id` (string, optional)
      [Input-Only] Tenant ID for Microsoft Teams App.
      Example: `aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee`
    - `tenant_id_set` (boolean, optional)
      [Output-Only] Whether Tenant ID is set.

## Returns

Returns the NotificationDestination object.

## Request

### Email Destination

```json
{
  "config": {
    "email": {
      "addresses": [
        "user1@gmail.com",
        "user2@gmail.com"
      ]
    }
  },
  "display_name": "My email destination"
}
```

### Microsoft Teams Destination

```json
{
  "config": {
    "microsoft_teams": {
      "url": "https://outlook.office.com/webhook/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingWebhook/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }
  },
  "display_name": "My microsoft teams destination"
}
```

### PagerDuty Destination

```json
{
  "config": {
    "pagerduty": {
      "integration_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }
  },
  "display_name": "My pagerduty destination"
}
```

### Slack Destination

```json
{
  "config": {
    "slack": {
      "url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXX"
    }
  },
  "display_name": "My slack destination"
}
```

### Webhook Destination

```json
{
  "config": {
    "generic_webhook": {
      "password": "my-password",
      "url": "https://my-webhook.com",
      "username": "my-username"
    }
  },
  "display_name": "My webhook destination"
}
```

## Response

### Email Destination

```json
{
  "config": {
    "email": {
      "addresses": [
        "user1@gmail.com",
        "user2@gmail.com"
      ]
    }
  },
  "destination_type": "EMAIL",
  "display_name": "My email destination",
  "id": "fe25e731-92f2-4838-9fb2-1ca364320a3d"
}
```

### Microsoft Teams Destination

```json
{
  "config": {
    "microsoft_teams": {
      "url_set": true
    }
  },
  "destination_type": "MICROSOFT_TEAMS",
  "display_name": "My microsoft teams destination",
  "id": "fe25e731-92f2-4838-9fb2-1ca364320a3d"
}
```

### PagerDuty Destination

```json
{
  "config": {
    "pagerduty": {
      "integration_key_set": true
    }
  },
  "destination_type": "PAGERDUTY",
  "display_name": "My pagerduty destination",
  "id": "fe25e731-92f2-4838-9fb2-1ca364320a3d"
}
```

### Slack Destination

```json
{
  "config": {
    "slack": {
      "url_set": true
    }
  },
  "destination_type": "SLACK",
  "display_name": "My slack destination",
  "id": "fe25e731-92f2-4838-9fb2-1ca364320a3d"
}
```

### Webhook Destination

```json
{
  "config": {
    "generic_webhook": {
      "password_set": true,
      "url_set": true,
      "username_set": true
    }
  },
  "destination_type": "WEBHOOK",
  "display_name": "My webhook destination",
  "id": "fe25e731-92f2-4838-9fb2-1ca364320a3d"
}
```

