---
title: "Fetch Query Revision"
method: GET
path: "/queries/revisions/{query_revision_id}"
tags: ["Queries"]
---

# Fetch Query Revision

`GET /queries/revisions/{query_revision_id}`

## Path parameters

- `query_revision_id` string, uuid, required

## Response `200`

Successful Response

- QueryRevisionResponse
  - `count` integer
  - `query_revision` QueryRevision
    - `query_variant_slug` string, nullable
    - `variant_slug` string, nullable
    - `query_slug` string, nullable
    - `artifact_slug` string, nullable
    - `query_variant_id` string, uuid, nullable
    - `variant_id` string, uuid, nullable
    - `query_id` string, uuid, nullable
    - `artifact_id` string, uuid, nullable
    - `author` string, uuid, nullable
    - `date` string, date-time, nullable
    - `message` string, 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
    - `version` string, nullable
    - `slug` string, nullable
    - `id` string, uuid, nullable
    - `data` QueryRevisionDataOutput
      - `formatting` Formatting
        - `focus` 'trace' | 'span'
        - `format` 'agenta' | 'opentelemetry'
      - `filtering` FilteringOutput
        - `operator` 'and' | 'or' | 'not' | 'nand' | 'nor'
        - `conditions` union[]
          - union
            - Condition
              - …
            - FilteringOutput — recursive
      - `windowing` Windowing
        - `newest` string, date-time, nullable
        - `oldest` string, date-time, nullable
        - `next` string, uuid, nullable
        - `limit` integer, nullable
        - `order` 'ascending' | 'descending', nullable
        - `interval` integer, nullable
        - `rate` number, nullable
      - `trace_ids` string[], nullable
      - `traces` TraceOutput[], nullable
        - `spans` object, nullable
        - `trace_id` string, nullable
  - `retrieval_info` RetrievalInfo — References actually used to retrieve a revision. For direct retrievals, `references` carries the artifact / variant / revision that was fetched. For environment-backed retrievals, it additionally carries the environment + environment_variant + environment_revision used to look the target up, and `selector` is {the key: path} map inside the environment's references map that selected the target.
    - `references` object
    - `selector` object, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2026-08-03** `fc532d6dc820` — 6 info
  - added the optional property `query_revision/anyOf[subschema #1: QueryRevision]/data/anyOf[subschema #1: QueryRevisionData]/traces/anyOf[subschema #1]/items/spans/anyOf[subschema #1]/additionalProperties/anyOf[subschema #1: SpansNode]/agent_id` to the response with the `200` status
  - added the optional property `query_revision/anyOf[subschema #1: QueryRevision]/data/anyOf[subschema #1: QueryRevisionData]/traces/anyOf[subschema #1]/items/spans/anyOf[subschema #1]/additionalProperties/anyOf[subschema #1: SpansNode]/session_id` to the response with the `200` status
  - added the optional property `query_revision/anyOf[subschema #1: QueryRevision]/data/anyOf[subschema #1: QueryRevisionData]/traces/anyOf[subschema #1]/items/spans/anyOf[subschema #1]/additionalProperties/anyOf[subschema #1: SpansNode]/user_id` to the response with the `200` status
  - added the optional property `query_revision/anyOf[subschema #1: QueryRevision]/data/anyOf[subschema #1: QueryRevisionData]/traces/anyOf[subschema #1]/items/spans/anyOf[subschema #1]/additionalProperties/anyOf[subschema #2]/items/agent_id` to the response with the `200` status
  - …2 more
- **2026-06-01** `b2f21936417e` — 1 info
  - added the optional property `retrieval_info` to the response with the `200` status
- **2026-05-31** `c26abd89e092` — 1 warning
  - removed the optional property `retrieval_info` from the response with the `200` status
- …earlier changes not shown

[Full history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/queries/revisions/:query_revision_id/get.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agenta-ai/agenta-api/revisions/713e4f3b7519/schema)
