---
title: Create an incident user-defined role
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Incidents
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Create an incident user-defined role{% #create-an-incident-user-defined-role %}
Copy pageCopied
{% tab title="v2" %}
**Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
| Datadog site      | API endpoint                                                                  |
| ----------------- | ----------------------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/incidents/config/user-defined-roles |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/incidents/config/user-defined-roles |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/incidents/config/user-defined-roles      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/incidents/config/user-defined-roles      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/incidents/config/user-defined-roles  |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/incidents/config/user-defined-roles |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/incidents/config/user-defined-roles     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/incidents/config/user-defined-roles |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/incidents/config/user-defined-roles |

### Overview

Create a new user-defined role for incidents.

OAuth apps require the `incident_settings_write` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#incidents) to access this endpoint.



### Arguments

#### Query Strings

| Name    | Type   | Description                                                           |
| ------- | ------ | --------------------------------------------------------------------- |
| include | string | Comma-separated list of related resources to include in the response. |

### Request

#### Body Data (required)



{% tab title="Model" %}

| Parent field  | Field                           | Type    | Description                                                                                  |
| ------------- | ------------------------------- | ------- | -------------------------------------------------------------------------------------------- |
|               | data [*required*]          | object  | Data for creating an incident user-defined role.                                             |
| data          | attributes [*required*]    | object  | Attributes for creating an incident user-defined role.                                       |
| attributes    | description                     | string  | A description of the user-defined role.                                                      |
| attributes    | name [*required*]          | string  | The name of the user-defined role.                                                           |
| attributes    | policy                          | object  | Policy configuration for a user-defined role.                                                |
| policy        | is_single [*required*]     | boolean | Whether this role can only be assigned to one responder at a time.                           |
| data          | relationships [*required*] | object  | Relationships for creating a user-defined role.                                              |
| relationships | incident_type [*required*] | object  | Relationship to an incident type for a user-defined role.                                    |
| incident_type | data [*required*]          | object  | Data for the incident type relationship of a user-defined role.                              |
| data          | id [*required*]            | uuid    | The ID of the incident type.                                                                 |
| data          | type [*required*]          | string  | The type of the resource.                                                                    |
| data          | type [*required*]          | enum    | Incident user-defined role resource type. Allowed enum values: `incident_user_defined_roles` |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "description": "The technical lead for the incident.",
      "name": "Tech Lead",
      "policy": {
        "is_single": true
      }
    },
    "relationships": {
      "incident_type": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000001",
          "type": "incident_types"
        }
      }
    },
    "type": "incident_user_defined_roles"
  }
}
```

{% /tab %}

### Response

{% tab title="201" %}
Created
{% tab title="Model" %}
Response with a single incident user-defined role.

| Parent field                  | Field                         | Type            | Description                                                                                                                                                                                                                                                           |
| ----------------------------- | ----------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                               | data [*required*]        | object          | Data for an incident user-defined role response.                                                                                                                                                                                                                      |
| data                          | attributes [*required*]  | object          | Attributes of an incident user-defined role.                                                                                                                                                                                                                          |
| attributes                    | created [*required*]     | date-time       | Timestamp when the role was created.                                                                                                                                                                                                                                  |
| attributes                    | description                   | string          | A description of the user-defined role.                                                                                                                                                                                                                               |
| attributes                    | modified [*required*]    | date-time       | Timestamp when the role was last modified.                                                                                                                                                                                                                            |
| attributes                    | name [*required*]        | string          | The name of the user-defined role.                                                                                                                                                                                                                                    |
| attributes                    | policy [*required*]      | object          | Policy configuration for a user-defined role.                                                                                                                                                                                                                         |
| policy                        | is_single [*required*]   | boolean         | Whether this role can only be assigned to one responder at a time.                                                                                                                                                                                                    |
| data                          | id [*required*]          | uuid            | The ID of the user-defined role.                                                                                                                                                                                                                                      |
| data                          | relationships                 | object          | Relationships of a user-defined role response.                                                                                                                                                                                                                        |
| relationships                 | created_by_user               | object          | Relationship to user.                                                                                                                                                                                                                                                 |
| created_by_user               | data [*required*]        | object          | Relationship to user object.                                                                                                                                                                                                                                          |
| data                          | id [*required*]          | string          | A unique identifier that represents the user.                                                                                                                                                                                                                         |
| data                          | type [*required*]        | enum            | Users resource type. Allowed enum values: `users`                                                                                                                                                                                                                     |
| relationships                 | incident_type                 | object          | Relationship to an incident type for a user-defined role.                                                                                                                                                                                                             |
| incident_type                 | data [*required*]        | object          | Data for the incident type relationship of a user-defined role.                                                                                                                                                                                                       |
| data                          | id [*required*]          | uuid            | The ID of the incident type.                                                                                                                                                                                                                                          |
| data                          | type [*required*]        | string          | The type of the resource.                                                                                                                                                                                                                                             |
| relationships                 | last_modified_by_user         | object          | Relationship to user.                                                                                                                                                                                                                                                 |
| last_modified_by_user         | data [*required*]        | object          | Relationship to user object.                                                                                                                                                                                                                                          |
| data                          | id [*required*]          | string          | A unique identifier that represents the user.                                                                                                                                                                                                                         |
| data                          | type [*required*]        | enum            | Users resource type. Allowed enum values: `users`                                                                                                                                                                                                                     |
| data                          | type [*required*]        | enum            | Incident user-defined role resource type. Allowed enum values: `incident_user_defined_roles`                                                                                                                                                                          |
|                               | included                      | [ <oneOf>] | Included resources for an incident user-defined role response.                                                                                                                                                                                                        |
| included                      | <type=users>                  | object          | User object returned by the API.                                                                                                                                                                                                                                      |
| <type=users>                  | attributes                    | object          | Attributes of user object returned by the API.                                                                                                                                                                                                                        |
| attributes                    | email                         | string          | Email of the user.                                                                                                                                                                                                                                                    |
| attributes                    | handle                        | string          | Handle of the user.                                                                                                                                                                                                                                                   |
| attributes                    | icon                          | string          | URL of the user's icon.                                                                                                                                                                                                                                               |
| attributes                    | name                          | string          | Name of the user.                                                                                                                                                                                                                                                     |
| attributes                    | uuid                          | string          | UUID of the user.                                                                                                                                                                                                                                                     |
| <type=users>                  | id                            | string          | ID of the user.                                                                                                                                                                                                                                                       |
| <type=users>                  | type                          | enum            | Users resource type. Allowed enum values: `users`                                                                                                                                                                                                                     |
| included                      | <type=incident_types>         | object          | Incident type response data.                                                                                                                                                                                                                                          |
| <type=incident_types>         | attributes                    | object          | Incident type's attributes.                                                                                                                                                                                                                                           |
| attributes                    | configuration                 | object          | The incident-type-scoped behavior settings. All fields are optional on update. Any field omitted from a PATCH request keeps its current value. This object is read-only on the incident type resource itself and is only mutated through the update (PATCH) endpoint. |
| configuration                 | allow_incident_deletion       | boolean         | Whether incidents of this type can be deleted.                                                                                                                                                                                                                        |
| configuration                 | allow_workflows               | boolean         | Whether automation workflows can be triggered for incidents of this type.                                                                                                                                                                                             |
| configuration                 | create_message                | string          | An optional message shown to users when they declare an incident of this type.                                                                                                                                                                                        |
| configuration                 | editable_timestamps           | boolean         | Whether responders can edit incident timestamps for incidents of this type.                                                                                                                                                                                           |
| configuration                 | private_incidents             | boolean         | Whether responders can create private incidents of this type. This is an opt-in setting, distinct from `private_incidents_by_default`, which controls whether incidents are created private automatically.                                                            |
| configuration                 | private_incidents_by_default  | boolean         | Whether incidents of this type are created as private by default.                                                                                                                                                                                                     |
| configuration                 | slug_source                   | enum            | When set to `servicenow`, incidents will display the ServiceNow record ID instead of the public ID. If no ServiceNow integration exists, the public ID will be displayed. Allowed enum values: `default,servicenow`                                                   |
| configuration                 | test_incidents                | boolean         | Whether incidents of this type are treated as test incidents.                                                                                                                                                                                                         |
| attributes                    | createdAt                     | date-time       | Timestamp when the incident type was created.                                                                                                                                                                                                                         |
| attributes                    | createdBy                     | string          | A unique identifier that represents the user that created the incident type.                                                                                                                                                                                          |
| attributes                    | description                   | string          | Text that describes the incident type.                                                                                                                                                                                                                                |
| attributes                    | is_default                    | boolean         | If true, this incident type will be used as the default incident type if a type is not specified during the creation of incident resources.                                                                                                                           |
| attributes                    | lastModifiedBy                | string          | A unique identifier that represents the user that last modified the incident type.                                                                                                                                                                                    |
| attributes                    | modifiedAt                    | date-time       | Timestamp when the incident type was last modified.                                                                                                                                                                                                                   |
| attributes                    | name [*required*]        | string          | The name of the incident type.                                                                                                                                                                                                                                        |
| attributes                    | prefix                        | string          | The string that will be prepended to the incident title across the Datadog app.                                                                                                                                                                                       |
| <type=incident_types>         | id [*required*]          | string          | The incident type's ID.                                                                                                                                                                                                                                               |
| <type=incident_types>         | relationships                 | object          | The incident type's resource relationships.                                                                                                                                                                                                                           |
| relationships                 | created_by_user               | object          | Relationship to user.                                                                                                                                                                                                                                                 |
| created_by_user               | data [*required*]        | object          | Relationship to user object.                                                                                                                                                                                                                                          |
| data                          | id [*required*]          | string          | A unique identifier that represents the user.                                                                                                                                                                                                                         |
| data                          | type [*required*]        | enum            | Users resource type. Allowed enum values: `users`                                                                                                                                                                                                                     |
| relationships                 | google_meet_configuration     | object          | A reference to a Google Meet Configuration resource.                                                                                                                                                                                                                  |
| google_meet_configuration     | data [*required*]        | object          | The Google Meet configuration relationship data object.                                                                                                                                                                                                               |
| data                          | id [*required*]          | string          | The unique identifier of the Google Meet configuration.                                                                                                                                                                                                               |
| data                          | type [*required*]        | string          | The type of the Google Meet configuration.                                                                                                                                                                                                                            |
| relationships                 | last_modified_by_user         | object          | Relationship to user.                                                                                                                                                                                                                                                 |
| last_modified_by_user         | data [*required*]        | object          | Relationship to user object.                                                                                                                                                                                                                                          |
| data                          | id [*required*]          | string          | A unique identifier that represents the user.                                                                                                                                                                                                                         |
| data                          | type [*required*]        | enum            | Users resource type. Allowed enum values: `users`                                                                                                                                                                                                                     |
| relationships                 | microsoft_teams_configuration | object          | A reference to a Microsoft Teams Configuration resource.                                                                                                                                                                                                              |
| microsoft_teams_configuration | data [*required*]        | object          | The Microsoft Teams configuration relationship data object.                                                                                                                                                                                                           |
| data                          | id [*required*]          | string          | The unique identifier of the Microsoft Teams configuration.                                                                                                                                                                                                           |
| data                          | type [*required*]        | string          | The type of the Microsoft Teams configuration.                                                                                                                                                                                                                        |
| relationships                 | zoom_configuration            | object          | A reference to a Zoom configuration resource.                                                                                                                                                                                                                         |
| zoom_configuration            | data [*required*]        | object          | The Zoom configuration relationship data object.                                                                                                                                                                                                                      |
| data                          | id [*required*]          | string          | The unique identifier of the Zoom configuration.                                                                                                                                                                                                                      |
| data                          | type [*required*]        | string          | The type of the Zoom configuration.                                                                                                                                                                                                                                   |
| <type=incident_types>         | type [*required*]        | enum            | Incident type resource type. Allowed enum values: `incident_types`                                                                                                                                                                                                    |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "created": "2024-01-01T00:00:00.000Z",
      "description": "The technical lead for the incident.",
      "modified": "2024-01-01T00:00:00.000Z",
      "name": "Tech Lead",
      "policy": {
        "is_single": true
      }
    },
    "id": "00000000-0000-0000-0000-000000000002",
    "relationships": {
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "incident_type": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000001",
          "type": "incident_types"
        }
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incident_user_defined_roles"
  },
  "included": [
    {
      "attributes": {
        "email": "string",
        "handle": "string",
        "icon": "string",
        "name": "string",
        "uuid": "string"
      },
      "id": "string",
      "type": "users"
    }
  ]
}
```

{% /tab %}

{% /tab %}

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

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

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

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "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/incidents/config/user-defined-roles" \
-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": {
      "description": "The technical lead for the incident.",
      "name": "Tech Lead",
      "policy": {
        "is_single": true
      }
    },
    "relationships": {
      "incident_type": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000001",
          "type": "incident_types"
        }
      }
    },
    "type": "incident_user_defined_roles"
  }
}
EOF 
                
{% /tab %}
