IP Ranges
Incident Management is now generally available! Incident Management is now generally available!

IP Ranges

Get a list of IP prefixes belonging to Datadog.

GET https://ip-ranges.datadoghq.eu/https://ip-ranges.ddog-gov.com/https://ip-ranges.datadoghq.com/https://ip-ranges.us3.datadoghq.com/

Overview

Get information about Datadog IP ranges.

Response

OK

IP ranges.

Expand All

Field

Type

Description

agents

object

Available prefix information for the Agent endpoints.

prefixes_ipv4

[string]

List of IPv4 prefixes.

prefixes_ipv6

[string]

List of IPv6 prefixes.

api

object

Available prefix information for the API endpoints.

prefixes_ipv4

[string]

List of IPv4 prefixes.

prefixes_ipv6

[string]

List of IPv6 prefixes.

apm

object

Available prefix information for the APM endpoints.

prefixes_ipv4

[string]

List of IPv4 prefixes.

prefixes_ipv6

[string]

List of IPv6 prefixes.

logs

object

Available prefix information for the Logs endpoints.

prefixes_ipv4

[string]

List of IPv4 prefixes.

prefixes_ipv6

[string]

List of IPv6 prefixes.

modified

string

Date when last updated, in the form YYYY-MM-DD-hh-mm-ss.

process

object

Available prefix information for the Process endpoints.

prefixes_ipv4

[string]

List of IPv4 prefixes.

prefixes_ipv6

[string]

List of IPv6 prefixes.

synthetics

object

Available prefix information for the Synthetics endpoints.

prefixes_ipv4

[string]

List of IPv4 prefixes.

prefixes_ipv4_by_location

object

List of IPv4 prefixes by location.

<any-key>

[string]

List of IPv4 prefixes.

prefixes_ipv6

[string]

List of IPv6 prefixes.

prefixes_ipv6_by_location

object

List of IPv6 prefixes by location.

<any-key>

[string]

List of IPv6 prefixes.

version

int64

Version of the IP list.

webhooks

object

Available prefix information for the Webhook endpoints.

prefixes_ipv4

[string]

List of IPv4 prefixes.

prefixes_ipv6

[string]

List of IPv6 prefixes.

{
  "agents": {
    "prefixes_ipv4": [],
    "prefixes_ipv6": []
  },
  "api": {
    "prefixes_ipv4": [],
    "prefixes_ipv6": []
  },
  "apm": {
    "prefixes_ipv4": [],
    "prefixes_ipv6": []
  },
  "logs": {
    "prefixes_ipv4": [],
    "prefixes_ipv6": []
  },
  "modified": "2019-10-31-20-00-00",
  "process": {
    "prefixes_ipv4": [],
    "prefixes_ipv6": []
  },
  "synthetics": {
    "prefixes_ipv4": [],
    "prefixes_ipv4_by_location": {
      "<any-key>": []
    },
    "prefixes_ipv6": [],
    "prefixes_ipv6_by_location": {
      "<any-key>": []
    }
  },
  "version": 11,
  "webhooks": {
    "prefixes_ipv4": [],
    "prefixes_ipv6": []
  }
}

Code Example


# Curl command
curl -X GET "https://ip-ranges.datadoghq.eu"https://ip-ranges.ddog-gov.com"https://ip-ranges.datadoghq.com"https://ip-ranges.us3.datadoghq.com/" \
-H "Content-Type: application/json"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.Background()

    if site, ok := os.LookupEnv("DD_SITE"); ok {
        ctx = context.WithValue(
            ctx,
            datadog.ContextServerVariables,
            map[string]string{"site": site},
        )
    }


    configuration := datadog.NewConfiguration()

    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.IPRangesApi.GetIPRanges(ctx).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `IPRangesApi.GetIPRanges``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetIPRanges`: IPRanges
    response_content, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from IPRangesApi.GetIPRanges:\n%s\n", response_content)
}

Instructions

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

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.IpRangesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        defaultClient.configureApiKeys(secrets);

        IpRangesApi apiInstance = new IpRangesApi(defaultClient);
        try {
            IPRanges result = apiInstance.getIPRanges()
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling IpRangesApi#getIPRanges");
            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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import ip_ranges_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
    configuration.server_variables["site"] = os.environ["DD_SITE"]

# Enter a context with an instance of the API client
with ApiClient() as api_client:
    # Create an instance of the API class
    api_instance = ip_ranges_api.IPRangesApi(api_client)

    # example, this endpoint has no required or optional parameters
    try:
        # List IP Ranges
        api_response = api_instance.get_ip_ranges()
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling IPRangesApi->get_ip_ranges: %s\n" % e)

Instructions

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

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" python3 "example.py"
require 'time'
require 'datadog_api_client'

DatadogAPIClient::V1.configure do |config|
  # Defining the site is optional and defaults to datadoghq.com
  config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
end

api_instance = DatadogAPIClient::V1::IPRangesApi.new

begin
  # List IP Ranges
  result = api_instance.get_ip_ranges
  p result
rescue DatadogAPIClient::V1::ApiError => e
  puts "Error when calling IPRangesApi->get_ip_ranges: #{e}"
end

Instructions

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

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" rb "example.rb"