Aggregate cases

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

POST https://api.ap1.datadoghq.com/api/v2/cases/aggregatehttps://api.ap2.datadoghq.com/api/v2/cases/aggregatehttps://api.datadoghq.eu/api/v2/cases/aggregatehttps://api.ddog-gov.com/api/v2/cases/aggregatehttps://api.us2.ddog-gov.com/api/v2/cases/aggregatehttps://api.datadoghq.com/api/v2/cases/aggregatehttps://api.us3.datadoghq.com/api/v2/cases/aggregatehttps://api.us5.datadoghq.com/api/v2/cases/aggregate

Overview

Performs an aggregation query over cases, grouping results by specified fields and returning counts per group along with a total. Useful for dashboards and analytics.

OAuth apps require the cases_read authorization scope to access this endpoint.

Request

Body Data (required)

Case aggregate request payload.

Expand All

Field

Type

Description

data [required]

object

Data object wrapping the aggregation query type and attributes.

attributes [required]

object

Attributes for the aggregation request, including the search query and grouping configuration.

group_by [required]

object

Configuration for grouping aggregated results by one or more case fields.

groups [required]

[string]

Fields to group by.

limit [required]

int32

Maximum number of groups to return.

query_filter [required]

string

A search query to filter which cases are included in the aggregation. Uses the same syntax as the Case Management search bar.

type [required]

enum

JSON:API resource type for case aggregation requests. Allowed enum values: aggregate

{
  "data": {
    "attributes": {
      "group_by": {
        "groups": [
          "status"
        ],
        "limit": 14
      },
      "query_filter": "service:case-api"
    },
    "type": "aggregate"
  }
}

Response

OK

Response containing aggregated case counts grouped by the requested fields.

Expand All

Field

Type

Description

data [required]

object

Data object containing the aggregation results, including total count and per-group breakdowns.

attributes [required]

object

Attributes of the aggregation result, including the total count across all groups and the per-group breakdowns.

groups [required]

[object]

Aggregated groups.

group [required]

string

The value of the field being grouped on (for example, OPEN when grouping by status).

value [required]

[number]

The count of cases in this group.

total [required]

double

Total count of aggregated cases.

id [required]

string

Aggregate response identifier.

type [required]

string

Aggregate resource type.

{
  "data": {
    "attributes": {
      "groups": [
        {
          "group": "OPEN",
          "value": [
            42
          ]
        }
      ],
      "total": 100
    },
    "id": "agg-result-001",
    "type": "aggregate"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Unauthorized

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/cases/aggregate" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "group_by": { "groups": [ "status" ], "limit": 14 }, "query_filter": "service:case-api" }, "type": "aggregate" } } EOF