This product is not supported for your selected Datadog site. ().

Get On-Call escalation policy

GET https://api.ap1.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.ap2.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.datadoghq.eu/api/v2/on-call/escalation-policies/{policy_id}https://api.ddog-gov.com/api/v2/on-call/escalation-policies/{policy_id}https://api.us2.ddog-gov.com/api/v2/on-call/escalation-policies/{policy_id}https://api.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.us3.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.us5.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}

Overview

Get an On-Call escalation policy This endpoint requires the on_call_read permission.

Arguments

Path Parameters

Name

Type

Description

policy_id [required]

string

The ID of the escalation policy

Query Strings

Name

Type

Description

include

string

Comma-separated list of included relationships to be returned. Allowed values: teams, steps, steps.targets.

Response

OK

Represents a complete escalation policy response, including policy data and optionally included related resources.

Expand All

Field

Type

Description

data

object

Represents the data for a single escalation policy, including its attributes, ID, relationships, and resource type.

attributes

object

Defines the main attributes of an escalation policy, such as its name and behavior on policy end.

name [required]

string

Specifies the name of the escalation policy.

resolve_page_on_policy_end

boolean

Indicates whether the page is automatically resolved when the policy ends.

retries

int64

Specifies how many times the escalation sequence is retried if there is no response.

id

string

Specifies the unique identifier of the escalation policy.

relationships

object

Represents the relationships for an escalation policy, including references to steps and teams.

steps [required]

object

Defines the relationship to a collection of steps within an escalation policy. Contains an array of step data references.

data

[object]

An array of references to the steps defined in this escalation policy.

id [required]

string

Specifies the unique identifier for the step resource.

type [required]

enum

Indicates that the resource is of type steps. Allowed enum values: steps

default: steps

teams

object

Associates teams with this schedule in a data structure.

data

[object]

An array of team references for this schedule.

id [required]

string

The unique identifier of the team in this relationship.

type [required]

enum

Teams resource type. Allowed enum values: teams

default: teams

type [required]

enum

Indicates that the resource is of type policies. Allowed enum values: policies

default: policies

included

[ <oneOf>]

Provides any included related resources, such as steps or targets, returned with the policy.

Option 1

object

Represents a single step in an escalation policy, including its attributes, relationships, and resource type.

attributes

object

Defines attributes for an escalation policy step, such as assignment strategy and escalation timeout.

assignment

enum

Specifies how this escalation step will assign targets (example default or round-robin). Allowed enum values: default,round-robin

escalate_after_seconds

int64

Specifies how many seconds to wait before escalating to the next step.

id

string

Specifies the unique identifier of this escalation policy step.

relationships

object

Represents the relationship of an escalation policy step to its targets.

targets

object

A list of escalation targets for a step

data

[ <oneOf>]

The EscalationTargets data.

Option 1

object

Represents a team target for an escalation policy step, including the team's ID and resource type.

id [required]

string

Specifies the unique identifier of the team resource.

type [required]

enum

Indicates that the resource is of type teams. Allowed enum values: teams

default: teams

Option 2

object

Represents a user target for an escalation policy step, including the user's ID and resource type.

id [required]

string

Specifies the unique identifier of the user resource.

type [required]

enum

Indicates that the resource is of type users. Allowed enum values: users

default: users

Option 3

object

Represents a schedule target for an escalation policy step, including its ID and resource type. This is a shortcut for a configured schedule target with position set to 'current'.

id [required]

string

Specifies the unique identifier of the schedule resource.

type [required]

enum

Indicates that the resource is of type schedules. Allowed enum values: schedules

default: schedules

Option 4

object

Relationship reference to a configured schedule target.

id [required]

string

Specifies the unique identifier of the configured schedule target.

type [required]

enum

Indicates that the resource is of type schedule_target. Allowed enum values: schedule_target

default: schedule_target

type [required]

enum

Indicates that the resource is of type steps. Allowed enum values: steps

default: steps

Option 2

object

Represents a user object in the context of an escalation policy, including their id, type, and basic attributes.

attributes

object

Provides basic user information for an escalation policy, including a name and email address.

email

string

The user's email address.

name

string

The user's name.

status

enum

The user's status. Allowed enum values: active,deactivated,pending

id

string

The unique user identifier.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

Option 3

object

Represents the primary data object for a schedule, linking attributes and relationships.

attributes

object

Provides core properties of a schedule object such as its name and time zone.

name

string

A short name for the schedule.

time_zone

string

The time zone in which this schedule operates.

id

string

The schedule's unique identifier.

relationships

object

Groups the relationships for a schedule object, referencing layers and teams.

layers

object

Associates layers with this schedule in a data structure.

data

[object]

An array of layer references for this schedule.

id [required]

string

The unique identifier of the layer in this relationship.

type [required]

enum

Layers resource type. Allowed enum values: layers

default: layers

teams

object

Associates teams with this schedule in a data structure.

data

[object]

An array of team references for this schedule.

id [required]

string

The unique identifier of the team in this relationship.

type [required]

enum

Teams resource type. Allowed enum values: teams

default: teams

type [required]

enum

Schedules resource type. Allowed enum values: schedules

default: schedules

Option 4

object

Full resource representation of a configured schedule target with position (previous, current, or next).

attributes [required]

object

Attributes for a configured schedule target, including position.

position [required]

enum

Specifies the position of a schedule target (example previous, current, or next). Allowed enum values: previous,current,next

id [required]

string

Specifies the unique identifier of the configured schedule target.

relationships [required]

object

Represents the relationships of a configured schedule target.

schedule [required]

object

Holds the schedule reference for a configured schedule target.

data [required]

object

Represents a schedule target for an escalation policy step, including its ID and resource type. This is a shortcut for a configured schedule target with position set to 'current'.

id [required]

string

Specifies the unique identifier of the schedule resource.

type [required]

enum

Indicates that the resource is of type schedules. Allowed enum values: schedules

default: schedules

type [required]

enum

Indicates that the resource is of type schedule_target. Allowed enum values: schedule_target

default: schedule_target

Option 5

object

Provides a reference to a team, including ID, type, and basic attributes/relationships.

attributes

object

Encapsulates the basic attributes of a Team reference, such as name, handle, and an optional avatar or description.

avatar

string

URL or reference for the team's avatar (if available).

description

string

A short text describing the team.

handle

string

A unique handle/slug for the team.

name

string

The full, human-readable name of the team.

id

string

The team's unique identifier.

type [required]

enum

Teams resource type. Allowed enum values: teams

default: teams

{
  "data": {
    "attributes": {
      "name": "Escalation Policy 1",
      "resolve_page_on_policy_end": true,
      "retries": 2
    },
    "id": "00000000-aba1-0000-0000-000000000000",
    "relationships": {
      "steps": {
        "data": [
          {
            "id": "00000000-aba1-0000-0000-000000000000",
            "type": "steps"
          }
        ]
      },
      "teams": {
        "data": [
          {
            "id": "00000000-da3a-0000-0000-000000000000",
            "type": "teams"
          }
        ]
      }
    },
    "type": "policies"
  },
  "included": [
    {
      "attributes": {
        "avatar": "",
        "description": "Team 1 description",
        "handle": "team1",
        "name": "Team 1"
      },
      "id": "00000000-da3a-0000-0000-000000000000",
      "type": "teams"
    },
    {
      "attributes": {
        "assignment": "default",
        "escalate_after_seconds": 3600
      },
      "id": "00000000-aba1-0000-0000-000000000000",
      "relationships": {
        "targets": {
          "data": [
            {
              "id": "00000000-aba1-0000-0000-000000000000",
              "type": "users"
            },
            {
              "id": "00000000-aba2-0000-0000-000000000000",
              "type": "schedules"
            },
            {
              "id": "00000000-aba2-0000-0000-000000000000_previous",
              "type": "schedule_target"
            },
            {
              "id": "00000000-aba3-0000-0000-000000000000",
              "type": "teams"
            }
          ]
        }
      },
      "type": "steps"
    },
    {
      "id": "00000000-aba1-0000-0000-000000000000",
      "type": "users"
    },
    {
      "id": "00000000-aba2-0000-0000-000000000000",
      "type": "schedules"
    },
    {
      "attributes": {
        "position": "previous"
      },
      "id": "00000000-aba2-0000-0000-000000000000_previous",
      "relationships": {
        "schedule": {
          "data": {
            "id": "00000000-aba2-0000-0000-000000000000",
            "type": "schedules"
          }
        }
      },
      "type": "schedule_target"
    },
    {
      "id": "00000000-aba3-0000-0000-000000000000",
      "type": "teams"
    }
  ]
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/on-call/escalation-policies/${policy_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get On-Call escalation policy returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.on_call_api import OnCallApi

# there is a valid "escalation_policy" in the system
ESCALATION_POLICY_DATA_ID = environ["ESCALATION_POLICY_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = OnCallApi(api_client)
    response = api_instance.get_on_call_escalation_policy(
        policy_id=ESCALATION_POLICY_DATA_ID,
        include="steps.targets",
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get On-Call escalation policy returns "OK" response

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

# there is a valid "escalation_policy" in the system
ESCALATION_POLICY_DATA_ID = ENV["ESCALATION_POLICY_DATA_ID"]
opts = {
  include: "steps.targets",
}
p api_instance.get_on_call_escalation_policy(ESCALATION_POLICY_DATA_ID, opts)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get On-Call escalation policy returns "OK" 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"
)

func main() {
	// there is a valid "escalation_policy" in the system
	EscalationPolicyDataID := os.Getenv("ESCALATION_POLICY_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOnCallApi(apiClient)
	resp, r, err := api.GetOnCallEscalationPolicy(ctx, EscalationPolicyDataID, *datadogV2.NewGetOnCallEscalationPolicyOptionalParameters().WithInclude("steps.targets"))

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

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

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get On-Call escalation policy returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OnCallApi;
import com.datadog.api.client.v2.api.OnCallApi.GetOnCallEscalationPolicyOptionalParameters;
import com.datadog.api.client.v2.model.EscalationPolicy;

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

    // there is a valid "escalation_policy" in the system
    String ESCALATION_POLICY_DATA_ID = System.getenv("ESCALATION_POLICY_DATA_ID");

    try {
      EscalationPolicy result =
          apiInstance.getOnCallEscalationPolicy(
              ESCALATION_POLICY_DATA_ID,
              new GetOnCallEscalationPolicyOptionalParameters().include("steps.targets"));
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling OnCallApi#getOnCallEscalationPolicy");
      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 and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get On-Call escalation policy returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_on_call::GetOnCallEscalationPolicyOptionalParams;
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;

#[tokio::main]
async fn main() {
    // there is a valid "escalation_policy" in the system
    let escalation_policy_data_id = std::env::var("ESCALATION_POLICY_DATA_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = OnCallAPI::with_config(configuration);
    let resp = api
        .get_on_call_escalation_policy(
            escalation_policy_data_id.clone(),
            GetOnCallEscalationPolicyOptionalParams::default().include("steps.targets".to_string()),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get On-Call escalation policy returns "OK" response
 */

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

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

// there is a valid "escalation_policy" in the system
const ESCALATION_POLICY_DATA_ID = process.env
  .ESCALATION_POLICY_DATA_ID as string;

const params: v2.OnCallApiGetOnCallEscalationPolicyRequest = {
  policyId: ESCALATION_POLICY_DATA_ID,
  include: "steps.targets",
};

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

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"