Query

Download InfluxDB API Spec
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 required string
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
curl --request GET \
  "http://localhost:8086/query?q=Q" \
  --header "Authorization: Bearer INFLUX_TOKEN"

Responses

200 Query executed successfully
results object[]
error string
series object[]
statement_id integer
400 Bad request (syntax error in query)
error required string
Error message
401 Unauthorized
error required string
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 body required

Content-Type: application/json
Example request Ask AI about this
curl --request POST \
  "http://localhost:8086/query" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/x-www-form-urlencoded"

Responses

200 Query executed successfully
results object[]
error string
series object[]
statement_id integer
400 Bad request
error required string
Error message
401 Unauthorized
error required string
Error message
POST /api/v2/query v2

Query with Flux (v2 compatible)

Query data using 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 body required

Content-Type: application/json
Example request Ask AI about this
curl --request POST \
  "http://localhost:8086/api/v2/query" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/vnd.flux"

Responses

200 Query results in CSV format
401 Unauthorized
error required string
Error message

Was this page helpful?

Thank you for your feedback!