---
title: Create a Salesforce incident template
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Salesforce Integration
---

# Create a Salesforce incident template{% #create-a-salesforce-incident-template %}
Copy pageCopied
{% tab title="v2" %}

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

### Overview

Create a new Salesforce incident template for your organization. Template names must be unique within an organization. This endpoint requires the `manage_integrations` permission.

### Request

#### Body Data (required)

Salesforce incident template payload.

{% tab title="Model" %}

| Parent field | Field                               | Type   | Description                                                                                                       |
| ------------ | ----------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]              | object | Salesforce incident template data for a create request.                                                           |
| data         | attributes [*required*]        | object | Salesforce incident template attributes for a create request.                                                     |
| attributes   | description [*required*]       | string | Long-form description body for Salesforce incidents created from this template.                                   |
| attributes   | name [*required*]              | string | Human-readable name for this incident template. Must be unique within your organization.                          |
| attributes   | owner_id [*required*]          | string | The Salesforce user ID that owns incidents created from this template.                                            |
| attributes   | priority [*required*]          | enum   | Priority of the Salesforce incident created from this template. Allowed enum values: `Critical,High,Moderate,Low` |
| attributes   | salesforce_org_id [*required*] | uuid   | The Datadog-assigned ID of the Salesforce organization this template belongs to.                                  |
| attributes   | subject [*required*]           | string | Subject line for Salesforce incidents created from this template.                                                 |
| data         | type [*required*]              | enum   | Salesforce incident template resource type. Allowed enum values: `salesforce-incidents-incident-template`         |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "description": "An incident was detected by Datadog monitors.",
      "name": "production-outage",
      "owner_id": "005000000000000",
      "priority": "High",
      "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3",
      "subject": "Datadog Incident: Production Outage"
    },
    "type": "salesforce-incidents-incident-template"
  }
}
```

{% /tab %}

### Response

{% tab title="201" %}
CREATED
{% tab title="Model" %}
Response containing a Salesforce incident template.

| Parent field | Field                        | Type   | Description                                                                                                       |
| ------------ | ---------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object | Salesforce incident template data from a response.                                                                |
| data         | attributes [*required*] | object | Salesforce incident template attributes returned by the API.                                                      |
| attributes   | description                  | string | Long-form description body for Salesforce incidents created from this template.                                   |
| attributes   | name                         | string | Human-readable name for this incident template.                                                                   |
| attributes   | owner_id                     | string | The Salesforce user ID that owns incidents created from this template.                                            |
| attributes   | priority                     | enum   | Priority of the Salesforce incident created from this template. Allowed enum values: `Critical,High,Moderate,Low` |
| attributes   | salesforce_org_id            | uuid   | The Datadog-assigned ID of the Salesforce organization this template belongs to.                                  |
| attributes   | subject                      | string | Subject line for Salesforce incidents created from this template.                                                 |
| data         | id [*required*]         | string | The ID of the Salesforce incident template.                                                                       |
| data         | type [*required*]       | enum   | Salesforce incident template resource type. Allowed enum values: `salesforce-incidents-incident-template`         |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "description": "An incident was detected by Datadog monitors.",
      "name": "production-outage",
      "owner_id": "005000000000000",
      "priority": "High",
      "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3",
      "subject": "Datadog Incident: Production Outage"
    },
    "id": "596da4af-0563-4097-90ff-07230c3f9db3",
    "type": "salesforce-incidents-incident-template"
  }
}
```

{% /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="404" %}
Not Found
{% 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="409" %}
Conflict
{% 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/salesforce-incidents/incident-templates" \
-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": "An incident was detected by Datadog monitors.",
      "name": "production-outage",
      "owner_id": "005000000000000",
      "priority": "High",
      "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3",
      "subject": "Datadog Incident: Production Outage"
    },
    "type": "salesforce-incidents-incident-template"
  }
}
EOF 
                
##### 

```python
"""
Create a Salesforce incident template returns "CREATED" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.salesforce_integration_api import SalesforceIntegrationApi
from datadog_api_client.v2.model.salesforce_incidents_template_create_attributes import (
    SalesforceIncidentsTemplateCreateAttributes,
)
from datadog_api_client.v2.model.salesforce_incidents_template_create_data import SalesforceIncidentsTemplateCreateData
from datadog_api_client.v2.model.salesforce_incidents_template_create_request import (
    SalesforceIncidentsTemplateCreateRequest,
)
from datadog_api_client.v2.model.salesforce_incidents_template_priority import SalesforceIncidentsTemplatePriority
from datadog_api_client.v2.model.salesforce_incidents_template_type import SalesforceIncidentsTemplateType
from uuid import UUID

body = SalesforceIncidentsTemplateCreateRequest(
    data=SalesforceIncidentsTemplateCreateData(
        attributes=SalesforceIncidentsTemplateCreateAttributes(
            description="An incident was detected by Datadog monitors.",
            name="production-outage",
            owner_id="005000000000000",
            priority=SalesforceIncidentsTemplatePriority.HIGH,
            salesforce_org_id=UUID("596da4af-0563-4097-90ff-07230c3f9db3"),
            subject="Datadog Incident: Production Outage",
        ),
        type=SalesforceIncidentsTemplateType.SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SalesforceIntegrationApi(api_client)
    response = api_instance.create_incident_template(body=body)

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
##### 

```ruby
# Create a Salesforce incident template returns "CREATED" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SalesforceIntegrationAPI.new

body = DatadogAPIClient::V2::SalesforceIncidentsTemplateCreateRequest.new({
  data: DatadogAPIClient::V2::SalesforceIncidentsTemplateCreateData.new({
    attributes: DatadogAPIClient::V2::SalesforceIncidentsTemplateCreateAttributes.new({
      description: "An incident was detected by Datadog monitors.",
      name: "production-outage",
      owner_id: "005000000000000",
      priority: DatadogAPIClient::V2::SalesforceIncidentsTemplatePriority::HIGH,
      salesforce_org_id: "596da4af-0563-4097-90ff-07230c3f9db3",
      subject: "Datadog Incident: Production Outage",
    }),
    type: DatadogAPIClient::V2::SalesforceIncidentsTemplateType::SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE,
  }),
})
p api_instance.create_incident_template(body)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
##### 

```go
// Create a Salesforce incident template returns "CREATED" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
	"github.com/google/uuid"
)

func main() {
	body := datadogV2.SalesforceIncidentsTemplateCreateRequest{
		Data: datadogV2.SalesforceIncidentsTemplateCreateData{
			Attributes: datadogV2.SalesforceIncidentsTemplateCreateAttributes{
				Description:     "An incident was detected by Datadog monitors.",
				Name:            "production-outage",
				OwnerId:         "005000000000000",
				Priority:        datadogV2.SALESFORCEINCIDENTSTEMPLATEPRIORITY_HIGH,
				SalesforceOrgId: uuid.MustParse("596da4af-0563-4097-90ff-07230c3f9db3"),
				Subject:         "Datadog Incident: Production Outage",
			},
			Type: datadogV2.SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSalesforceIntegrationApi(apiClient)
	resp, r, err := api.CreateIncidentTemplate(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SalesforceIntegrationApi.CreateIncidentTemplate`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SalesforceIntegrationApi.CreateIncidentTemplate`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
##### 

```java
// Create a Salesforce incident template returns "CREATED" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SalesforceIntegrationApi;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateCreateAttributes;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateCreateData;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateCreateRequest;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplatePriority;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateResponse;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateType;
import java.util.UUID;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    SalesforceIntegrationApi apiInstance = new SalesforceIntegrationApi(defaultClient);

    SalesforceIncidentsTemplateCreateRequest body =
        new SalesforceIncidentsTemplateCreateRequest()
            .data(
                new SalesforceIncidentsTemplateCreateData()
                    .attributes(
                        new SalesforceIncidentsTemplateCreateAttributes()
                            .description("An incident was detected by Datadog monitors.")
                            .name("production-outage")
                            .ownerId("005000000000000")
                            .priority(SalesforceIncidentsTemplatePriority.HIGH)
                            .salesforceOrgId(
                                UUID.fromString("596da4af-0563-4097-90ff-07230c3f9db3"))
                            .subject("Datadog Incident: Production Outage"))
                    .type(SalesforceIncidentsTemplateType.SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE));

    try {
      SalesforceIncidentsTemplateResponse result = apiInstance.createIncidentTemplate(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SalesforceIntegrationApi#createIncidentTemplate");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
##### 

```rust
// Create a Salesforce incident template returns "CREATED" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_salesforce_integration::SalesforceIntegrationAPI;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplateCreateAttributes;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplateCreateData;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplateCreateRequest;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplatePriority;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplateType;
use uuid::Uuid;

#[tokio::main]
async fn main() {
    let body =
        SalesforceIncidentsTemplateCreateRequest::new(SalesforceIncidentsTemplateCreateData::new(
            SalesforceIncidentsTemplateCreateAttributes::new(
                "An incident was detected by Datadog monitors.".to_string(),
                "production-outage".to_string(),
                "005000000000000".to_string(),
                SalesforceIncidentsTemplatePriority::HIGH,
                Uuid::parse_str("596da4af-0563-4097-90ff-07230c3f9db3").expect("invalid UUID"),
                "Datadog Incident: Production Outage".to_string(),
            ),
            SalesforceIncidentsTemplateType::SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE,
        ));
    let configuration = datadog::Configuration::new();
    let api = SalesforceIntegrationAPI::with_config(configuration);
    let resp = api.create_incident_template(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
##### 

```typescript
/**
 * Create a Salesforce incident template returns "CREATED" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.SalesforceIntegrationApi(configuration);

const params: v2.SalesforceIntegrationApiCreateIncidentTemplateRequest = {
  body: {
    data: {
      attributes: {
        description: "An incident was detected by Datadog monitors.",
        name: "production-outage",
        ownerId: "005000000000000",
        priority: "High",
        salesforceOrgId: "596da4af-0563-4097-90ff-07230c3f9db3",
        subject: "Datadog Incident: Production Outage",
      },
      type: "salesforce-incidents-incident-template",
    },
  },
};

apiInstance
  .createIncidentTemplate(params)
  .then((data: v2.SalesforceIncidentsTemplateResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
{% /tab %}
