---
title: Query
description: Query data using InfluxQL via the /query endpoint, supporting both read queries (SELECT, SHOW) and management queries (CREATE, DROP, ALTER).
url: https://docs.influxdata.com/enterprise_influxdb/v1/api/query/
estimated_tokens: 901
publisher: InfluxData
canonical: https://docs.influxdata.com/enterprise_influxdb/v1/api/query/
---

[Download InfluxDB Enterprise v1 API Spec](/openapi/influxdb-enterprise-v1-openapi.yml)

Query data using InfluxQL via the `/query` endpoint, supporting both read queries (SELECT, SHOW) and management queries (CREATE, DROP, ALTER).

GET`/query`

### Query data (GET)

Query data using InfluxQL. Use GET for read-only queries that start with:

* `SELECT` (except queries with `INTO` clause)
* `SHOW`

For write operations (CREATE, DROP, ALTER, etc.), use POST.

#### Parameters

##### Query parameters

`db`string

Target database for the query

`q`requiredstring

InfluxQL query string

`epoch`string

Return timestamps as Unix epoch values with specified precision.
By default, timestamps are returned in RFC3339 format.

Allowed values:`ns`, `u`, `µ`, `ms`, `s`, `m`, `h`

`pretty`boolean

Enable pretty-printed JSON output (not recommended for production)

`chunked`string

Return results in streamed batches. Set to `true` to chunk by series
or every 10,000 points. Set to a number to chunk by that many points.

`u`string

Username for authentication

`p`string

Password for authentication

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "http://localhost:8086/query?q=Q" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200Query executed successfully

`results`object[]

`error`string

`series`object[]

`statement_id`integer

400Bad request (syntax error in query)

`error`requiredstring

Error message

401Unauthorized

`error`requiredstring

Error message

POST`/query`

### Query data (POST)

Query data or execute database management commands using InfluxQL.
Use POST for queries that start with:

* `SELECT` with `INTO` clause
* `ALTER`
* `CREATE`
* `DELETE`
* `DROP`
* `GRANT`
* `KILL`
* `REVOKE`

#### Parameters

##### Query parameters

`db`string

Target database for the query

`epoch`string

Return timestamps as Unix epoch values with specified precision.
By default, timestamps are returned in RFC3339 format.

Allowed values:`ns`, `u`, `µ`, `ms`, `s`, `m`, `h`

`pretty`boolean

Enable pretty-printed JSON output (not recommended for production)

`chunked`string

Return results in streamed batches. Set to `true` to chunk by series
or every 10,000 points. Set to a number to chunk by that many points.

`u`string

Username for authentication

`p`string

Password for authentication

#### Request bodyrequired

Content-Type:`application/json`

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/query" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/x-www-form-urlencoded"
```

#### Responses

200Query executed successfully

`results`object[]

`error`string

`series`object[]

`statement_id`integer

400Bad request

`error`requiredstring

Error message

401Unauthorized

`error`requiredstring

Error message

POST`/api/v2/query`v2

### Query with Flux (v2 compatible)

Query data using [Flux](/enterprise_influxdb/v1/flux/) language.
This endpoint provides forward compatibility with InfluxDB 2.x client libraries.

**Required Headers:**

* `Accept: application/csv`
* `Content-type: application/vnd.flux`
* `Authorization: Token username:password` (if authentication is enabled)

#### Request bodyrequired

Content-Type:`application/json`

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/query" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/vnd.flux"
```

#### Responses

200Query results in CSV format

401Unauthorized

`error`requiredstring

Error message
