---
title: "Query accounts"
method: POST
path: "/api/v2/product-analytics/accounts/query"
tags: ["Rum Audience Management"]
---

# Query accounts

`POST /api/v2/product-analytics/accounts/query`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/product-analytics/accounts/query`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token`

Query accounts with flexible filtering by account properties

## Request body

- QueryAccountRequest: Request body for querying accounts with optional filtering, column selection, and sorting.
  - `data` QueryAccountRequestData: The data object containing the resource type and attributes for querying accounts.
    - `attributes` QueryAccountRequestDataAttributes: Attributes for filtering and shaping the account query results.
      - `limit` integer: Maximum number of account records to return in the response.
      - `query` string: Filter expression using account attribute conditions to narrow results.
      - `select_columns` string[]: List of account attribute column names to include in the response.
      - `sort` QueryAccountRequestDataAttributesSort: Sorting configuration specifying the field and direction for ordering query results.
        - `field` string: The attribute field name to sort results by.
        - `order` string: The sort direction, either ascending or descending.
      - `wildcard_search_term` string: Free-text term used for wildcard search across account attribute values.
    - `id` string: Unique identifier for the query account request resource.
    - `type` 'query_account_request', required: Query account request resource type.

## Response `200`

Successful response with account data

- QueryResponse: Response containing the query results with matched records and total count.
  - `data` QueryResponseData: The data object containing the resource type and attributes of the query response.
    - `attributes` QueryResponseDataAttributes: Attributes of the query response, containing the matched records and total count.
      - `hits` unknown[]: The list of matching records returned by the query, each as a map of attribute names to values.
        - unknown
      - `total` integer: Total number of records matching the query, regardless of the limit applied.
    - `id` string: Unique identifier for the query response resource.
    - `type` 'query_response', required: Query response resource type.

## Other responses

- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
