Query data
/api/v3/query_influxqlExecute InfluxQL query
Executes an InfluxQL query to retrieve data from the specified database.
With the performance upgrade preview enabled
(--use-pacha-tree flag), queries automatically merge results from Parquet and
.pt files (hybrid query mode).
Parameters
Query parameters
db
stringThe name of the database.
If you provide a query that specifies the database, you can omit the ‘db’ parameter from your request.
q
required
stringformat
stringparams
stringHeader parameters
Accept
stringapplication/json
, application/jsonl
, application/vnd.apache.parquet
, text/csvapplication/jsonRequest body required
application/jsoncurl --request GET \
"https://localhost:8181/api/v3/query_influxql?q=Q" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json"Responses
results
object[]{
"results": [
{
"series": [
{
"columns": [
"time",
"value"
],
"name": "mytable",
"values": [
[
"2024-02-02T12:00:00Z",
42
]
]
}
]
}
]
}data
objecterror
string/api/v3/query_influxqlExecute InfluxQL query
Executes an InfluxQL query to retrieve data from the specified database.
With the performance upgrade preview enabled
(--use-pacha-tree flag), queries automatically merge results from Parquet and
.pt files (hybrid query mode).
Parameters
Header parameters
Accept
stringapplication/json
, application/jsonl
, application/vnd.apache.parquet
, text/csvapplication/jsonContent-Type
stringapplication/jsonRequest body
application/jsoncurl --request POST \
"https://localhost:8181/api/v3/query_influxql" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{"db":"mydb","format":"json","params":{},"q":"SELECT * FROM mytable"}'Responses
results
object[]{
"results": [
{
"series": [
{
"columns": [
"time",
"value"
],
"name": "mytable",
"values": [
[
"2024-02-02T12:00:00Z",
42
]
]
}
]
}
]
}data
objecterror
string/api/v3/query_sqlExecute SQL query
Executes an SQL query to retrieve data from the specified database.
With the performance upgrade preview enabled
(--use-pacha-tree flag), queries automatically merge results from Parquet and
.pt files (hybrid query mode). Use the
/api/v3/query_sql_telemetry endpoint after executing
a query to retrieve detailed execution statistics.
Parameters
Query parameters
db
required
stringq
required
string <SQL>format
stringparams
stringHeader parameters
Accept
stringapplication/json
, application/jsonl
, application/vnd.apache.parquet
, text/csvapplication/jsonContent-Type
stringapplication/jsonRequest body required
application/jsoncurl --request GET \
"https://localhost:8181/api/v3/query_sql?db=DB&q=Q" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json"Responses
results
object[]{
"results": [
{
"series": [
{
"columns": [
"time",
"value"
],
"name": "mytable",
"values": [
[
"2024-02-02T12:00:00Z",
42
]
]
}
]
}
]
}data
objecterror
string/api/v3/query_sqlExecute SQL query
Executes an SQL query to retrieve data from the specified database.
With the performance upgrade preview enabled
(--use-pacha-tree flag), queries automatically merge results from Parquet and
.pt files (hybrid query mode). Use the
/api/v3/query_sql_telemetry endpoint after executing
a query to retrieve detailed execution statistics.
Parameters
Header parameters
Accept
stringapplication/json
, application/jsonl
, application/vnd.apache.parquet
, text/csvapplication/jsonContent-Type
stringapplication/jsonRequest body
application/jsoncurl --request POST \
"https://localhost:8181/api/v3/query_sql" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{"db":"mydb","format":"json","params":{},"q":"SELECT * FROM mytable"}'Responses
results
object[]{
"results": [
{
"series": [
{
"columns": [
"time",
"value"
],
"name": "mytable",
"values": [
[
"2024-02-02T12:00:00Z",
42
]
]
}
]
}
]
}data
objecterror
string/queryExecute InfluxQL query (v1-compatible)
Executes an InfluxQL query to retrieve data from the specified database.
This endpoint is compatible with InfluxDB 1.x client libraries and third-party integrations such as Grafana. Use query parameters to specify the database and the InfluxQL query.
Related
Parameters
Query parameters
chunked
booleanchunk_size.chunk_size
integerchunked=true.10000db
string <InfluxQL>pretty
booleanq
required
stringepoch
stringu
stringp
stringp value is an authorized token.rp
stringHeader parameters
Accept
stringThe content type that the client can understand.
If text/csv is specified, the Content-type response header is application/csv and the response is formatted as CSV.
Returns an error if the format is invalid or non-UTF8.
application/json
, application/csv
, text/csvapplication/jsonAuthorization
stringAuthorization header for token-based authentication. Supported schemes:
Bearer AUTH_TOKEN- OAuth bearer token schemeToken AUTH_TOKEN- InfluxDB v2 token schemeBasic <base64-encoded USERNAME:AUTH_TOKEN>- Basic authentication (username is ignored)
curl --request GET \
"https://localhost:8181/query?q=Q" \
--header "Authorization: Bearer INFLUX_TOKEN"Responses
results
object[]{
"results": [
{
"series": [
{
"columns": [
"time",
"value"
],
"name": "mytable",
"values": [
[
"2024-02-02T12:00:00Z",
42
]
]
}
]
}
]
}data
objecterror
string/queryExecute InfluxQL query (v1-compatible)
Executes an InfluxQL query to retrieve data from the specified database.