For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/api/latest/synthetics/create-a-network-path-test.md. A documentation index is available at /llms.txt.
Language
Datadog site

Create a Network Path test

POSThttps://api.datadoghq.com/api/v2/synthetics/tests/networkhttps://api.us3.datadoghq.com/api/v2/synthetics/tests/networkhttps://api.us5.datadoghq.com/api/v2/synthetics/tests/networkhttps://api.datadoghq.eu/api/v2/synthetics/tests/networkhttps://api.ap1.datadoghq.com/api/v2/synthetics/tests/networkhttps://api.ap2.datadoghq.com/api/v2/synthetics/tests/networkhttps://api.uk1.datadoghq.com/api/v2/synthetics/tests/networkhttps://api.ddog-gov.com/api/v2/synthetics/tests/networkhttps://api.us2.ddog-gov.com/api/v2/synthetics/tests/network

Overview

This endpoint requires any of the following permissions:

  • synthetics_write
  • synthetics_create_edit_trigger

OAuth apps require the synthetics_write authorization scope to access this endpoint.

Request

Body Data (required)

Field
Type
Description
data [required]
object

Data object for creating or editing a Network Path test.

Response

OK

Network Path test response.

Field
Type
Description
data
object

Network Path test response data.

Code Example

Create a Network Path test returns "OK" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/synthetics/tests/network" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "config": {
        "assertions": [
          {
            "operator": "lessThan",
            "property": "avg",
            "target": 500,
            "type": "latency"
          }
        ],
        "request": {
          "host": "example.com",
          "port": 443,
          "tcp_method": "prefer_sack",
          "max_ttl": 30,
          "e2e_queries": 50,
          "traceroute_queries": 3
        }
      },
      "locations": [
        "aws:us-east-1",
        "agent:my-agent-name"
      ],
      "message": "Network Path test notification",
      "name": "Example Network Path test",
      "options": {
        "tick_every": 60
      },
      "status": "live",
      "subtype": "tcp",
      "tags": [
        "env:production"
      ],
      "type": "network"
    },
    "type": "network"
  }
}
EOF