Anomalies API

Cloud cost anomaly detection offers end-to-end monitoring of spikes in your cloud billing seamlessly across all your projects and services. See cost anomalies for more information.

The Anomalies API helps you programmatically obtain cloud cost or usage anomalies for Google Cloud, Amazon Web Services, and Microsoft Azure.

👍

API Reference

The Anomalies API reference is available at https://developer.doit.com/reference/listanomalies

📘

Required Permissions

Cloud Analytics (part of Standard User built-in role)

Anomalies API has the following methods:

anomalies.list

The anomalies.list method provides a list of all anomalies available for your cloud platforms.

You can filter the list by using one or more of the following parameters:

ParameterDescription
minCreationTimestring
Min value for a time of an anomaly, in milliseconds since the POSIX epoch. If set, only anomalies happened after or at this timestamp are returned.
maxCreationTimestring
Max value for a time of an anomaly time, in milliseconds since the POSIX epoch. If set, only anomalies happened before or at this timestamp are returned.
filterstring
An expression for filtering the results of the request. The syntax is key:[<value>]. For example, the platforms:google-cloud will filter the list to only Google Cloud anomalies.

Supported filter keys:

- platform - google-cloud, amazon-web-services, or platform:microsoft-azure Learn more about how to use filter *.list requests

Sample anomalies.list Request using both minCreationTime and filter parameters:

curl --location --request GET 'https://api.doit.com/anomalies/v1/?filter=serviceName:BigQuery&minCreationTime=1599436800000' \
--header 'Authorization: Bearer your-api-key'

📘

your-api-key

Replace "your-api-key" with your actual API key as explained at Getting Started

Sample anomalies.list Response:

{
    "rowCount": 2,
    "anomalies": [
        {
            "anomalyId": "7c045b29-57ee-437b-9dc0-e7e4eb005a64",
            "billingAccount": "01A29B-B56F30-AA7597",
            "platform": "google-cloud",
            "scope": "iottempstreaming",
            "serviceName": "BigQuery",
            "severityLevel": "warning",
            "timeFrame": "hourly",
            "startTime": 1612818000000
        },
        {
            "anomalyId": "36ba6c14-bd3c-40e3-bfa2-31189ea740b4",
            "billingAccount": "01A29B-B56F30-AA7597",
            "platform": "google-cloud",
            "scope": "iottempstreaming",
            "serviceName": "BigQuery",
            "severityLevel": "critical",
            "timeFrame": "daily",
            "startTime": 1612656000000
        }
    ]
}

anomalies.get

Get the full details of the individual anomaly using the anomaly id.

Sample anomalies.get Request

curl --location --request GET 'https://api.doit.com/anomalies/v1/7c045b29-57ee-437b-9dc0-e7e4eb005a64' \
--header 'Authorization: Bearer your-api-key'

📘

your-api-key

Always replace "your-api-key" with your actual API key as explained at Getting Started

Sample anomalies.get Response:

{
    "anomalyChartUrl": "https://storage.googleapis.com/me-doit-intl-com-gcp-anomalies/7c045b29-57ee-437b-9dc0-e7e4eb005a64.png",
    "billingAccount": "01C29B-B56F30-AA7597",
    "cloudProvider": "google-cloud",
    "scope": "iottempstreaming",
    "serviceName": "BigQuery",
    "severityLevel": "warning",
    "timeFrame": "hourly",
    "startTime": 1612818000000
}

Response Body
If successful, the response body contains an instance of Anomaly

{
  "billingAccount":string,
  "platform":string,
  "scope":string,
  "serviceName":string,
  "severityLevel":string,
  "startTime":integer,
  "timeFrame":string
}

Response Body Fields

FieldDescription
billingAccountstring
Unique anomaly identifier
platformstring
The cloud platform for the anomaly. Can be google-cloud, amazon-web-services, or microsoft-azure
scopestring
The Google Cloud project ID, AWS account ID, or Azure resource group name for the given anomaly
serviceNamestring
The name of the service causing the anomaly. Examples are EC2, BigQuery, SQS, etc.
severityLevelstring
All anomalies are classified as "info", "warning" or "critical"
timeFramestring
Anomalies can be DAILY (when a certain day is abnormally large compared to other days) or HOURLY (a certain hour is abnormally large compared to other hours of the same day).
startTimenumber
The time when this anomaly was detected, in milliseconds since the epoch.`