Skip to main content

datadog-api-client-python

This repository contains the autogenerated Python client for the Datadog API. The client code, feature files, and test data are generated from Datadog's public OpenAPI specifications by internal tooling.

We welcome contributions that expand or improve the client's capabilities. As part of the pull request review process, Datadog's internal tooling may regenerate the affected code, feature files, and test data based on the proposed changes.

Requirements

Building and using the API client library requires Python 3.10+.

Installation

To install the API client library, simply execute:

pip install datadog-api-client

Getting Started

Please follow the installation instruction and execute the following Python code:

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.monitors_api import MonitorsApi
from datadog_api_client.v1.model.monitor import Monitor
from datadog_api_client.v1.model.monitor_type import MonitorType

body = Monitor(
    name="example",
    type=MonitorType("log alert"),
    query='logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2',
    message="some message Notify: @hipchat-channel",
    tags=["test:example", "env:ci"],
    priority=3,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = MonitorsApi(api_client)
    response = api_instance.create_monitor(body=body)
    print(response)

Authentication

By default the library will use the DD_API_KEY and DD_APP_KEY environment variables to authenticate against the Datadog API. To provide your own set of credentials, you need to set some keys on the configuration:

configuration.api_key["apiKeyAuth"] = "<API KEY>"
configuration.api_key["appKeyAuth"] = "<APPLICATION KEY>"

Unstable Endpoints

This client includes access to Datadog API endpoints while they are in an unstable state and may undergo breaking changes. An extra configuration step is required to enable these endpoints:

configuration.unstable_operations["<OperationName>"] = True

where <OperationName> is the name of the method used to interact with that endpoint. For example: list_log_indexes, or get_logs_index

Changing Server

When talking to a different server, like the eu instance, change the server_variables on your configuration object:

configuration.server_variables["site"] = "datadoghq.eu"

Disable compressed payloads

If you want to disable GZIP compressed responses, set the compress flag on your configuration object:

configuration.compress = False

Enable requests logging

If you want to enable requests logging, set the debug flag on your configuration object:

configuration.debug = True

Enable retry

If you want to enable retry when getting status code 429 rate-limited, set enable_retry to True

    configuration.enable_retry = True

The default max retry is 3, you can change it with max_retries

    configuration.max_retries = 5

Custom retry policy

You can provide a custom retry policy by passing a urllib3.util.Retry instance to the configuration. When a custom retry policy is provided, it takes precedence over the enable_retry, retry_backoff_factor, and max_retries settings.

import urllib3
from datadog_api_client import Configuration

# Create a custom retry policy
custom_retry = urllib3.util.Retry(
    total=5,
    backoff_factor=2,
    status_forcelist=[429, 500, 502, 503, 504],
    allowed_methods=["GET", "POST", "PUT", "DELETE"]
)

configuration = Configuration(retry_policy=custom_retry)

See urllib3.util.Retry documentation for more details.

Configure proxy

You can configure the client to use proxy by setting the proxy key on configuration object:

configuration.proxy = "http://127.0.0.1:80"

Threads support

You can run API calls in a thread by using ThreadedApiClient in place of ApiClient. API calls will then return a AsyncResult instance on which you can call get to retrieve the result:

from datadog_api_client import Configuration, ThreadedApiClient
from datadog_api_client.v1.api.dashboards_api import DashboardsApi

configuration = Configuration()
with ThreadedApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    result = api_instance.list_dashboards()
    dashboards = result.get()
    print(dashboards)

Asyncio support

The library supports asynchronous operations when using AsyncApiClient for the transport. When that client is used, the API methods will then return coroutines that you can wait for.

To make async support available, you need to install the extra async qualifiers during installation: pip install datadog-api-client[async].

import asyncio

from datadog_api_client import Configuration, AsyncApiClient
from datadog_api_client.v1.api.dashboards_api import DashboardsApi

async def main():
    configuration = Configuration()
    async with AsyncApiClient(configuration) as api_client:
        api_instance = DashboardsApi(api_client)
        dashboards = await api_instance.list_dashboards()
        print(dashboards)

asyncio.run(main())

Pagination

Several listing operations have a pagination method to help consume all the items available. For example, to retrieve all your incidents:

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

configuration = Configuration()
configuration.unstable_operations["list_incidents"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    for incident in api_instance.list_incidents_with_pagination():
        print(incident.id)

Documentation for API Endpoints and Models

Documentation for API endpoints and models is available in the API Client docs.

Documentation for Authorization

Authenticate with the API by providing your API and Application keys in the configuration:

configuration.api_key["apiKeyAuth"] = "YOUR_API_KEY"
configuration.api_key["appKeyAuth"] = "YOUR_APPLICATION_KEY"

Author

support@datadoghq.com

Metadata

Release files for datadog-api-client 2.62.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datadog-api-client 2.62.0
File Size Uploaded Provenance Actions
datadog_api_client-2.62.0.tar.gz 8.3 MB With provenance Details for datadog_api_client-2.62.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datadog-api-client 2.62.0
File Interpreter ABI Platform Actions
datadog_api_client-2.62.0-py3-none-any.whl Python 3 none any Details for datadog_api_client-2.62.0-py3-none-any.whl

Total release size: 18.2 MB

Release files / datadog_api_client-2.62.0.tar.gz

Download URL datadog_api_client-2.62.0.tar.gz
Size 8.3 MB
Tags Source
SHA-256 checksum
How to use checksums
fec6a649dac5dd7224f64662390005e6d6ce688029742278346f46190d0fc902
BLAKE2b-256 checksum
How to use checksums
95aa3434aa78b0f0107445655a7831f0b5b5366218c25fad90df9c75fe317e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / datadog_api_client-2.62.0-py3-none-any.whl

Download URL datadog_api_client-2.62.0-py3-none-any.whl
Size 9.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b779cde91e0d8c24666e762154bb266506cecaf63bcc9339cd2e0a34f2e30183
BLAKE2b-256 checksum
How to use checksums
de9d211c2c466fb6efc3ff404c93a35322663bd3884ae8d96208db24de8661b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Security for datadog-api-client 2.62.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for datadog_api_client-2.62.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.62.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page