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

# Query users

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

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/product-analytics/users/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 users with flexible filtering by user properties, with optional wildcard search

## Request body

- QueryUsersRequest: Request body for querying users with optional filtering, column selection, and sorting.
  - `data` QueryUsersRequestData: The data object containing the resource type and attributes for querying users.
    - `attributes` QueryUsersRequestDataAttributes: Attributes for filtering and shaping the user query results.
      - `limit` integer: Maximum number of user records to return in the response.
      - `query` string: Filter expression using user attribute conditions to narrow results.
      - `select_columns` string[]: List of user attribute column names to include in the response.
      - `sort` QueryUsersRequestDataAttributesSort: Sorting configuration specifying the field and direction for ordering user query results.
        - `field` string: The user 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 user attribute values.
    - `id` string: Unique identifier for the query users request resource.
    - `type` 'query_users_request', required: Query users request resource type.

## Response `200`

Successful response with user 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)
