> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Datadog

> Client-mode REST API connector for a curated Datadog slice: submit metrics series from MQTT, post events, send logs via HTTP intake, and list monitors

Technical Preview

## Overview

A client-mode connector for a **curated observability / ITSM** slice of the [Datadog API](https://docs.datadoghq.com/api/latest/):

| Catalog connector event | Entity / path | Notes |
| - | - | - |
| POST series (metrics from MQTT) | `POST /api/v2/series` | **Host:** `https://api.datadoghq.com` — Metrics API v2; `DD-API-KEY`; expect **202** |
| POST events | `POST /api/v1/events` | Same API host — Events API v1; `title` + `text` required |
| POST logs | `POST /api/v2/logs` | **Host:** `https://http-intake.logs.datadoghq.com` — logs intake differs from API host |
| GET monitor | `GET /api/v1/monitor` | Same API host — list monitors; needs `DD-API-KEY` **and** `DD-APPLICATION-KEY` |

Default `BASE_ADDRESS` is `https://api.datadoghq.com` (US1). Topics use `itsm/datadog/<object>/<verb>`.

> [!NOTE]
>
> Logs intake is **not** on `api.datadoghq.com`. Official US1 path is `https://http-intake.logs.datadoghq.com/api/v2/logs`. When calling `Submitlogs`, set connector `BASE_ADDRESS` to the logs intake host (or deploy a second connector copy). EU and other sites use matching hostnames (`api.datadoghq.eu`, `http-intake.logs.datadoghq.eu`, `api.us3.datadoghq.com`, …).

> [!NOTE]
>
> Prefer Hub secrets for API and application keys. This template has not been verified against a live Datadog org. Status remains blocked until an authenticated live smoke succeeds.

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — Datadog (metrics, events, logs, monitors curated slice)
# Auth: DD-API-KEY={value.json.api_key}; DD-APPLICATION-KEY={value.json.app_key}
# BASE_ADDRESS API: https://api.datadoghq.com
# Logs: set BASE_ADDRESS to https://http-intake.logs.datadoghq.com

DEFINE ROUTE DatadogRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.datadoghq.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT Submitmetrics
        WITH SOURCE_TOPIC "itsm/datadog/metric/submit"
        WITH DESTINATION_TOPIC "itsm/datadog/metric/submit/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v2/series"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "DD-API-KEY" "{value.json.api_key}"
        WITH BODY "{payload}"
    ADD EVENT Createevent
        WITH SOURCE_TOPIC "itsm/datadog/event/create"
        WITH DESTINATION_TOPIC "itsm/datadog/event/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v1/events"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "DD-API-KEY" "{value.json.api_key}"
        WITH BODY "{payload}"
    ADD EVENT Submitlogs
        WITH SOURCE_TOPIC "itsm/datadog/log/submit"
        WITH DESTINATION_TOPIC "itsm/datadog/log/submit/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v2/logs"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "DD-API-KEY" "{value.json.api_key}"
        WITH BODY "{payload}"
    ADD EVENT Listmonitors
        WITH SOURCE_TOPIC "itsm/datadog/monitor/list"
        WITH DESTINATION_TOPIC "itsm/datadog/monitor/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/monitor?page_size={value.json.page_size}&page={value.json.page}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "DD-API-KEY" "{value.json.api_key}"
            ADD "DD-APPLICATION-KEY" "{value.json.app_key}"
```

## Events

| Event | Method | Endpoint | Request topic | Response topic |
| - | - | - | - | - |
| Submitmetrics | POST | `/api/v2/series` | `itsm/datadog/metric/submit` | `itsm/datadog/metric/submit/response` |
| Createevent | POST | `/api/v1/events` | `itsm/datadog/event/create` | `itsm/datadog/event/create/response` |
| Submitlogs | POST | `/api/v2/logs` | `itsm/datadog/log/submit` | `itsm/datadog/log/submit/response` |
| Listmonitors | GET | `/api/v1/monitor?page_size=&page=` | `itsm/datadog/monitor/list` | `itsm/datadog/monitor/list/response` |

## Auth

1. Create a Datadog [API key and Application key](https://docs.datadoghq.com/account_management/api-app-keys/) in Organization Settings.
2. Pass `api_key` on MQTT payloads so headers resolve to `DD-API-KEY: {value.json.api_key}`.
3. For `Listmonitors`, also pass `app_key` → `DD-APPLICATION-KEY: {value.json.app_key}`.
4. Prefer Hub secrets / `GET SECRET "DD_API_KEY"` and `GET SECRET "DD_APP_KEY"`. Never commit real credentials.
5. Metrics, events, and logs intake typically need the **API key only**; listing monitors needs **both**.

## Site / region

| Site | API host | Logs intake host |
| - | - | - |
| US1 (default) | `https://api.datadoghq.com` | `https://http-intake.logs.datadoghq.com` |
| EU | `https://api.datadoghq.eu` | `https://http-intake.logs.datadoghq.eu` |
| US3 | `https://api.us3.datadoghq.com` | `https://http-intake.logs.us3.datadoghq.com` |
| US5 | `https://api.us5.datadoghq.com` | `https://http-intake.logs.us5.datadoghq.com` |
| AP1 | `https://api.ap1.datadoghq.com` | `https://http-intake.logs.ap1.datadoghq.com` |

Paths stay the same; only the hostname changes.

## Example payloads

**Submit metrics** (API host):

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "api_key": "YOUR_DD_API_KEY",
  "series": [
    {
      "metric": "coreflux.plant.vibration_rms",
      "type": 3,
      "points": [{"timestamp": 1728000000, "value": 12.4}],
      "tags": ["line:a", "source:coreflux"]
    }
  ]
}
```

Expect **HTTP 202**.

**Create event:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "api_key": "YOUR_DD_API_KEY",
  "title": "Vibration above threshold — Zone A",
  "text": "Coreflux: RMS 12.4 mm/s (threshold 8.0)",
  "alert_type": "warning",
  "tags": ["line:a", "source:coreflux"]
}
```

**Submit logs** (logs intake host; body is a JSON **array**):

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
[
  {
    "message": "vibration_rms=12.4 threshold=8.0",
    "ddsource": "coreflux",
    "service": "broker",
    "hostname": "edge-line-a",
    "ddtags": "env:lab,line:a",
    "status": "warn"
  }
]
```

Include `api_key` in the MQTT envelope for the header placeholder; the HTTP body should be the array Datadog expects.

**List monitors:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "api_key": "YOUR_DD_API_KEY",
  "app_key": "YOUR_DD_APP_KEY",
  "page_size": "1",
  "page": "0"
}
```

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [Datadog Metrics — Submit metrics](https://docs.datadoghq.com/api/latest/metrics/#submit-metrics)
* [Datadog Events — Post an event](https://docs.datadoghq.com/api/latest/events/#post-an-event)
* [Datadog Logs — Send logs](https://docs.datadoghq.com/api/latest/logs/#send-logs)
* [Datadog Monitors — Get all monitors](https://docs.datadoghq.com/api/latest/monitors/#get-all-monitor-details)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.