# Query Testsets

Source: https://agenta.ai/docs/reference/api/query-testsets

`POST /testsets/query`

Base URL: `https://us.cloud.agenta.ai/api` (US cloud), `https://eu.cloud.agenta.ai/api` (EU cloud) or `$AGENTA_HOST/api` (self-hosted). Authentication: `Authorization: ApiKey YOUR_API_KEY`.

List and filter testset artifacts.

Follows the shared query pattern: attribute filters on the testset
body, optional `testset_refs` to restrict by id/slug, cursor-based
pagination via `windowing`. Only artifact rows are returned — no
testcases. See the Query Pattern guide for the full body shape.

## Request body schema

Content type: `application/json` (required)

- `testset` (object, nullable): Attribute filter (name, description, slug, flags, tags, meta, folder).
  - `folder_id` (string (uuid), nullable)
  - `flags` (object, nullable)
  - `tags` (object, nullable)
  - `meta` (object, nullable)
  - `name` (string, nullable)
  - `description` (string, nullable)
  - `slug` (string, nullable)
  - `slugs` (array of string, nullable)
- `testset_refs` (array of object, nullable): Restrict the query to specific testsets by reference (id or slug).
  - `version` (string, nullable)
  - `slug` (string, nullable)
  - `id` (string (uuid), nullable)
- `include_archived` (boolean, nullable): Include soft-deleted testsets.
- `windowing` (object, nullable): Cursor-based pagination. See the Query Pattern guide.
  - `newest` (string (date-time), nullable)
  - `oldest` (string (date-time), nullable)
  - `next` (string (uuid), nullable)
  - `limit` (integer, nullable)
  - `order` (string, one of: "ascending", "descending", nullable)
  - `interval` (integer, nullable)
  - `rate` (number, nullable)

## Response schemas

### 200: Successful Response

- `count` (integer): Number of testsets returned on this page. Default: `0`.
- `testsets` (array of object): Testset artifacts matching the query, without testcases.
  - `folder_id` (string (uuid), nullable)
  - `flags` (object, nullable)
  - `tags` (object, nullable)
  - `meta` (object, nullable)
  - `name` (string, nullable)
  - `description` (string, nullable)
  - `created_at` (string (date-time), nullable)
  - `updated_at` (string (date-time), nullable)
  - `deleted_at` (string (date-time), nullable)
  - `created_by_id` (string (uuid), nullable)
  - `updated_by_id` (string (uuid), nullable)
  - `deleted_by_id` (string (uuid), nullable)
  - `slug` (string, nullable)
  - `id` (string (uuid), nullable)
- `windowing` (object, nullable): Cursor for the next page, if more results exist.
  - `newest` (string (date-time), nullable)
  - `oldest` (string (date-time), nullable)
  - `next` (string (uuid), nullable)
  - `limit` (integer, nullable)
  - `order` (string, one of: "ascending", "descending", nullable)
  - `interval` (integer, nullable)
  - `rate` (number, nullable)

### 422: Validation Error

- `detail` (array of object)
  - `loc` (array of string | integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (Context)
