---
title: "Migrate queries to query history."
method: POST
path: "/query-history/migrate"
tags: ["query_history"]
---

# Migrate queries to query history.

`POST /query-history/migrate`

Adds multiple queries to query history.

## Request body

- MigrateQueriesToQueryHistoryCommand — MigrateQueriesToQueryHistoryCommand is the command used for migration of old queries into query history
  - `queries` QueryToMigrate[] — Array of queries to store in query history.
    - `comment` string
    - `createdAt` integer
    - `datasourceUid` string
    - `queries` Json
    - `starred` boolean

## Response `200`

(empty)

- QueryHistoryMigrationResponse
  - `message` string
  - `starredCount` integer
  - `totalCount` integer

## Other responses

- `400` — BadRequestError is returned when the request is invalid and it cannot be processed.
- `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)
