datadog_api_client.v1.api

authentication_api

class AuthenticationApi(api_client=None)

Bases: object

All requests to Datadog’s API must be authenticated. Requests that write data require reporting access and require an API key. Requests that read data require full access and also require an application key.

Note: All Datadog API clients are configured by default to consume Datadog US site APIs. If you are on the Datadog EU site, set the environment variable DATADOG_HOST to https://api.datadoghq.eu or override this value directly when creating your client.

Manage your account’s API and application keys.

validate() AuthenticationValidationResponse

Validate API key.

Check if the API key (not the APP key) is valid. If invalid, a 403 is returned.

Return type:

AuthenticationValidationResponse

aws_integration_api

class AWSIntegrationApi(api_client=None)

Bases: object

Configure your Datadog-AWS integration directly through the Datadog API. For more information, see the AWS integration page.

create_aws_account(body: AWSAccount) AWSAccountCreateResponse

Create an AWS integration.

Create a Datadog-Amazon Web Services integration. Using the POST method updates your integration configuration by adding your new configuration to the existing one in your Datadog organization. A unique AWS Account ID for role based authentication.

Parameters:

body (AWSAccount) – AWS Request Object

Return type:

AWSAccountCreateResponse

create_aws_tag_filter(body: AWSTagFilterCreateRequest) dict

Set an AWS tag filter.

Set an AWS tag filter.

Parameters:

body (AWSTagFilterCreateRequest) – Set an AWS tag filter using an aws_account_identifier , namespace , and filtering string. Namespace options are application_elb , elb , lambda , network_elb , rds , sqs , and custom.

Return type:

dict

create_new_aws_external_id(body: AWSAccount) AWSAccountCreateResponse

Generate a new external ID.

Generate a new AWS external ID for a given AWS account ID and role name pair.

Parameters:

body (AWSAccount) – Your Datadog role delegation name. For more information about your AWS account Role name, see the Datadog AWS integration configuration info.

Return type:

AWSAccountCreateResponse

delete_aws_account(body: AWSAccountDeleteRequest) dict

Delete an AWS integration.

Delete a Datadog-AWS integration matching the specified account_id and role_name parameters.

Parameters:

body (AWSAccountDeleteRequest) – AWS request object

Return type:

dict

delete_aws_tag_filter(body: AWSTagFilterDeleteRequest) dict

Delete a tag filtering entry.

Delete a tag filtering entry.

Parameters:

body (AWSTagFilterDeleteRequest) – Delete a tag filtering entry for a given AWS account and dd-aws namespace.

Return type:

dict

list_available_aws_namespaces() List[str]

List namespace rules.

List all namespace rules for a given Datadog-AWS integration. This endpoint takes no arguments.

Return type:

[str]

list_aws_accounts(*, account_id: str | UnsetType = UnsetType.unset, role_name: str | UnsetType = UnsetType.unset, access_key_id: str | UnsetType = UnsetType.unset) AWSAccountListResponse

List all AWS integrations.

List all Datadog-AWS integrations available in your Datadog organization.

Parameters:
  • account_id (str, optional) – Only return AWS accounts that matches this account_id.

  • role_name (str, optional) – Only return AWS accounts that matches this role_name.

  • access_key_id (str, optional) – Only return AWS accounts that matches this access_key_id.

Return type:

AWSAccountListResponse

list_aws_tag_filters(account_id: str) AWSTagFilterListResponse

Get all AWS tag filters.

Get all AWS tag filters.

Parameters:

account_id (str) – Only return AWS filters that matches this account_id.

Return type:

AWSTagFilterListResponse

update_aws_account(body: AWSAccount, *, account_id: str | UnsetType = UnsetType.unset, role_name: str | UnsetType = UnsetType.unset, access_key_id: str | UnsetType = UnsetType.unset) dict

Update an AWS integration.

Update a Datadog-Amazon Web Services integration.

Parameters:
  • body (AWSAccount) – AWS request object

  • account_id (str, optional) – Only return AWS accounts that matches this account_id.

  • role_name (str, optional) – Only return AWS accounts that match this role_name. Required if account_id is specified.

  • access_key_id (str, optional) – Only return AWS accounts that matches this access_key_id. Required if none of the other two options are specified.

Return type:

dict

aws_logs_integration_api

class AWSLogsIntegrationApi(api_client=None)

Bases: object

Configure your Datadog-AWS-Logs integration directly through Datadog API. For more information, see the AWS integration page.

check_aws_logs_lambda_async(body: AWSAccountAndLambdaRequest) AWSLogsAsyncResponse

Check that an AWS Lambda Function exists.

Test if permissions are present to add a log-forwarding triggers for the given services and AWS account. The input is the same as for Enable an AWS service log collection. Subsequent requests will always repeat the above, so this endpoint can be polled intermittently instead of blocking.

  • Returns a status of ‘created’ when it’s checking if the Lambda exists in the account.

  • Returns a status of ‘waiting’ while checking.

  • Returns a status of ‘checked and ok’ if the Lambda exists.

  • Returns a status of ‘error’ if the Lambda does not exist.

Parameters:

body (AWSAccountAndLambdaRequest) – Check AWS Log Lambda Async request body.

Return type:

AWSLogsAsyncResponse

check_aws_logs_services_async(body: AWSLogsServicesRequest) AWSLogsAsyncResponse

Check permissions for log services.

Test if permissions are present to add log-forwarding triggers for the given services and AWS account. Input is the same as for EnableAWSLogServices. Done async, so can be repeatedly polled in a non-blocking fashion until the async request completes.

  • Returns a status of created when it’s checking if the permissions exists in the AWS account.

  • Returns a status of waiting while checking.

  • Returns a status of checked and ok if the Lambda exists.

  • Returns a status of error if the Lambda does not exist.

Parameters:

body (AWSLogsServicesRequest) – Check AWS Logs Async Services request body.

Return type:

AWSLogsAsyncResponse

create_aws_lambda_arn(body: AWSAccountAndLambdaRequest) dict

Add AWS Log Lambda ARN.

Attach the Lambda ARN of the Lambda created for the Datadog-AWS log collection to your AWS account ID to enable log collection.

Parameters:

body (AWSAccountAndLambdaRequest) – AWS Log Lambda Async request body.

Return type:

dict

delete_aws_lambda_arn(body: AWSAccountAndLambdaRequest) dict

Delete an AWS Logs integration.

Delete a Datadog-AWS logs configuration by removing the specific Lambda ARN associated with a given AWS account.

Parameters:

body (AWSAccountAndLambdaRequest) – Delete AWS Lambda ARN request body.

Return type:

dict

enable_aws_log_services(body: AWSLogsServicesRequest) dict

Enable an AWS Logs integration.

Enable automatic log collection for a list of services. This should be run after running CreateAWSLambdaARN to save the configuration.

Parameters:

body (AWSLogsServicesRequest) – Enable AWS Log Services request body.

Return type:

dict

list_aws_logs_integrations() List[AWSLogsListResponse]

List all AWS Logs integrations.

List all Datadog-AWS Logs integrations configured in your Datadog account.

Return type:

[AWSLogsListResponse]

list_aws_logs_services() List[AWSLogsListServicesResponse]

Get list of AWS log ready services.

Get the list of current AWS services that Datadog offers automatic log collection. Use returned service IDs with the services parameter for the Enable an AWS service log collection API endpoint.

Return type:

[AWSLogsListServicesResponse]

azure_integration_api

class AzureIntegrationApi(api_client=None)

Bases: object

Configure your Datadog-Azure integration directly through the Datadog API. For more information, see the Datadog-Azure integration page.

create_azure_integration(body: AzureAccount) dict

Create an Azure integration.

Create a Datadog-Azure integration.

Using the POST method updates your integration configuration by adding your new configuration to the existing one in your Datadog organization.

Using the PUT method updates your integration configuration by replacing your current configuration with the new one sent to your Datadog organization.

Parameters:

body (AzureAccount) – Create a Datadog-Azure integration for your Datadog account request body.

Return type:

dict

delete_azure_integration(body: AzureAccount) dict

Delete an Azure integration.

Delete a given Datadog-Azure integration from your Datadog account.

Parameters:

body (AzureAccount) – Delete a given Datadog-Azure integration request body.

Return type:

dict

list_azure_integration() AzureAccountListResponse

List all Azure integrations.

List all Datadog-Azure integrations configured in your Datadog account.

Return type:

AzureAccountListResponse

update_azure_host_filters(body: AzureAccount) dict

Update Azure integration host filters.

Update the defined list of host filters for a given Datadog-Azure integration.

Parameters:

body (AzureAccount) – Update a Datadog-Azure integration’s host filters request body.

Return type:

dict

update_azure_integration(body: AzureAccount) dict

Update an Azure integration.

Update a Datadog-Azure integration. Requires an existing tenant_name and client_id. Any other fields supplied will overwrite existing values. To overwrite tenant_name or client_id , use new_tenant_name and new_client_id. To leave a field unchanged, do not supply that field in the payload.

Parameters:

body (AzureAccount) – Update a Datadog-Azure integration request body.

Return type:

dict

dashboard_lists_api

class DashboardListsApi(api_client=None)

Bases: object

Interact with your dashboard lists through the API to organize, find, and share all of your dashboards with your team and organization.

create_dashboard_list(body: DashboardList) DashboardList

Create a dashboard list.

Create an empty dashboard list.

Parameters:

body (DashboardList) – Create a dashboard list request body.

Return type:

DashboardList

delete_dashboard_list(list_id: int) DashboardListDeleteResponse

Delete a dashboard list.

Delete a dashboard list.

Parameters:

list_id (int) – ID of the dashboard list to delete.

Return type:

DashboardListDeleteResponse

get_dashboard_list(list_id: int) DashboardList

Get a dashboard list.

Fetch an existing dashboard list’s definition.

Parameters:

list_id (int) – ID of the dashboard list to fetch.

Return type:

DashboardList

list_dashboard_lists() DashboardListListResponse

Get all dashboard lists.

Fetch all of your existing dashboard list definitions.

Return type:

DashboardListListResponse

update_dashboard_list(list_id: int, body: DashboardList) DashboardList

Update a dashboard list.

Update the name of a dashboard list.

Parameters:
  • list_id (int) – ID of the dashboard list to update.

  • body (DashboardList) – Update a dashboard list request body.

Return type:

DashboardList

dashboards_api

class DashboardsApi(api_client=None)

Bases: object

Interact with your dashboard lists through the API to make it easier to organize, find, and share all of your dashboards with your team and organization.

create_dashboard(body: Dashboard) Dashboard

Create a new dashboard.

Create a dashboard using the specified options. When defining queries in your widgets, take note of which queries should have the as_count() or as_rate() modifiers appended. Refer to the following documentation for more information on these modifiers.

Parameters:

body (Dashboard) – Create a dashboard request body.

Return type:

Dashboard

delete_dashboard(dashboard_id: str) DashboardDeleteResponse

Delete a dashboard.

Delete a dashboard using the specified ID.

Parameters:

dashboard_id (str) – The ID of the dashboard.

Return type:

DashboardDeleteResponse

delete_dashboards(body: DashboardBulkDeleteRequest) None

Delete dashboards.

Delete dashboards using the specified IDs. If there are any failures, no dashboards will be deleted (partial success is not allowed).

Parameters:

body (DashboardBulkDeleteRequest) – Delete dashboards request body.

Return type:

None

get_dashboard(dashboard_id: str) Dashboard

Get a dashboard.

Get a dashboard using the specified ID.

Parameters:

dashboard_id (str) – The ID of the dashboard.

Return type:

Dashboard

list_dashboards(*, filter_shared: bool | UnsetType = UnsetType.unset, filter_deleted: bool | UnsetType = UnsetType.unset) DashboardSummary

Get all dashboards.

Get all dashboards.

Note : This query will only return custom created or cloned dashboards. This query will not return preset dashboards.

Parameters:
  • filter_shared (bool, optional) – When true , this query only returns shared custom created or cloned dashboards.

  • filter_deleted (bool, optional) – When true , this query returns only deleted custom-created or cloned dashboards. This parameter is incompatible with filter[shared].

Return type:

DashboardSummary

restore_dashboards(body: DashboardRestoreRequest) None

Restore deleted dashboards.

Restore dashboards using the specified IDs. If there are any failures, no dashboards will be restored (partial success is not allowed).

Parameters:

body (DashboardRestoreRequest) – Restore dashboards request body.

Return type:

None

update_dashboard(dashboard_id: str, body: Dashboard) Dashboard

Update a dashboard.

Update a dashboard using the specified ID.

Parameters:
  • dashboard_id (str) – The ID of the dashboard.

  • body (Dashboard) – Update Dashboard request body.

Return type:

Dashboard

downtimes_api

class DowntimesApi(api_client=None)

Bases: object

Downtiming gives you greater control over monitor notifications by allowing you to globally exclude scopes from alerting. Downtime settings, which can be scheduled with start and end times, prevent all alerting related to specified Datadog tags.

cancel_downtime(downtime_id: int) None

Cancel a downtime.

Cancel a downtime.

Parameters:

downtime_id (int) – ID of the downtime to cancel.

Return type:

None

cancel_downtimes_by_scope(body: CancelDowntimesByScopeRequest) CanceledDowntimesIds

Cancel downtimes by scope.

Delete all downtimes that match the scope of X.

Parameters:

body (CancelDowntimesByScopeRequest) – Scope to cancel downtimes for.

Return type:

CanceledDowntimesIds

create_downtime(body: Downtime) Downtime

Schedule a downtime.

Schedule a downtime.

Parameters:

body (Downtime) – Schedule a downtime request body.

Return type:

Downtime

get_downtime(downtime_id: int) Downtime

Get a downtime.

Get downtime detail by downtime_id.

Parameters:

downtime_id (int) – ID of the downtime to fetch.

Return type:

Downtime

list_downtimes(*, current_only: bool | UnsetType = UnsetType.unset) List[Downtime]

Get all downtimes.

Get all scheduled downtimes.

Parameters:

current_only (bool, optional) – Only return downtimes that are active when the request is made.

Return type:

[Downtime]

list_monitor_downtimes(monitor_id: int) List[Downtime]

Get all downtimes for a monitor.

Get all active downtimes for the specified monitor.

Parameters:

monitor_id (int) – The id of the monitor

Return type:

[Downtime]

update_downtime(downtime_id: int, body: Downtime) Downtime

Update a downtime.

Update a single downtime by downtime_id.

Parameters:
  • downtime_id (int) – ID of the downtime to update.

  • body (Downtime) – Update a downtime request body.

Return type:

Downtime

events_api

class EventsApi(api_client=None)

Bases: object

The events service allows you to programmatically post events to the event stream and fetch events from the event stream. Events are limited to 4000 characters. If an event is sent out with a message containing more than 4000 characters, only the first 4000 characters are displayed.

create_event(body: EventCreateRequest) EventCreateResponse

Post an event.

This endpoint allows you to post events to the stream. Tag them, set priority and event aggregate them with other events.

Parameters:

body (EventCreateRequest) – Event request object

Return type:

EventCreateResponse

get_event(event_id: int) EventResponse

Get an event.

This endpoint allows you to query for event details.

Note : If the event you’re querying contains markdown formatting of any kind, you may see characters such as % , \ , n in your output.

Parameters:

event_id (int) – The ID of the event.

Return type:

EventResponse

list_events(start: int, end: int, *, priority: EventPriority | UnsetType = UnsetType.unset, sources: str | UnsetType = UnsetType.unset, tags: str | UnsetType = UnsetType.unset, unaggregated: bool | UnsetType = UnsetType.unset, exclude_aggregate: bool | UnsetType = UnsetType.unset, page: int | UnsetType = UnsetType.unset) EventListResponse

Get a list of events.

The event stream can be queried and filtered by time, priority, sources and tags.

Notes :

  • If the event you’re querying contains markdown formatting of any kind, you may see characters such as % , \ , n in your output.

  • This endpoint returns a maximum of 1000 most recent results. To return additional results, identify the last timestamp of the last result and set that as the end query time to paginate the results. You can also use the page parameter to specify which set of 1000 results to return.

Parameters:
  • start (int) – POSIX timestamp.

  • end (int) – POSIX timestamp.

  • priority (EventPriority, optional) – Priority of your events, either low or normal.

  • sources (str, optional) – A comma separated string of sources.

  • tags (str, optional) – A comma separated list indicating what tags, if any, should be used to filter the list of events.

  • unaggregated (bool, optional) – Set unaggregated to true to return all events within the specified [ start , end ] timeframe. Otherwise if an event is aggregated to a parent event with a timestamp outside of the timeframe, it won’t be available in the output. Aggregated events with is_aggregate=true in the response will still be returned unless exclude_aggregate is set to true.

  • exclude_aggregate (bool, optional) – Set exclude_aggregate to true to only return unaggregated events where is_aggregate=false in the response. If the exclude_aggregate parameter is set to true , then the unaggregated parameter is ignored and will be true by default.

  • page (int, optional) – By default 1000 results are returned per request. Set page to the number of the page to return with 0 being the first page. The page parameter can only be used when either unaggregated or exclude_aggregate is set to true.

Return type:

EventListResponse

gcp_integration_api

class GCPIntegrationApi(api_client=None)

Bases: object

Configure your Datadog-Google Cloud Platform (GCP) integration directly through the Datadog API. Read more about the Datadog-Google Cloud Platform integration.

create_gcp_integration(body: GCPAccount) dict

Create a GCP integration.

Create a Datadog-GCP integration.

Parameters:

body (GCPAccount) – Create a Datadog-GCP integration.

Return type:

dict

delete_gcp_integration(body: GCPAccount) dict

Delete a GCP integration.

Delete a given Datadog-GCP integration.

Parameters:

body (GCPAccount) – Delete a given Datadog-GCP integration.

Return type:

dict

list_gcp_integration() GCPAccountListResponse

List all GCP integrations.

List all Datadog-GCP integrations configured in your Datadog account.

Return type:

GCPAccountListResponse

update_gcp_integration(body: GCPAccount) dict

Update a GCP integration.

Update a Datadog-GCP integrations host_filters and/or auto-mute. Requires a project_id and client_email , however these fields cannot be updated. If you need to update these fields, delete and use the create ( POST ) endpoint. The unspecified fields will keep their original values.

Parameters:

body (GCPAccount) – Update a Datadog-GCP integration.

Return type:

dict

hosts_api

class HostsApi(api_client=None)

Bases: object

Get information about your live hosts in Datadog.

get_host_totals(*, _from: int | UnsetType = UnsetType.unset) HostTotals

Get the total number of active hosts.

This endpoint returns the total number of active and up hosts in your Datadog account. Active means the host has reported in the past hour, and up means it has reported in the past two hours.

Parameters:

_from (int, optional) – Number of seconds from which you want to get total number of active hosts.

Return type:

HostTotals

list_hosts(*, filter: str | UnsetType = UnsetType.unset, sort_field: str | UnsetType = UnsetType.unset, sort_dir: str | UnsetType = UnsetType.unset, start: int | UnsetType = UnsetType.unset, count: int | UnsetType = UnsetType.unset, _from: int | UnsetType = UnsetType.unset, include_muted_hosts_data: bool | UnsetType = UnsetType.unset, include_hosts_metadata: bool | UnsetType = UnsetType.unset) HostListResponse

Get all hosts for your organization.

This endpoint allows searching for hosts by name, alias, or tag. Hosts live within the past 3 hours are included by default. Retention is 7 days. Results are paginated with a max of 1000 results at a time.

Parameters:
  • filter (str, optional) – String to filter search results.

  • sort_field (str, optional) – Sort hosts by this field.

  • sort_dir (str, optional) – Direction of sort. Options include asc and desc.

  • start (int, optional) – Host result to start search from.

  • count (int, optional) – Number of hosts to return. Max 1000.

  • _from (int, optional) – Number of seconds since UNIX epoch from which you want to search your hosts.

  • include_muted_hosts_data (bool, optional) – Include information on the muted status of hosts and when the mute expires.

  • include_hosts_metadata (bool, optional) – Include additional metadata about the hosts (agent_version, machine, platform, processor, etc.).

Return type:

HostListResponse

mute_host(host_name: str, body: HostMuteSettings) HostMuteResponse

Mute a host.

Mute a host.

Parameters:
  • host_name (str) – Name of the host to mute.

  • body (HostMuteSettings) – Mute a host request body.

Return type:

HostMuteResponse

unmute_host(host_name: str) HostMuteResponse

Unmute a host.

Unmutes a host. This endpoint takes no JSON arguments.

Parameters:

host_name (str) – Name of the host to unmute.

Return type:

HostMuteResponse

ip_ranges_api

class IPRangesApi(api_client=None)

Bases: object

Get a list of IP prefixes belonging to Datadog.

get_ip_ranges() IPRanges

List IP Ranges.

Get information about Datadog IP ranges.

Return type:

IPRanges

key_management_api

class KeyManagementApi(api_client=None)

Bases: object

Manage your Datadog API and application keys. You need an API key and an application key for a user with the required permissions to interact with these endpoints. The full list of API and application keys can be seen on your Datadog API page.

create_api_key(body: ApiKey) ApiKeyResponse

Create an API key.

Creates an API key with a given name.

Return type:

ApiKeyResponse

create_application_key(body: ApplicationKey) ApplicationKeyResponse

Create an application key.

Create an application key with a given name.

Return type:

ApplicationKeyResponse

delete_api_key(key: str) ApiKeyResponse

Delete an API key.

Delete a given API key.

Parameters:

key (str) – The specific API key you are working with.

Return type:

ApiKeyResponse

delete_application_key(key: str) ApplicationKeyResponse

Delete an application key.

Delete a given application key.

Parameters:

key (str) – The specific APP key you are working with.

Return type:

ApplicationKeyResponse

get_api_key(key: str) ApiKeyResponse

Get API key.

Get a given API key.

Parameters:

key (str) – The specific API key you are working with.

Return type:

ApiKeyResponse

get_application_key(key: str) ApplicationKeyResponse

Get an application key.

Get a given application key.

Parameters:

key (str) – The specific APP key you are working with.

Return type:

ApplicationKeyResponse

list_api_keys() ApiKeyListResponse

Get all API keys.

Get all API keys available for your account.

Return type:

ApiKeyListResponse

list_application_keys() ApplicationKeyListResponse

Get all application keys.

Get all application keys available for your Datadog account.

Return type:

ApplicationKeyListResponse

update_api_key(key: str, body: ApiKey) ApiKeyResponse

Edit an API key.

Edit an API key name.

Parameters:

key (str) – The specific API key you are working with.

Return type:

ApiKeyResponse

update_application_key(key: str, body: ApplicationKey) ApplicationKeyResponse

Edit an application key.

Edit an application key name.

Parameters:

key (str) – The specific APP key you are working with.

Return type:

ApplicationKeyResponse

logs_api

class LogsApi(api_client=None)

Bases: object

Search your logs and send them to your Datadog platform over HTTP.

list_logs(body: LogsListRequest) LogsListResponse

Search logs.

List endpoint returns logs that match a log search query. Results are paginated.

If you are considering archiving logs for your organization, consider use of the Datadog archive capabilities instead of the log list API. See Datadog Logs Archive documentation.

Parameters:

body (LogsListRequest) – Logs filter

Return type:

LogsListResponse

submit_log(body: HTTPLog, *, content_encoding: ContentEncoding | UnsetType = UnsetType.unset, ddtags: str | UnsetType = UnsetType.unset) dict

Send logs. Deprecated.

Send your logs to your Datadog platform over HTTP. Limits per HTTP request are:

  • Maximum content size per payload (uncompressed): 5MB

  • Maximum size for a single log: 1MB

  • Maximum array size if sending multiple logs in an array: 1000 entries

Any log exceeding 1MB is accepted and truncated by Datadog:

  • For a single log request, the API truncates the log at 1MB and returns a 2xx.

  • For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx.

Datadog recommends sending your logs compressed. Add the Content-Encoding: gzip header to the request when sending compressed logs.

The status codes answered by the HTTP API are:

  • 200: OK

  • 400: Bad request (likely an issue in the payload formatting)

  • 403: Permission issue (likely using an invalid API Key)

  • 413: Payload too large (batch is above 5MB uncompressed)

  • 5xx: Internal error, request should be retried after some time

Parameters:
  • body (HTTPLog) – Log to send (JSON format).

  • content_encoding (ContentEncoding, optional) – HTTP header used to compress the media-type.

  • ddtags (str, optional) – Log tags can be passed as query parameters with text/plain content type.

Return type:

dict

logs_indexes_api

class LogsIndexesApi(api_client=None)

Bases: object

Manage configuration of log indexes. You need an API and application key with Admin rights to interact with this endpoint.

create_logs_index(body: LogsIndex) LogsIndex

Create an index.

Creates a new index. Returns the Index object passed in the request body when the request is successful.

Parameters:

body (LogsIndex) – Object containing the new index.

Return type:

LogsIndex

get_logs_index(name: str) LogsIndex

Get an index.

Get one log index from your organization. This endpoint takes no JSON arguments.

Parameters:

name (str) – Name of the log index.

Return type:

LogsIndex

get_logs_index_order() LogsIndexesOrder

Get indexes order.

Get the current order of your log indexes. This endpoint takes no JSON arguments.

Return type:

LogsIndexesOrder

list_log_indexes() LogsIndexListResponse

Get all indexes.

The Index object describes the configuration of a log index. This endpoint returns an array of the LogIndex objects of your organization.

Return type:

LogsIndexListResponse

update_logs_index(name: str, body: LogsIndexUpdateRequest) LogsIndex

Update an index.

Update an index as identified by its name. Returns the Index object passed in the request body when the request is successful.

Using the PUT method updates your index’s configuration by replacing your current configuration with the new one sent to your Datadog organization.

Parameters:
  • name (str) – Name of the log index.

  • body (LogsIndexUpdateRequest) – Object containing the new LogsIndexUpdateRequest.

Return type:

LogsIndex

update_logs_index_order(body: LogsIndexesOrder) LogsIndexesOrder

Update indexes order.

This endpoint updates the index order of your organization. It returns the index order object passed in the request body when the request is successful.

Parameters:

body (LogsIndexesOrder) – Object containing the new ordered list of index names

Return type:

LogsIndexesOrder

logs_pipelines_api

class LogsPipelinesApi(api_client=None)

Bases: object

Pipelines and processors operate on incoming logs, parsing and transforming them into structured attributes for easier querying.

Notes:

These endpoints are only available for admin users. Make sure to use an application key created by an admin.

Grok parsing rules may effect JSON output and require returned data to be configured before using in a request. For example, if you are using the data returned from a request for another request body, and have a parsing rule that uses a regex pattern like \s for spaces, you will need to configure all escaped spaces as %{space} to use in the body data.

create_logs_pipeline(body: LogsPipeline) LogsPipeline

Create a pipeline.

Create a pipeline in your organization.

Parameters:

body (LogsPipeline) – Definition of the new pipeline.

Return type:

LogsPipeline

delete_logs_pipeline(pipeline_id: str) None

Delete a pipeline.

Delete a given pipeline from your organization. This endpoint takes no JSON arguments.

Parameters:

pipeline_id (str) – ID of the pipeline to delete.

Return type:

None

get_logs_pipeline(pipeline_id: str) LogsPipeline

Get a pipeline.

Get a specific pipeline from your organization. This endpoint takes no JSON arguments.

Parameters:

pipeline_id (str) – ID of the pipeline to get.

Return type:

LogsPipeline

get_logs_pipeline_order() LogsPipelinesOrder

Get pipeline order.

Get the current order of your pipelines. This endpoint takes no JSON arguments.

Return type:

LogsPipelinesOrder

list_logs_pipelines() LogsPipelineList

Get all pipelines.

Get all pipelines from your organization. This endpoint takes no JSON arguments.

Return type:

LogsPipelineList

update_logs_pipeline(pipeline_id: str, body: LogsPipeline) LogsPipeline

Update a pipeline.

Update a given pipeline configuration to change it’s processors or their order.

Note : Using this method updates your pipeline configuration by replacing your current configuration with the new one sent to your Datadog organization.

Parameters:
  • pipeline_id (str) – ID of the pipeline to delete.

  • body (LogsPipeline) – New definition of the pipeline.

Return type:

LogsPipeline

update_logs_pipeline_order(body: LogsPipelinesOrder) LogsPipelinesOrder

Update pipeline order.

Update the order of your pipelines. Since logs are processed sequentially, reordering a pipeline may change the structure and content of the data processed by other pipelines and their processors.

Note : Using the PUT method updates your pipeline order by replacing your current order with the new one sent to your Datadog organization.

Parameters:

body (LogsPipelinesOrder) – Object containing the new ordered list of pipeline IDs.

Return type:

LogsPipelinesOrder

metrics_api

class MetricsApi(api_client=None)

Bases: object

The metrics endpoint allows you to:

  • Post metrics data so it can be graphed on Datadog’s dashboards

  • Query metrics from any time period

  • Modify tag configurations for metrics

  • View tags and volumes for metrics

Note : A graph can only contain a set number of points and as the timeframe over which a metric is viewed increases, aggregation between points occurs to stay below that set number.

The Post, Patch, and Delete manage_tags API methods can only be performed by a user who has the Manage Tags for Metrics permission.

get_metric_metadata(metric_name: str) MetricMetadata

Get metric metadata.

Get metadata about a specific metric.

Parameters:

metric_name (str) – Name of the metric for which to get metadata.

Return type:

MetricMetadata

list_active_metrics(_from: int, *, host: str | UnsetType = UnsetType.unset, tag_filter: str | UnsetType = UnsetType.unset) MetricsListResponse

Get active metrics list.

Get the list of actively reporting metrics from a given time until now.

Parameters:
  • _from (int) – Seconds since the Unix epoch.

  • host (str, optional) – Hostname for filtering the list of metrics returned. If set, metrics retrieved are those with the corresponding hostname tag.

  • tag_filter (str, optional) – Filter metrics that have been submitted with the given tags. Supports boolean and wildcard expressions. Cannot be combined with other filters.

Return type:

MetricsListResponse

list_metrics(q: str) MetricSearchResponse

Search metrics.

Search for metrics from the last 24 hours in Datadog.

Parameters:

q (str) – Query string to search metrics upon. Can optionally be prefixed with metrics:.

Return type:

MetricSearchResponse

query_metrics(_from: int, to: int, query: str) MetricsQueryResponse

Query timeseries points.

Query timeseries points.

Parameters:
  • _from (int) – Start of the queried time period, seconds since the Unix epoch.

  • to (int) – End of the queried time period, seconds since the Unix epoch.

  • query (str) – Query string.

Return type:

MetricsQueryResponse

submit_distribution_points(body: DistributionPointsPayload, *, content_encoding: DistributionPointsContentEncoding | UnsetType = UnsetType.unset) IntakePayloadAccepted

Submit distribution points.

The distribution points end-point allows you to post distribution data that can be graphed on Datadog’s dashboards.

Parameters:

content_encoding (DistributionPointsContentEncoding, optional) – HTTP header used to compress the media-type.

Return type:

IntakePayloadAccepted

submit_metrics(body: MetricsPayload, *, content_encoding: MetricContentEncoding | UnsetType = UnsetType.unset) IntakePayloadAccepted

Submit metrics.

The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards. The maximum payload size is 3.2 megabytes (3200000 bytes). Compressed payloads must have a decompressed size of less than 62 megabytes (62914560 bytes).

If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect:

  • 64 bits for the timestamp

  • 64 bits for the value

  • 40 bytes for the metric names

  • 50 bytes for the timeseries

  • The full payload is approximately 100 bytes. However, with the DogStatsD API, compression is applied, which reduces the payload size.

Parameters:

content_encoding (MetricContentEncoding, optional) – HTTP header used to compress the media-type.

Return type:

IntakePayloadAccepted

update_metric_metadata(metric_name: str, body: MetricMetadata) MetricMetadata

Edit metric metadata.

Edit metadata of a specific metric. Find out more about supported types.

Parameters:
  • metric_name (str) – Name of the metric for which to edit metadata.

  • body (MetricMetadata) – New metadata.

Return type:

MetricMetadata

monitors_api

class MonitorsApi(api_client=None)

Bases: object

Monitors allow you to watch a metric or check that you care about and notifies your team when a defined threshold has exceeded.

For more information, see Creating Monitors.

check_can_delete_monitor(monitor_ids: List[int]) CheckCanDeleteMonitorResponse

Check if a monitor can be deleted.

Check if the given monitors can be deleted.

Parameters:

monitor_ids ([int]) – The IDs of the monitor to check.

Return type:

CheckCanDeleteMonitorResponse

create_monitor(body: Monitor) Monitor

Create a monitor.

Create a monitor using the specified options.

Monitor Types

The type of monitor chosen from:

  • anomaly: query alert

  • APM: query alert or trace-analytics alert

  • composite: composite

  • custom: service check

  • event: event alert

  • forecast: query alert

  • host: service check

  • integration: query alert or service check

  • live process: process alert

  • logs: log alert

  • metric: query alert

  • network: service check

  • outlier: query alert

  • process: service check

  • rum: rum alert

  • SLO: slo alert

  • watchdog: event alert

  • event-v2: event-v2 alert

  • audit: audit alert

  • error-tracking: error-tracking alert

Note : Synthetic monitors are created through the Synthetics API. See the [Synthetics API] (https://docs.datadoghq.com/api/latest/synthetics/) documentation for more information.

Query Types

Metric Alert Query

Example: time_aggr(time_window):space_aggr:metric{tags} [by {key}] operator #

  • time_aggr : avg, sum, max, min, change, or pct_change

  • time_window : last_#m (with # between 1 and 10080 depending on the monitor type) or last_#h (with # between 1 and 168 depending on the monitor type) or last_1d , or last_1w

  • space_aggr : avg, sum, min, or max

  • tags : one or more tags (comma-separated), or *

  • key: a ‘key’ in key:value tag syntax; defines a separate alert for each tag in the group (multi-alert)

  • operator : <, <=, >, >=, ==, or !=

  • # : an integer or decimal number used to set the threshold

If you are using the _change_ or _pct_change_ time aggregator, instead use change_aggr(time_aggr(time_window), timeshift):space_aggr:metric{tags} [by {key}] operator # with:

  • change_aggr change, pct_change

  • time_aggr avg, sum, max, min Learn more

  • time_window last_#m (between 1 and 2880 depending on the monitor type), last_#h (between 1 and 48 depending on the monitor type), or last_#d (1 or 2)

  • timeshift #m_ago (5, 10, 15, or 30), #h_ago (1, 2, or 4), or 1d_ago

Use this to create an outlier monitor using the following query: avg(last_30m):outliers(avg:system.cpu.user{role:es-events-data} by {host}, 'dbscan', 7) > 0

Service Check Query

Example: "check".over(tags).last(count).by(group).count_by_status()

  • check name of the check, for example datadog.agent.up

  • tags one or more quoted tags (comma-separated), or “*”. for example: .over("env:prod", "role:db") ; over cannot be blank.

  • count must be at greater than or equal to your max threshold (defined in the options ). It is limited to 100. For example, if you’ve specified to notify on 1 critical, 3 ok, and 2 warn statuses, count should be at least 3.

  • group must be specified for check monitors. Per-check grouping is already explicitly known for some service checks. For example, Postgres integration monitors are tagged by db , host , and port , and Network monitors by host , instance , and url. See Service Checks documentation for more information.

Event Alert Query

Example: events('sources:nagios status:error,warning priority:normal tags: "string query"').rollup("count").last("1h")"

  • event , the event query string:

  • string_query free text query to match against event title and text.

  • sources event sources (comma-separated).

  • status event statuses (comma-separated). Valid options: error, warn, and info.

  • priority event priorities (comma-separated). Valid options: low, normal, all.

  • host event reporting host (comma-separated).

  • tags event tags (comma-separated).

  • excluded_tags excluded event tags (comma-separated).

  • rollup the stats roll-up method. count is the only supported method now.

  • last the timeframe to roll up the counts. Examples: 45m, 4h. Supported timeframes: m, h and d. This value should not exceed 48 hours.

NOTE The Event Alert Query is being deprecated and replaced by the Event V2 Alert Query. For more information, see the Event Migration guide.

Event V2 Alert Query

Example: events(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query The search query - following the Log search syntax.

  • rollup_method The stats roll-up method - supports count , avg and cardinality.

  • measure For avg and cardinality rollup_method - specify the measure or the facet name you want to use.

  • time_window #m (between 1 and 2880), #h (between 1 and 48).

  • operator < , <= , > , >= , == , or !=.

  • # an integer or decimal number used to set the threshold.

Process Alert Query

Example: processes(search).over(tags).rollup('count').last(timeframe) operator #

  • search free text search string for querying processes. Matching processes match results on the Live Processes page.

  • tags one or more tags (comma-separated)

  • timeframe the timeframe to roll up the counts. Examples: 10m, 4h. Supported timeframes: s, m, h and d

  • operator <, <=, >, >=, ==, or !=

  • # an integer or decimal number used to set the threshold

Logs Alert Query

Example: logs(query).index(index_name).rollup(rollup_method[, measure]).last(time_window) operator #

  • query The search query - following the Log search syntax.

  • index_name For multi-index organizations, the log index in which the request is performed.

  • rollup_method The stats roll-up method - supports count , avg and cardinality.

  • measure For avg and cardinality rollup_method - specify the measure or the facet name you want to use.

  • time_window #m (between 1 and 2880), #h (between 1 and 48).

  • operator < , <= , > , >= , == , or !=.

  • # an integer or decimal number used to set the threshold.

Composite Query

Example: 12345 && 67890 , where 12345 and 67890 are the IDs of non-composite monitors

  • name [ required , default = dynamic, based on query ]: The name of the alert.

  • message [ required , default = dynamic, based on query ]: A message to include with notifications for this monitor. Email notifications can be sent to specific users by using the same @username’ notation as events.

  • tags [ optional , default = empty list ]: A list of tags to associate with your monitor. When getting all monitor details via the API, use the monitor_tags argument to filter results by these tags. It is only available via the API and isn’t visible or editable in the Datadog UI.

SLO Alert Query

Example: error_budget("slo_id").over("time_window") operator #

  • slo_id : The alphanumeric SLO ID of the SLO you are configuring the alert for.

  • time_window: The time window of the SLO target you wish to alert on. Valid options: 7d , 30d , 90d.

  • operator : >= or >

Audit Alert Query

Example: audits(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query The search query - following the Log search syntax.

  • rollup_method The stats roll-up method - supports count , avg and cardinality.

  • measure For avg and cardinality rollup_method - specify the measure or the facet name you want to use.

  • time_window #m (between 1 and 2880), #h (between 1 and 48).

  • operator < , <= , > , >= , == , or !=.

  • # an integer or decimal number used to set the threshold.

NOTE Only available on US1-FED and in closed beta on US1, EU, US3, and US5.

CI Pipelines Alert Query

Example: ci-pipelines(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query The search query - following the Log search syntax.

  • rollup_method The stats roll-up method - supports count , avg , and cardinality.

  • measure For avg and cardinality rollup_method - specify the measure or the facet name you want to use.

  • time_window #m (between 1 and 2880), #h (between 1 and 48).

  • operator < , <= , > , >= , == , or !=.

  • # an integer or decimal number used to set the threshold.

NOTE CI Pipeline monitors are in alpha on US1, EU, US3 and US5.

CI Tests Alert Query

Example: ci-tests(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query The search query - following the Log search syntax.

  • rollup_method The stats roll-up method - supports count , avg , and cardinality.

  • measure For avg and cardinality rollup_method - specify the measure or the facet name you want to use.

  • time_window #m (between 1 and 2880), #h (between 1 and 48).

  • operator < , <= , > , >= , == , or !=.

  • # an integer or decimal number used to set the threshold.

NOTE CI Test monitors are available only in closed beta on US1, EU, US3 and US5.

Error Tracking Alert Query

Example(RUM): error-tracking-rum(query).rollup(rollup_method[, measure]).last(time_window) operator # Example(APM Traces): error-tracking-traces(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query The search query - following the Log search syntax.

  • rollup_method The stats roll-up method - supports count , avg , and cardinality.

  • measure For avg and cardinality rollup_method - specify the measure or the facet name you want to use.

  • time_window #m (between 1 and 2880), #h (between 1 and 48).

  • operator < , <= , > , >= , == , or !=.

  • # an integer or decimal number used to set the threshold.

Parameters:

body (Monitor) – Create a monitor request body.

Return type:

Monitor

delete_monitor(monitor_id: int, *, force: str | UnsetType = UnsetType.unset) DeletedMonitor

Delete a monitor.

Delete the specified monitor

Parameters:
  • monitor_id (int) – The ID of the monitor.

  • force (str, optional) – Delete the monitor even if it’s referenced by other resources (for example SLO, composite monitor).

Return type:

DeletedMonitor

get_monitor(monitor_id: int, *, group_states: str | UnsetType = UnsetType.unset) Monitor

Get a monitor’s details.

Get details about the specified monitor from your organization.

Parameters:
  • monitor_id (int) – The ID of the monitor

  • group_states (str, optional) – When specified, shows additional information about the group states. Choose one or more from all , alert , warn , and no data.

Return type:

Monitor

list_monitors(*, group_states: str | UnsetType = UnsetType.unset, name: str | UnsetType = UnsetType.unset, tags: str | UnsetType = UnsetType.unset, monitor_tags: str | UnsetType = UnsetType.unset, with_downtimes: bool | UnsetType = UnsetType.unset, id_offset: int | UnsetType = UnsetType.unset, page: int | UnsetType = UnsetType.unset, page_size: int | UnsetType = UnsetType.unset) List[Monitor]

Get all monitor details.

Get details about the specified monitor from your organization.

Parameters:
  • group_states (str, optional) – When specified, shows additional information about the group states. Choose one or more from all , alert , warn , and no data.

  • name (str, optional) – A string to filter monitors by name.

  • tags (str, optional) – A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. For example, host:host0.

  • monitor_tags (str, optional) – A comma separated list indicating what service and/or custom tags, if any, should be used to filter the list of monitors. Tags created in the Datadog UI automatically have the service key prepended. For example, service:my-app.

  • with_downtimes (bool, optional) – If this argument is set to true, then the returned data includes all current active downtimes for each monitor.

  • id_offset (int, optional) – Use this parameter for paginating through large sets of monitors. Start with a value of zero, make a request, set the value to the last ID of result set, and then repeat until the response is empty.

  • page (int, optional) – The page to start paginating from. If this argument is not specified, the request returns all monitors without pagination.

  • page_size (int, optional) – The number of monitors to return per page. If the page argument is not specified, the default behavior returns all monitors without a page_size limit. However, if page is specified and page_size is not, the argument defaults to 100.

Return type:

[Monitor]

search_monitor_groups(*, query: str | UnsetType = UnsetType.unset, page: int | UnsetType = UnsetType.unset, per_page: int | UnsetType = UnsetType.unset, sort: str | UnsetType = UnsetType.unset) MonitorGroupSearchResponse

Monitors group search.

Search and filter your monitor groups details.

Parameters:
  • query (str, optional) –

    After entering a search query in your Manage Monitor page use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated manage monitor documentation page to learn more.

    The query can contain any number of space-separated monitor attributes, for instance query="type:metric status:alert".

  • page (int, optional) – Page to start paginating from.

  • per_page (int, optional) – Number of monitors to return per page.

  • sort (str, optional) –

    String for sort order, composed of field and sort order separate by a comma, for example name,asc. Supported sort directions: asc , desc. Supported fields:

    • name

    • status

    • tags

Return type:

MonitorGroupSearchResponse

search_monitors(*, query: str | UnsetType = UnsetType.unset, page: int | UnsetType = UnsetType.unset, per_page: int | UnsetType = UnsetType.unset, sort: str | UnsetType = UnsetType.unset) MonitorSearchResponse

Monitors search.

Search and filter your monitors details.

Parameters:
  • query (str, optional) –

    After entering a search query in your Manage Monitor page use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated manage monitor documentation page to learn more.

    The query can contain any number of space-separated monitor attributes, for instance query="type:metric status:alert".

  • page (int, optional) – Page to start paginating from.

  • per_page (int, optional) – Number of monitors to return per page.

  • sort (str, optional) –

    String for sort order, composed of field and sort order separate by a comma, for example name,asc. Supported sort directions: asc , desc. Supported fields:

    • name

    • status

    • tags

Return type:

MonitorSearchResponse

update_monitor(monitor_id: int, body: MonitorUpdateRequest) Monitor

Edit a monitor.

Edit the specified monitor.

Parameters:
  • monitor_id (int) – The ID of the monitor.

  • body (MonitorUpdateRequest) – Edit a monitor request body.

Return type:

Monitor

validate_existing_monitor(monitor_id: int, body: Monitor) dict

Validate an existing monitor.

Validate the monitor provided in the request.

Parameters:
  • monitor_id (int) – The ID of the monitor

  • body (Monitor) – Monitor request object

Return type:

dict

validate_monitor(body: Monitor) dict

Validate a monitor.

Validate the monitor provided in the request.

Parameters:

body (Monitor) – Monitor request object

Return type:

dict

notebooks_api

class NotebooksApi(api_client=None)

Bases: object

Interact with your notebooks through the API to make it easier to organize, find, and share all of your notebooks with your team and organization. For more information, see the Notebooks documentation.

create_notebook(body: NotebookCreateRequest) NotebookResponse

Create a notebook.

Create a notebook using the specified options.

Parameters:

body (NotebookCreateRequest) – The JSON description of the notebook you want to create.

Return type:

NotebookResponse

delete_notebook(notebook_id: int) None

Delete a notebook.

Delete a notebook using the specified ID.

Parameters:

notebook_id (int) – Unique ID, assigned when you create the notebook.

Return type:

None

get_notebook(notebook_id: int) NotebookResponse

Get a notebook.

Get a notebook using the specified notebook ID.

Parameters:

notebook_id (int) – Unique ID, assigned when you create the notebook.

Return type:

NotebookResponse

list_notebooks(*, author_handle: str | UnsetType = UnsetType.unset, exclude_author_handle: str | UnsetType = UnsetType.unset, start: int | UnsetType = UnsetType.unset, count: int | UnsetType = UnsetType.unset, sort_field: str | UnsetType = UnsetType.unset, sort_dir: str | UnsetType = UnsetType.unset, query: str | UnsetType = UnsetType.unset, include_cells: bool | UnsetType = UnsetType.unset, is_template: bool | UnsetType = UnsetType.unset, type: str | UnsetType = UnsetType.unset) NotebooksResponse

Get all notebooks.

Get all notebooks. This can also be used to search for notebooks with a particular query in the notebook name or author handle.

Parameters:
  • author_handle (str, optional) – Return notebooks created by the given author_handle.

  • exclude_author_handle (str, optional) – Return notebooks not created by the given author_handle.

  • start (int, optional) – The index of the first notebook you want returned.

  • count (int, optional) – The number of notebooks to be returned.

  • sort_field (str, optional) – Sort by field modified , name , or created.

  • sort_dir (str, optional) – Sort by direction asc or desc.

  • query (str, optional) – Return only notebooks with query string in notebook name or author handle.

  • include_cells (bool, optional) – Value of false excludes the cells and global time for each notebook.

  • is_template (bool, optional) – True value returns only template notebooks. Default is false (returns only non-template notebooks).

  • type (str, optional) – If type is provided, returns only notebooks with that metadata type. Default does not have type filtering.

Return type:

NotebooksResponse

update_notebook(notebook_id: int, body: NotebookUpdateRequest) NotebookResponse

Update a notebook.

Update a notebook using the specified ID.

Parameters:
  • notebook_id (int) – Unique ID, assigned when you create the notebook.

  • body (NotebookUpdateRequest) – Update notebook request body.

Return type:

NotebookResponse

organizations_api

class OrganizationsApi(api_client=None)

Bases: object

Create, edit, and manage your organizations. Read more about multi-org accounts.

create_child_org(body: OrganizationCreateBody) OrganizationCreateResponse

Create a child organization.

Create a child organization.

This endpoint requires the multi-organization account feature and must be enabled by contacting support.

Once a new child organization is created, you can interact with it by using the org.public_id , api_key.key , and application_key.hash provided in the response.

Parameters:

body (OrganizationCreateBody) – Organization object that needs to be created

Return type:

OrganizationCreateResponse

downgrade_org(public_id: str) OrgDowngradedResponse

Spin-off Child Organization.

Only available for MSP customers. Removes a child organization from the hierarchy of the master organization and places the child organization on a 30-day trial.

Parameters:

public_id (str) – The public_id of the organization you are operating within.

Return type:

OrgDowngradedResponse

get_org(public_id: str) OrganizationResponse

Get organization information.

Get organization information.

Parameters:

public_id (str) – The public_id of the organization you are operating within.

Return type:

OrganizationResponse

list_orgs() OrganizationListResponse

List your managed organizations.

This endpoint returns data on your top-level organization.

Return type:

OrganizationListResponse

update_org(public_id: str, body: Organization) OrganizationResponse

Update your organization.

Update your organization.

Parameters:

public_id (str) – The public_id of the organization you are operating within.

Return type:

OrganizationResponse

upload_idp_for_org(public_id: str, idp_file: IOBase) IdpResponse

Upload IdP metadata.

There are a couple of options for updating the Identity Provider (IdP) metadata from your SAML IdP.

  • Multipart Form-Data : Post the IdP metadata file using a form post.

  • XML Body: Post the IdP metadata file as the body of the request.

Parameters:
  • public_id (str) – The public_id of the organization you are operating with

  • idp_file (file_type) – The path to the XML metadata file you wish to upload.

Return type:

IdpResponse

pager_duty_integration_api

class PagerDutyIntegrationApi(api_client=None)

Bases: object

Configure your Datadog-PagerDuty integration directly through the Datadog API.

create_pager_duty_integration_service(body: PagerDutyService) PagerDutyServiceName

Create a new service object.

Create a new service object in the PagerDuty integration.

Parameters:

body (PagerDutyService) – Create a new service object request body.

Return type:

PagerDutyServiceName

delete_pager_duty_integration_service(service_name: str) None

Delete a single service object.

Delete a single service object in the Datadog-PagerDuty integration.

Parameters:

service_name (str) – The service name

Return type:

None

get_pager_duty_integration_service(service_name: str) PagerDutyServiceName

Get a single service object.

Get service name in the Datadog-PagerDuty integration.

Parameters:

service_name (str) – The service name.

Return type:

PagerDutyServiceName

update_pager_duty_integration_service(service_name: str, body: PagerDutyServiceKey) None

Update a single service object.

Update a single service object in the Datadog-PagerDuty integration.

Parameters:
  • service_name (str) – The service name

  • body (PagerDutyServiceKey) – Update an existing service object request body.

Return type:

None

security_monitoring_api

class SecurityMonitoringApi(api_client=None)

Bases: object

Detection rules for generating signals and listing of generated signals.

add_security_monitoring_signal_to_incident(signal_id: str, body: AddSignalToIncidentRequest) SuccessfulSignalUpdateResponse

Add a security signal to an incident.

Add a security signal to an incident. This makes it possible to search for signals by incident within the signal explorer and to view the signals on the incident timeline.

Parameters:
Return type:

SuccessfulSignalUpdateResponse

edit_security_monitoring_signal_assignee(signal_id: str, body: SignalAssigneeUpdateRequest) SuccessfulSignalUpdateResponse

Modify the triage assignee of a security signal.

Modify the triage assignee of a security signal.

Parameters:
Return type:

SuccessfulSignalUpdateResponse

edit_security_monitoring_signal_state(signal_id: str, body: SignalStateUpdateRequest) SuccessfulSignalUpdateResponse

Change the triage state of a security signal.

Change the triage state of a security signal.

Parameters:
  • signal_id (str) – The ID of the signal.

  • body (SignalStateUpdateRequest) – Attributes describing the signal update.

Return type:

SuccessfulSignalUpdateResponse

service_checks_api

class ServiceChecksApi(api_client=None)

Bases: object

The service check endpoint allows you to post check statuses for use with monitors. Service check messages are limited to 500 characters. If a check is posted with a message containing more than 500 characters, only the first 500 characters are displayed. Messages are limited for checks with a Critical or Warning status, they are dropped for checks with an OK status.

submit_service_check(body: ServiceChecks) IntakePayloadAccepted

Submit a Service Check.

Submit a list of Service Checks.

Notes :

  • A valid API key is required.

  • Service checks can be submitted up to 10 minutes in the past.

Parameters:

body (ServiceChecks) – Service Check request body.

Return type:

IntakePayloadAccepted

service_level_objective_corrections_api

class ServiceLevelObjectiveCorrectionsApi(api_client=None)

Bases: object

SLO Status Corrections allow you to prevent specific time periods from negatively impacting your SLO’s status and error budget. You can use Status Corrections for various purposes, such as removing planned maintenance windows, non-business hours, or other time periods that do not correspond to genuine issues.

create_slo_correction(body: SLOCorrectionCreateRequest) SLOCorrectionResponse

Create an SLO correction.

Create an SLO Correction.

Parameters:

body (SLOCorrectionCreateRequest) – Create an SLO Correction

Return type:

SLOCorrectionResponse

delete_slo_correction(slo_correction_id: str) None

Delete an SLO correction.

Permanently delete the specified SLO correction object.

Parameters:

slo_correction_id (str) – The ID of the SLO correction object.

Return type:

None

get_slo_correction(slo_correction_id: str) SLOCorrectionResponse

Get an SLO correction for an SLO.

Get an SLO correction.

Parameters:

slo_correction_id (str) – The ID of the SLO correction object.

Return type:

SLOCorrectionResponse

list_slo_correction(*, offset: int | UnsetType = UnsetType.unset, limit: int | UnsetType = UnsetType.unset) SLOCorrectionListResponse

Get all SLO corrections.

Get all Service Level Objective corrections.

Parameters:
  • offset (int, optional) – The specific offset to use as the beginning of the returned response.

  • limit (int, optional) – The number of SLO corrections to return in the response. Default is 25.

Return type:

SLOCorrectionListResponse

update_slo_correction(slo_correction_id: str, body: SLOCorrectionUpdateRequest) SLOCorrectionResponse

Update an SLO correction.

Update the specified SLO correction object.

Parameters:
  • slo_correction_id (str) – The ID of the SLO correction object.

  • body (SLOCorrectionUpdateRequest) – The edited SLO correction object.

Return type:

SLOCorrectionResponse

service_level_objectives_api

class ServiceLevelObjectivesApi(api_client=None)

Bases: object

Service Level Objectives (or SLOs) are a key part of the site reliability engineering toolkit. SLOs provide a framework for defining clear targets around application performance, which ultimately help teams provide a consistent customer experience, balance feature development with platform stability, and improve communication with internal and external users.

check_can_delete_slo(ids: str) CheckCanDeleteSLOResponse

Check if SLOs can be safely deleted.

Check if an SLO can be safely deleted. For example, assure an SLO can be deleted without disrupting a dashboard.

Parameters:

ids (str) – A comma separated list of the IDs of the service level objectives objects.

Return type:

CheckCanDeleteSLOResponse

create_slo(body: ServiceLevelObjectiveRequest) SLOListResponse

Create an SLO object.

Create a service level objective object.

Parameters:

body (ServiceLevelObjectiveRequest) – Service level objective request object.

Return type:

SLOListResponse

delete_slo(slo_id: str, *, force: str | UnsetType = UnsetType.unset) SLODeleteResponse

Delete an SLO.

Permanently delete the specified service level objective object.

If an SLO is used in a dashboard, the DELETE /v1/slo/ endpoint returns a 409 conflict error because the SLO is referenced in a dashboard.

Parameters:
  • slo_id (str) – The ID of the service level objective.

  • force (str, optional) – Delete the monitor even if it’s referenced by other resources (for example SLO, composite monitor).

Return type:

SLODeleteResponse

delete_slo_timeframe_in_bulk(body: SLOBulkDelete) SLOBulkDeleteResponse

Bulk Delete SLO Timeframes.

Delete (or partially delete) multiple service level objective objects.

This endpoint facilitates deletion of one or more thresholds for one or more service level objective objects. If all thresholds are deleted, the service level objective object is deleted as well.

Parameters:

body (SLOBulkDelete) – Delete multiple service level objective objects request body.

Return type:

SLOBulkDeleteResponse

get_slo(slo_id: str, *, with_configured_alert_ids: bool | UnsetType = UnsetType.unset) SLOResponse

Get an SLO’s details.

Get a service level objective object.

Parameters:
  • slo_id (str) – The ID of the service level objective object.

  • with_configured_alert_ids (bool, optional) – Get the IDs of SLO monitors that reference this SLO.

Return type:

SLOResponse

get_slo_corrections(slo_id: str) SLOCorrectionListResponse

Get Corrections For an SLO.

Get corrections applied to an SLO

Parameters:

slo_id (str) – The ID of the service level objective object.

Return type:

SLOCorrectionListResponse

get_slo_history(slo_id: str, from_ts: int, to_ts: int, *, target: float | UnsetType = UnsetType.unset, apply_correction: bool | UnsetType = UnsetType.unset) SLOHistoryResponse

Get an SLO’s history.

Get a specific SLO’s history, regardless of its SLO type.

The detailed history data is structured according to the source data type. For example, metric data is included for event SLOs that use the metric source, and monitor SLO types include the monitor transition history.

Note: There are different response formats for event based and time based SLOs. Examples of both are shown.

Parameters:
  • slo_id (str) – The ID of the service level objective object.

  • from_ts (int) – The from timestamp for the query window in epoch seconds.

  • to_ts (int) – The to timestamp for the query window in epoch seconds.

  • target (float, optional) – The SLO target. If target is passed in, the response will include the remaining error budget and a timeframe value of custom.

  • apply_correction (bool, optional) – Defaults to true. If any SLO corrections are applied and this parameter is set to false , then the corrections will not be applied and the SLI values will not be affected.

Return type:

SLOHistoryResponse

list_slos(*, ids: str | UnsetType = UnsetType.unset, query: str | UnsetType = UnsetType.unset, tags_query: str | UnsetType = UnsetType.unset, metrics_query: str | UnsetType = UnsetType.unset, limit: int | UnsetType = UnsetType.unset, offset: int | UnsetType = UnsetType.unset) SLOListResponse

Get all SLOs.

Get a list of service level objective objects for your organization.

Parameters:
  • ids (str, optional) – A comma separated list of the IDs of the service level objectives objects.

  • query (str, optional) – The query string to filter results based on SLO names.

  • tags_query (str, optional) – The query string to filter results based on a single SLO tag.

  • metrics_query (str, optional) – The query string to filter results based on SLO numerator and denominator.

  • limit (int, optional) – The number of SLOs to return in the response.

  • offset (int, optional) – The specific offset to use as the beginning of the returned response.

Return type:

SLOListResponse

search_slo(*, query: str | UnsetType = UnsetType.unset, page_size: int | UnsetType = UnsetType.unset, page_number: int | UnsetType = UnsetType.unset, include_facets: bool | UnsetType = UnsetType.unset) SearchSLOResponse

Search for SLOs.

Get a list of service level objective objects for your organization.

Parameters:
  • query (str, optional) – The query string to filter results based on SLO names. Some examples of queries include service:<service-name> and <slo-name>.

  • page_size (int, optional) – The number of files to return in the response [default=10].

  • page_number (int, optional) – The identifier of the first page to return. This parameter is used for the pagination feature [default=0].

  • include_facets (bool, optional) – Whether or not to return facet information in the response [default=false].

Return type:

SearchSLOResponse

update_slo(slo_id: str, body: ServiceLevelObjective) SLOListResponse

Update an SLO.

Update the specified service level objective object.

Parameters:
  • slo_id (str) – The ID of the service level objective object.

  • body (ServiceLevelObjective) – The edited service level objective request object.

Return type:

SLOListResponse

slack_integration_api

class SlackIntegrationApi(api_client=None)

Bases: object

Configure your Datadog-Slack integration directly through the Datadog API.

create_slack_integration_channel(account_name: str, body: SlackIntegrationChannel) SlackIntegrationChannel

Create a Slack integration channel.

Add a channel to your Datadog-Slack integration.

Parameters:
  • account_name (str) – Your Slack account name.

  • body (SlackIntegrationChannel) – Payload describing Slack channel to be created

Return type:

SlackIntegrationChannel

get_slack_integration_channel(account_name: str, channel_name: str) SlackIntegrationChannel

Get a Slack integration channel.

Get a channel configured for your Datadog-Slack integration.

Parameters:
  • account_name (str) – Your Slack account name.

  • channel_name (str) – The name of the Slack channel being operated on.

Return type:

SlackIntegrationChannel

get_slack_integration_channels(account_name: str) SlackIntegrationChannels

Get all channels in a Slack integration.

Get a list of all channels configured for your Datadog-Slack integration.

Parameters:

account_name (str) – Your Slack account name.

Return type:

SlackIntegrationChannels

remove_slack_integration_channel(account_name: str, channel_name: str) None

Remove a Slack integration channel.

Remove a channel from your Datadog-Slack integration.

Parameters:
  • account_name (str) – Your Slack account name.

  • channel_name (str) – The name of the Slack channel being operated on.

Return type:

None

update_slack_integration_channel(account_name: str, channel_name: str, body: SlackIntegrationChannel) SlackIntegrationChannel

Update a Slack integration channel.

Update a channel used in your Datadog-Slack integration.

Parameters:
  • account_name (str) – Your Slack account name.

  • channel_name (str) – The name of the Slack channel being operated on.

  • body (SlackIntegrationChannel) – Payload describing fields and values to be updated.

Return type:

SlackIntegrationChannel

snapshots_api

class SnapshotsApi(api_client=None)

Bases: object

Take graph snapshots using the API.

get_graph_snapshot(start: int, end: int, *, metric_query: str | UnsetType = UnsetType.unset, event_query: str | UnsetType = UnsetType.unset, graph_def: str | UnsetType = UnsetType.unset, title: str | UnsetType = UnsetType.unset, height: int | UnsetType = UnsetType.unset, width: int | UnsetType = UnsetType.unset) GraphSnapshot

Take graph snapshots.

Take graph snapshots. Note : When a snapshot is created, there is some delay before it is available.

Parameters:
  • start (int) – The POSIX timestamp of the start of the query.

  • end (int) – The POSIX timestamp of the end of the query.

  • metric_query (str, optional) – The metric query.

  • event_query (str, optional) – A query that adds event bands to the graph.

  • graph_def (str, optional) – A JSON document defining the graph. graph_def can be used instead of metric_query. The JSON document uses the grammar defined here and should be formatted to a single line then URL encoded.

  • title (str, optional) – A title for the graph. If no title is specified, the graph does not have a title.

  • height (int, optional) – The height of the graph. If no height is specified, the graph’s original height is used.

  • width (int, optional) – The width of the graph. If no width is specified, the graph’s original width is used.

Return type:

GraphSnapshot

synthetics_api

class SyntheticsApi(api_client=None)

Bases: object

Datadog Synthetics uses simulated user requests and browser rendering to help you ensure uptime, identify regional issues, and track your application performance. Datadog Synthetics tests come in two different flavors, API tests and browser tests. You can use Datadog’s API to manage both test types programmatically.

For more information about Synthetics, see the Synthetics overview.

create_global_variable(body: SyntheticsGlobalVariable) SyntheticsGlobalVariable

Create a global variable.

Create a Synthetics global variable.

Parameters:

body (SyntheticsGlobalVariable) – Details of the global variable to create.

Return type:

SyntheticsGlobalVariable

create_private_location(body: SyntheticsPrivateLocation) SyntheticsPrivateLocationCreationResponse

Create a private location.

Create a new Synthetics private location.

Parameters:

body (SyntheticsPrivateLocation) – Details of the private location to create.

Return type:

SyntheticsPrivateLocationCreationResponse

create_synthetics_api_test(body: SyntheticsAPITest) SyntheticsAPITest

Create an API test.

Create a Synthetic API test.

Parameters:

body (SyntheticsAPITest) – Details of the test to create.

Return type:

SyntheticsAPITest

create_synthetics_browser_test(body: SyntheticsBrowserTest) SyntheticsBrowserTest

Create a browser test.

Create a Synthetic browser test.

Parameters:

body (SyntheticsBrowserTest) – Details of the test to create.

Return type:

SyntheticsBrowserTest

delete_global_variable(variable_id: str) None

Delete a global variable.

Delete a Synthetics global variable.

Parameters:

variable_id (str) – The ID of the global variable.

Return type:

None

delete_private_location(location_id: str) None

Delete a private location.

Delete a Synthetics private location.

Parameters:

location_id (str) – The ID of the private location.

Return type:

None

delete_tests(body: SyntheticsDeleteTestsPayload) SyntheticsDeleteTestsResponse

Delete tests.

Delete multiple Synthetic tests by ID.

Parameters:

body (SyntheticsDeleteTestsPayload) – Public ID list of the Synthetic tests to be deleted.

Return type:

SyntheticsDeleteTestsResponse

edit_global_variable(variable_id: str, body: SyntheticsGlobalVariable) SyntheticsGlobalVariable

Edit a global variable.

Edit a Synthetics global variable.

Parameters:
  • variable_id (str) – The ID of the global variable.

  • body (SyntheticsGlobalVariable) – Details of the global variable to update.

Return type:

SyntheticsGlobalVariable

get_api_test(public_id: str) SyntheticsAPITest

Get an API test.

Get the detailed configuration associated with a Synthetic API test.

Parameters:

public_id (str) – The public ID of the test to get details from.

Return type:

SyntheticsAPITest

get_api_test_latest_results(public_id: str, *, from_ts: int | UnsetType = UnsetType.unset, to_ts: int | UnsetType = UnsetType.unset, probe_dc: List[str] | UnsetType = UnsetType.unset) SyntheticsGetAPITestLatestResultsResponse

Get an API test’s latest results summaries.

Get the last 50 test results summaries for a given Synthetics API test.

Parameters:
  • public_id (str) – The public ID of the test for which to search results for.

  • from_ts (int, optional) – Timestamp in milliseconds from which to start querying results.

  • to_ts (int, optional) – Timestamp in milliseconds up to which to query results.

  • probe_dc ([str], optional) – Locations for which to query results.

Return type:

SyntheticsGetAPITestLatestResultsResponse

get_api_test_result(public_id: str, result_id: str) SyntheticsAPITestResultFull

Get an API test result.

Get a specific full result from a given (API) Synthetic test.

Parameters:
  • public_id (str) – The public ID of the API test to which the target result belongs.

  • result_id (str) – The ID of the result to get.

Return type:

SyntheticsAPITestResultFull

get_browser_test(public_id: str) SyntheticsBrowserTest

Get a browser test.

Get the detailed configuration (including steps) associated with a Synthetic browser test.

Parameters:

public_id (str) – The public ID of the test to get details from.

Return type:

SyntheticsBrowserTest

get_browser_test_latest_results(public_id: str, *, from_ts: int | UnsetType = UnsetType.unset, to_ts: int | UnsetType = UnsetType.unset, probe_dc: List[str] | UnsetType = UnsetType.unset) SyntheticsGetBrowserTestLatestResultsResponse

Get a browser test’s latest results summaries.

Get the last 50 test results summaries for a given Synthetics Browser test.

Parameters:
  • public_id (str) – The public ID of the browser test for which to search results for.

  • from_ts (int, optional) – Timestamp in milliseconds from which to start querying results.

  • to_ts (int, optional) – Timestamp in milliseconds up to which to query results.

  • probe_dc ([str], optional) – Locations for which to query results.

Return type:

SyntheticsGetBrowserTestLatestResultsResponse

get_browser_test_result(public_id: str, result_id: str) SyntheticsBrowserTestResultFull

Get a browser test result.

Get a specific full result from a given (browser) Synthetic test.

Parameters:
  • public_id (str) – The public ID of the browser test to which the target result belongs.

  • result_id (str) – The ID of the result to get.

Return type:

SyntheticsBrowserTestResultFull

get_global_variable(variable_id: str) SyntheticsGlobalVariable

Get a global variable.

Get the detailed configuration of a global variable.

Parameters:

variable_id (str) – The ID of the global variable.

Return type:

SyntheticsGlobalVariable

get_private_location(location_id: str) SyntheticsPrivateLocation

Get a private location.

Get a Synthetics private location.

Parameters:

location_id (str) – The ID of the private location.

Return type:

SyntheticsPrivateLocation

get_synthetics_ci_batch(batch_id: str) SyntheticsBatchDetails

Get details of batch.

Get a batch’s updated details.

Parameters:

batch_id (str) – The ID of the batch.

Return type:

SyntheticsBatchDetails

get_test(public_id: str) SyntheticsTestDetails

Get a test configuration.

Get the detailed configuration associated with a Synthetics test.

Parameters:

public_id (str) – The public ID of the test to get details from.

Return type:

SyntheticsTestDetails

list_global_variables() SyntheticsListGlobalVariablesResponse

Get all global variables.

Get the list of all Synthetics global variables.

Return type:

SyntheticsListGlobalVariablesResponse

list_locations() SyntheticsLocations

Get all locations (public and private).

Get the list of public and private locations available for Synthetic tests. No arguments required.

Return type:

SyntheticsLocations

list_tests(*, page_size: str | UnsetType = UnsetType.unset, page_number: str | UnsetType = UnsetType.unset) SyntheticsListTestsResponse

Get the list of all Synthetic tests.

Get the list of all Synthetic tests.

Parameters:
  • page_size (str, optional) – Used for pagination. The number of tests returned in the page.

  • page_number (str, optional) – Used for pagination. Which page you want to retrieve. Starts at zero.

Return type:

SyntheticsListTestsResponse

trigger_ci_tests(body: SyntheticsCITestBody) SyntheticsTriggerCITestsResponse

Trigger tests from CI/CD pipelines.

Trigger a set of Synthetics tests for continuous integration.

Parameters:

body (SyntheticsCITestBody) – Details of the test to trigger.

Return type:

SyntheticsTriggerCITestsResponse

trigger_tests(body: SyntheticsTriggerBody) SyntheticsTriggerCITestsResponse

Trigger Synthetics tests.

Trigger a set of Synthetics tests.

Parameters:

body (SyntheticsTriggerBody) – The identifiers of the tests to trigger.

Return type:

SyntheticsTriggerCITestsResponse

update_api_test(public_id: str, body: SyntheticsAPITest) SyntheticsAPITest

Edit an API test.

Edit the configuration of a Synthetic API test.

Parameters:
  • public_id (str) – The public ID of the test to get details from.

  • body (SyntheticsAPITest) – New test details to be saved.

Return type:

SyntheticsAPITest

update_browser_test(public_id: str, body: SyntheticsBrowserTest) SyntheticsBrowserTest

Edit a browser test.

Edit the configuration of a Synthetic browser test.

Parameters:
  • public_id (str) – The public ID of the test to get details from.

  • body (SyntheticsBrowserTest) – New test details to be saved.

Return type:

SyntheticsBrowserTest

update_private_location(location_id: str, body: SyntheticsPrivateLocation) SyntheticsPrivateLocation

Edit a private location.

Edit a Synthetics private location.

Parameters:
  • location_id (str) – The ID of the private location.

  • body (SyntheticsPrivateLocation) – Details of the private location to be updated.

Return type:

SyntheticsPrivateLocation

update_test_pause_status(public_id: str, body: SyntheticsUpdateTestPauseStatusPayload) bool

Pause or start a test.

Pause or start a Synthetics test by changing the status.

Parameters:
Return type:

bool

tags_api

class TagsApi(api_client=None)

Bases: object

The tag endpoint allows you to assign tags to hosts, for example: role:database. Those tags are applied to all metrics sent by the host. Refer to hosts by name ( yourhost.example.com ) when fetching and applying tags to a particular host.

The component of your infrastructure responsible for a tag is identified by a source. For example, some valid sources include nagios, hudson, jenkins, users, feed, chef, puppet, git, bitbucket, fabric, capistrano, etc.

Read more about tags on the dedicated documentation page.

create_host_tags(host_name: str, body: HostTags, *, source: str | UnsetType = UnsetType.unset) HostTags

Add tags to a host.

This endpoint allows you to add new tags to a host, optionally specifying where these tags come from.

Parameters:
  • host_name (str) – This endpoint allows you to add new tags to a host, optionally specifying where the tags came from.

  • body (HostTags) – Update host tags request body.

  • source (str, optional) – The source of the tags. Complete list of source attribute values.

Return type:

HostTags

delete_host_tags(host_name: str, *, source: str | UnsetType = UnsetType.unset) None

Remove host tags.

This endpoint allows you to remove all user-assigned tags for a single host.

Parameters:
  • host_name (str) – This endpoint allows you to remove all user-assigned tags for a single host.

  • source (str, optional) –

    The source of the tags (for example chef, puppet). Complete list of source attribute values.

Return type:

None

get_host_tags(host_name: str, *, source: str | UnsetType = UnsetType.unset) HostTags

Get host tags.

Return the list of tags that apply to a given host.

Parameters:
  • host_name (str) – When specified, filters list of tags to those tags with the specified source.

  • source (str, optional) – Source to filter.

Return type:

HostTags

list_host_tags(*, source: str | UnsetType = UnsetType.unset) TagToHosts

Get Tags.

Return a mapping of tags to hosts for your whole infrastructure.

Parameters:

source (str, optional) – When specified, filters host list to those tags with the specified source.

Return type:

TagToHosts

update_host_tags(host_name: str, body: HostTags, *, source: str | UnsetType = UnsetType.unset) HostTags

Update host tags.

This endpoint allows you to update/replace all tags in an integration source with those supplied in the request.

Parameters:
  • host_name (str) – This endpoint allows you to update/replace all in an integration source with those supplied in the request.

  • body (HostTags) – Add tags to host

  • source (str, optional) –

    The source of the tags (for example chef, puppet). Complete list of source attribute values

Return type:

HostTags

usage_metering_api

class UsageMeteringApi(api_client=None)

Bases: object

The usage metering API allows you to get hourly, daily, and monthly usage across multiple facets of Datadog. This API is available to all Pro and Enterprise customers. Usage is only accessible for parent-level organizations.

Note : Usage data is delayed by up to 72 hours from when it was incurred. It is retained for 15 months.

You can retrieve up to 24 hours of hourly usage data for multiple organizations, and up to two months of hourly usage data for a single organization in one request.

get_daily_custom_reports(*, page_size: int | UnsetType = UnsetType.unset, page_number: int | UnsetType = UnsetType.unset, sort_dir: UsageSortDirection | UnsetType = UnsetType.unset, sort: UsageSort | UnsetType = UnsetType.unset) UsageCustomReportsResponse

Get the list of available daily custom reports. Deprecated.

Get daily custom reports. Note: This endpoint will be fully deprecated on December 1, 2022. Refer to Migrating from v1 to v2 of the Usage Attribution API for the associated migration guide.

Parameters:
  • page_size (int, optional) – The number of files to return in the response. [default=60].

  • page_number (int, optional) – The identifier of the first page to return. This parameter is used for the pagination feature [default=0].

  • sort_dir (UsageSortDirection, optional) – The direction to sort by: [desc, asc].

  • sort (UsageSort, optional) – The field to sort by: [computed_on, size, start_date, end_date].

Return type:

UsageCustomReportsResponse

get_hourly_usage_attribution(start_hr: datetime, usage_type: HourlyUsageAttributionUsageType, *, end_hr: datetime | UnsetType = UnsetType.unset, next_record_id: str | UnsetType = UnsetType.unset, tag_breakdown_keys: str | UnsetType = UnsetType.unset, include_descendants: bool | UnsetType = UnsetType.unset) HourlyUsageAttributionResponse

Get hourly usage attribution.

Get hourly usage attribution.

This API endpoint is paginated. To make sure you receive all records, check if the value of next_record_id is set in the response. If it is, make another request and pass next_record_id as a parameter. Pseudo code example:

response := GetHourlyUsageAttribution(start_month)
cursor := response.metadata.pagination.next_record_id
WHILE cursor != null BEGIN
  sleep(5 seconds)  # Avoid running into rate limit
  response := GetHourlyUsageAttribution(start_month, next_record_id=cursor)
  cursor := response.metadata.pagination.next_record_id
END
Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • usage_type (HourlyUsageAttributionUsageType) – Usage type to retrieve.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

  • next_record_id (str, optional) – List following results with a next_record_id provided in the previous query.

  • tag_breakdown_keys (str, optional) –

    Comma separated list of tags used to group usage. If no value is provided the usage will not be broken down by tags.

    To see which tags are available, look for the value of tag_config_source in the API response.

  • include_descendants (bool, optional) – Include child org usage in the response. Defaults to true.

Return type:

HourlyUsageAttributionResponse

get_incident_management(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageIncidentManagementResponse

Get hourly usage for incident management.

Get hourly usage for incident management. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageIncidentManagementResponse

get_ingested_spans(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageIngestedSpansResponse

Get hourly usage for ingested spans.

Get hourly usage for ingested spans. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageIngestedSpansResponse

get_monthly_custom_reports(*, page_size: int | UnsetType = UnsetType.unset, page_number: int | UnsetType = UnsetType.unset, sort_dir: UsageSortDirection | UnsetType = UnsetType.unset, sort: UsageSort | UnsetType = UnsetType.unset) UsageCustomReportsResponse

Get the list of available monthly custom reports. Deprecated.

Get monthly custom reports. Note: This endpoint will be fully deprecated on December 1, 2022. Refer to Migrating from v1 to v2 of the Usage Attribution API for the associated migration guide.

Parameters:
  • page_size (int, optional) – The number of files to return in the response [default=60].

  • page_number (int, optional) – The identifier of the first page to return. This parameter is used for the pagination feature [default=0].

  • sort_dir (UsageSortDirection, optional) – The direction to sort by: [desc, asc].

  • sort (UsageSort, optional) – The field to sort by: [computed_on, size, start_date, end_date].

Return type:

UsageCustomReportsResponse

get_monthly_usage_attribution(start_month: datetime, fields: MonthlyUsageAttributionSupportedMetrics, *, end_month: datetime | UnsetType = UnsetType.unset, sort_direction: UsageSortDirection | UnsetType = UnsetType.unset, sort_name: MonthlyUsageAttributionSupportedMetrics | UnsetType = UnsetType.unset, tag_breakdown_keys: str | UnsetType = UnsetType.unset, next_record_id: str | UnsetType = UnsetType.unset, include_descendants: bool | UnsetType = UnsetType.unset) MonthlyUsageAttributionResponse

Get monthly usage attribution.

Get monthly usage attribution.

This API endpoint is paginated. To make sure you receive all records, check if the value of next_record_id is set in the response. If it is, make another request and pass next_record_id as a parameter. Pseudo code example:

response := GetMonthlyUsageAttribution(start_month)
cursor := response.metadata.pagination.next_record_id
WHILE cursor != null BEGIN
  sleep(5 seconds)  # Avoid running into rate limit
  response := GetMonthlyUsageAttribution(start_month, next_record_id=cursor)
  cursor := response.metadata.pagination.next_record_id
END
Parameters:
  • start_month (datetime) – Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage beginning in this month. Maximum of 15 months ago.

  • fields (MonthlyUsageAttributionSupportedMetrics) – Comma-separated list of usage types to return, or * for all usage types.

  • end_month (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage ending this month.

  • sort_direction (UsageSortDirection, optional) – The direction to sort by: [desc, asc].

  • sort_name (MonthlyUsageAttributionSupportedMetrics, optional) – The field to sort by.

  • tag_breakdown_keys (str, optional) –

    Comma separated list of tag keys used to group usage. If no value is provided the usage will not be broken down by tags.

    To see which tags are available, look for the value of tag_config_source in the API response.

  • next_record_id (str, optional) – List following results with a next_record_id provided in the previous query.

  • include_descendants (bool, optional) – Include child org usage in the response. Defaults to true.

Return type:

MonthlyUsageAttributionResponse

get_specified_daily_custom_reports(report_id: str) UsageSpecifiedCustomReportsResponse

Get specified daily custom reports. Deprecated.

Get specified daily custom reports. Note: This endpoint will be fully deprecated on December 1, 2022. Refer to Migrating from v1 to v2 of the Usage Attribution API for the associated migration guide.

Parameters:

report_id (str) – Date of the report in the format YYYY-MM-DD.

Return type:

UsageSpecifiedCustomReportsResponse

get_specified_monthly_custom_reports(report_id: str) UsageSpecifiedCustomReportsResponse

Get specified monthly custom reports. Deprecated.

Get specified monthly custom reports. Note: This endpoint will be fully deprecated on December 1, 2022. Refer to Migrating from v1 to v2 of the Usage Attribution API for the associated migration guide.

Parameters:

report_id (str) – Date of the report in the format YYYY-MM-DD.

Return type:

UsageSpecifiedCustomReportsResponse

get_usage_analyzed_logs(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageAnalyzedLogsResponse

Get hourly usage for analyzed logs.

Get hourly usage for analyzed logs (Security Monitoring). Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageAnalyzedLogsResponse

get_usage_attribution(start_month: datetime, fields: UsageAttributionSupportedMetrics, *, end_month: datetime | UnsetType = UnsetType.unset, sort_direction: UsageSortDirection | UnsetType = UnsetType.unset, sort_name: UsageAttributionSort | UnsetType = UnsetType.unset, include_descendants: bool | UnsetType = UnsetType.unset, offset: int | UnsetType = UnsetType.unset, limit: int | UnsetType = UnsetType.unset) UsageAttributionResponse

Get usage attribution. Deprecated.

Get usage attribution. Note: This endpoint will be fully deprecated on December 1, 2022. Refer to Migrating from v1 to v2 of the Usage Attribution API for the associated migration guide.

Parameters:
  • start_month (datetime) – Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage beginning in this month. Maximum of 15 months ago.

  • fields (UsageAttributionSupportedMetrics) – Comma-separated list of usage types to return, or * for all usage types.

  • end_month (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage ending this month.

  • sort_direction (UsageSortDirection, optional) – The direction to sort by: [desc, asc].

  • sort_name (UsageAttributionSort, optional) – The field to sort by.

  • include_descendants (bool, optional) – Include child org usage in the response. Defaults to false.

  • offset (int, optional) – Number of records to skip before beginning to return.

  • limit (int, optional) – Maximum number of records to be returned.

Return type:

UsageAttributionResponse

get_usage_audit_logs(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageAuditLogsResponse

Get hourly usage for audit logs.

Get hourly usage for audit logs. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageAuditLogsResponse

get_usage_billable_summary(*, month: datetime | UnsetType = UnsetType.unset) UsageBillableSummaryResponse

Get billable usage across your account.

Get billable usage across your account.

Parameters:

month (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage starting this month.

Return type:

UsageBillableSummaryResponse

get_usage_ci_app(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageCIVisibilityResponse

Get hourly usage for CI visibility.

Get hourly usage for CI visibility (tests, pipeline, and spans). Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageCIVisibilityResponse

get_usage_cloud_security_posture_management(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageCloudSecurityPostureManagementResponse

Get hourly usage for CSPM.

Get hourly usage for cloud security posture management (CSPM). Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageCloudSecurityPostureManagementResponse

get_usage_cws(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageCWSResponse

Get hourly usage for cloud workload security.

Get hourly usage for cloud workload security. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageCWSResponse

get_usage_dbm(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageDBMResponse

Get hourly usage for database monitoring.

Get hourly usage for database monitoring Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageDBMResponse

get_usage_fargate(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageFargateResponse

Get hourly usage for Fargate.

Get hourly usage for Fargate. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageFargateResponse

get_usage_hosts(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageHostsResponse

Get hourly usage for hosts and containers.

Get hourly usage for hosts and containers. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageHostsResponse

get_usage_indexed_spans(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageIndexedSpansResponse

Get hourly usage for indexed spans.

Get hourly usage for indexed spans. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageIndexedSpansResponse

get_usage_internet_of_things(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageIoTResponse

Get hourly usage for IoT.

Get hourly usage for IoT. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageIoTResponse

get_usage_lambda(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageLambdaResponse

Get hourly usage for lambda.

Get hourly usage for lambda. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageLambdaResponse

get_usage_logs(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageLogsResponse

Get hourly usage for logs.

Get hourly usage for logs. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageLogsResponse

get_usage_logs_by_index(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset, index_name: List[str] | UnsetType = UnsetType.unset) UsageLogsByIndexResponse

Get hourly usage for logs by index.

Get hourly usage for logs by index.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

  • index_name ([str], optional) – Comma-separated list of log index names.

Return type:

UsageLogsByIndexResponse

get_usage_logs_by_retention(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageLogsByRetentionResponse

Get hourly logs usage by retention.

Get hourly usage for indexed logs by retention period. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageLogsByRetentionResponse

get_usage_network_flows(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageNetworkFlowsResponse

get hourly usage for network flows.

Get hourly usage for network flows. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageNetworkFlowsResponse

get_usage_network_hosts(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageNetworkHostsResponse

Get hourly usage for network hosts.

Get hourly usage for network hosts. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageNetworkHostsResponse

get_usage_online_archive(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageOnlineArchiveResponse

Get hourly usage for online archive.

Get hourly usage for online archive. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageOnlineArchiveResponse

get_usage_profiling(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageProfilingResponse

Get hourly usage for profiled hosts.

Get hourly usage for profiled hosts. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageProfilingResponse

get_usage_rum_sessions(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset, type: str | UnsetType = UnsetType.unset) UsageRumSessionsResponse

Get hourly usage for RUM sessions.

Get hourly usage for RUM Sessions. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

  • type (str, optional) – RUM type: [browser, mobile]. Defaults to browser.

Return type:

UsageRumSessionsResponse

get_usage_rum_units(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageRumUnitsResponse

Get hourly usage for RUM units.

Get hourly usage for RUM Units. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageRumUnitsResponse

get_usage_sds(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageSDSResponse

Get hourly usage for sensitive data scanner.

Get hourly usage for sensitive data scanner. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageSDSResponse

get_usage_snmp(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageSNMPResponse

Get hourly usage for SNMP devices.

Get hourly usage for SNMP devices. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageSNMPResponse

get_usage_summary(start_month: datetime, *, end_month: datetime | UnsetType = UnsetType.unset, include_org_details: bool | UnsetType = UnsetType.unset) UsageSummaryResponse

Get usage across your account.

Get all usage across your account.

Parameters:
  • start_month (datetime) – Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage beginning in this month. Maximum of 15 months ago.

  • end_month (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage ending this month.

  • include_org_details (bool, optional) – Include usage summaries for each sub-org.

Return type:

UsageSummaryResponse

get_usage_synthetics(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageSyntheticsResponse

Get hourly usage for synthetics checks. Deprecated.

Get hourly usage for synthetics checks. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageSyntheticsResponse

get_usage_synthetics_api(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageSyntheticsAPIResponse

Get hourly usage for synthetics API checks.

Get hourly usage for synthetics API checks. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageSyntheticsAPIResponse

get_usage_synthetics_browser(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageSyntheticsBrowserResponse

Get hourly usage for synthetics browser checks.

Get hourly usage for synthetics browser checks. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageSyntheticsBrowserResponse

get_usage_timeseries(start_hr: datetime, *, end_hr: datetime | UnsetType = UnsetType.unset) UsageTimeseriesResponse

Get hourly usage for custom metrics.

Get hourly usage for custom metrics. Note: hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.

Parameters:
  • start_hr (datetime) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.

  • end_hr (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.

Return type:

UsageTimeseriesResponse

get_usage_top_avg_metrics(*, month: datetime | UnsetType = UnsetType.unset, day: datetime | UnsetType = UnsetType.unset, names: List[str] | UnsetType = UnsetType.unset, limit: int | UnsetType = UnsetType.unset, next_record_id: str | UnsetType = UnsetType.unset) UsageTopAvgMetricsResponse

Get all custom metrics by hourly average.

Get all custom metrics by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed.

Parameters:
  • month (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage beginning at this hour. (Either month or day should be specified, but not both)

  • day (datetime, optional) – Datetime in ISO-8601 format, UTC, precise to day: [YYYY-MM-DD] for usage beginning at this hour. (Either month or day should be specified, but not both)

  • names ([str], optional) – Comma-separated list of metric names.

  • limit (int, optional) – Maximum number of results to return (between 1 and 5000) - defaults to 500 results if limit not specified.

  • next_record_id (str, optional) – List following results with a next_record_id provided in the previous query.

Return type:

UsageTopAvgMetricsResponse

users_api

class UsersApi(api_client=None)

Bases: object

Create, edit, and disable users.

create_user(body: User) UserResponse

Create a user.

Create a user for your organization.

Note : Users can only be created with the admin access role if application keys belong to administrators.

Parameters:

body (User) – User object that needs to be created.

Return type:

UserResponse

disable_user(user_handle: str) UserDisableResponse

Disable a user.

Delete a user from an organization.

Note : This endpoint can only be used with application keys belonging to administrators.

Parameters:

user_handle (str) – The handle of the user.

Return type:

UserDisableResponse

get_user(user_handle: str) UserResponse

Get user details.

Get a user’s details.

Parameters:

user_handle (str) – The ID of the user.

Return type:

UserResponse

list_users() UserListResponse

List all users.

List all users for your organization.

Return type:

UserListResponse

update_user(user_handle: str, body: User) UserResponse

Update a user.

Update a user information.

Note : It can only be used with application keys belonging to administrators.

Parameters:
  • user_handle (str) – The ID of the user.

  • body (User) – Description of the update.

Return type:

UserResponse

webhooks_integration_api

class WebhooksIntegrationApi(api_client=None)

Bases: object

Configure your Datadog-Webhooks integration directly through the Datadog API. For more information about the Datadog-Webhooks integration, see the integration page.

create_webhooks_integration(body: WebhooksIntegration) WebhooksIntegration

Create a webhooks integration.

Creates an endpoint with the name <WEBHOOK_NAME>.

Parameters:

body (WebhooksIntegration) – Create a webhooks integration request body.

Return type:

WebhooksIntegration

create_webhooks_integration_custom_variable(body: WebhooksIntegrationCustomVariable) WebhooksIntegrationCustomVariableResponse

Create a custom variable.

Creates an endpoint with the name <CUSTOM_VARIABLE_NAME>.

Parameters:

body (WebhooksIntegrationCustomVariable) – Define a custom variable request body.

Return type:

WebhooksIntegrationCustomVariableResponse

delete_webhooks_integration(webhook_name: str) None

Delete a webhook.

Deletes the endpoint with the name <WEBHOOK NAME>.

Parameters:

webhook_name (str) – The name of the webhook.

Return type:

None

delete_webhooks_integration_custom_variable(custom_variable_name: str) None

Delete a custom variable.

Deletes the endpoint with the name <CUSTOM_VARIABLE_NAME>.

Parameters:

custom_variable_name (str) – The name of the custom variable.

Return type:

None

get_webhooks_integration(webhook_name: str) WebhooksIntegration

Get a webhook integration.

Gets the content of the webhook with the name <WEBHOOK_NAME>.

Parameters:

webhook_name (str) – The name of the webhook.

Return type:

WebhooksIntegration

get_webhooks_integration_custom_variable(custom_variable_name: str) WebhooksIntegrationCustomVariableResponse

Get a custom variable.

Shows the content of the custom variable with the name <CUSTOM_VARIABLE_NAME>.

If the custom variable is secret, the value does not return in the response payload.

Parameters:

custom_variable_name (str) – The name of the custom variable.

Return type:

WebhooksIntegrationCustomVariableResponse

update_webhooks_integration(webhook_name: str, body: WebhooksIntegrationUpdateRequest) WebhooksIntegration

Update a webhook.

Updates the endpoint with the name <WEBHOOK_NAME>.

Parameters:
Return type:

WebhooksIntegration

update_webhooks_integration_custom_variable(custom_variable_name: str, body: WebhooksIntegrationCustomVariableUpdateRequest) WebhooksIntegrationCustomVariableResponse

Update a custom variable.

Updates the endpoint with the name <CUSTOM_VARIABLE_NAME>.

Parameters:
Return type:

WebhooksIntegrationCustomVariableResponse