---
title: "DataSource query metrics with expressions."
method: POST
path: "/ds/query"
tags: ["datasources"]
---

# DataSource query metrics with expressions.

`POST /ds/query`

If you are running Grafana Enterprise and have Fine-grained access control enabled
you need to have a permission with action: `datasources:query`.

## Request body

- MetricRequest
  - `debug` boolean
  - `from` string, required — From Start time in epoch timestamps in milliseconds or relative using Grafana time units.
  - `queries` Json[], required — queries.refId – Specifies an identifier of the query. Is optional and default to “A”. queries.datasourceId – Specifies the data source to be queried. Each query in the request must have an unique datasourceId. queries.maxDataPoints - Species maximum amount of data points that dashboard panel can render. Is optional and default to 100. queries.intervalMs - Specifies the time interval in milliseconds of time series. Is optional and defaults to 1000.
  - `to` string, required — To End time in epoch timestamps in milliseconds or relative using Grafana time units.

## Response `200`

(empty)

- QueryDataResponse — It is the return type of a QueryData call.
  - `results` Responses — The QueryData method the QueryDataHandler method will set the RefId property on the DataResponses' frames based on these RefIDs.

## Other responses

- `207` — (empty)
- `400` — BadRequestError is returned when the request is invalid and it cannot be processed.
- `401` — UnauthorizedError is returned when the request is not authenticated.
- `403` — ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
- `500` — InternalServerError is a general error indicating something went wrong internally.

---

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