How to hit the Datadog API

Datadog's API lives at https://api.datadoghq.com for the US1 site; other sites use their own host (e.g. api.datadoghq.eu). Most reads need both an API key and an application key.

Authentication

Create an API key and an application key under Organization Settings. Send them as DD-API-KEY and DD-APPLICATION-KEY headers. In the examples they're written {{DD_API_KEY}} and {{DD_APP_KEY}}.

Full reference: https://docs.datadoghq.com/api/latest/

Validate an API key

curl https://api.datadoghq.com/api/v1/validate \
  -H "DD-API-KEY: {{DD_API_KEY}}"
Run in PostTaco

List monitors

curl "https://api.datadoghq.com/api/v1/monitor?page_size=5" \
  -H "DD-API-KEY: {{DD_API_KEY}}" \
  -H "DD-APPLICATION-KEY: {{DD_APP_KEY}}"
Run in PostTaco

Submit a metric

type 3 is a gauge. timestamp is Unix seconds within the last 10 minutes.

curl -X POST https://api.datadoghq.com/api/v2/series \
  -H "DD-API-KEY: {{DD_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{"series": [{"metric": "posttaco.test", "type": 3, "points": [{"timestamp": {{UNIX_TIMESTAMP}}, "value": 1}]}]}'
Run in PostTaco