dogapi is a Node.js client library that provides an interface to the Datadog HTTP API, enabling programmatic interaction with Datadog services for metrics, events, dashboards, and more. It is currently at version 2.8.4. This library focuses exclusively on the HTTP API and does not include functionality for interacting with a local `dogstatsd` server; for StatsD, users are directed to alternative packages like `node-dogstatsd`. The release cadence is driven by changes to the Datadog API or internal library improvements. Key differentiators include its direct mapping to the Datadog API endpoints and clear separation from StatsD client concerns, which are often bundled in other monitoring libraries.
npm install dogapiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the dogapi client with API keys (using environment variables for security) and subsequently send a custom timed metric and an event to Datadog's HTTP API.
Review the official `dogapi` documentation or the README section 'Major changes from 1.x.x to 2.x.x' to correctly format metric points when upgrading from 1.x.x.
When calling `dogapi.initialize()`, include `api_host: 'app.datadoghq.eu'` (or your regional host) in the options object.
For Datadog StatsD functionality, use a dedicated StatsD client library such as `node-dogstatsd`, which is designed for UDP communication with the local agent.
Store `DATADOG_API_KEY` and `DATADOG_APP_KEY` securely in environment variables and access them using `process.env.DATADOG_API_KEY` or a secrets management system.
Ensure `api_key` and `app_key` are correctly set in the options object passed to `dogapi.initialize()`. Double-check the keys on your Datadog account settings page (https://app.datadoghq.com/account/settings#api).
If you are on Datadog EU, ensure `api_host: 'app.datadoghq.eu'` is explicitly included in the options when calling `dogapi.initialize()`.
Update metric point formats according to version 2.x.x requirements. For `dogapi.metric.send`, use `[[timestamp, value]]` for a single timed value, or `value` for an untimed value. For `dogapi.metric.send_all`, ensure each metric's `points` array contains arrays of `[timestamp, value]` or single values.
No dependency data recorded yet.