---
title: "Query history search."
method: GET
path: "/query-history"
tags: ["query_history"]
---

# Query history search.

`GET /query-history`

Returns a list of queries in the query history that matches the search criteria.
Query history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.
You can also use the `page` query parameter to fetch queries from any page other than the first one.

## Query parameters

- `datasourceUid` string[]
- `searchString` string
- `onlyStarred` boolean
- `sort` 'time-desc' | 'time-asc'
- `page` integer
- `limit` integer
- `from` integer
- `to` integer

## Response `200`

(empty)

- QueryHistorySearchResponse
  - `result` QueryHistorySearchResult
    - `page` integer
    - `perPage` integer
    - `queryHistory` QueryHistoryDTO[]
      - `comment` string
      - `createdAt` integer
      - `createdBy` integer
      - `datasourceUid` string
      - `queries` Json
      - `starred` boolean
      - `uid` string
    - `totalCount` integer

## Other responses

- `401` — UnauthorizedError is returned when the request is not authenticated.
- `500` — InternalServerError is a general error indicating something went wrong internally.

---

[API](https://skmtc.net/nforgeio/apis/grafana-http-api.md) · [All operations](https://skmtc.net/nforgeio/apis/grafana-http-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nforgeio/grafana-http-api/versions/3cb6c3f42dc7/schema)
