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/jsoncurl --request GET \
"https://localhost:8181/api/v3/query_influxql?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/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/jsoncurl --request GET \
"https://localhost:8181/api/v3/query_sql?db=DB&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/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/api/v3/query_sql_telemetryGet query telemetry (beta)
Returns detailed execution statistics for the most recent SQL query, including per-chunk I/O, cache hit rates, and timing breakdowns.
Use this endpoint after executing a query to analyze performance.
Beta: This endpoint requires the performance upgrade preview (
--use-pacha-treeflag). The performance upgrade preview is a beta feature and should not be used for production workloads.
For more information, see Query telemetry.
curl --request GET \
"https://localhost:8181/api/v3/query_sql_telemetry" \
--header "Authorization: Bearer INFLUX_TOKEN"Responses
cache_stats
objectcompacted_hits
integercompacted_misses
integergen0_hits
integergen0_misses
integerchunks
object[]blocks_processed
integerbytes_read
integerchunk_id
stringfiles_scanned
integerrows_read
integerrows_returned
integerexecution_time_us
integerquery_id
stringdata
objecterror
string/api/v3/query_sql_telemetryGet query telemetry (beta)
Returns detailed execution statistics for the most recent SQL query, including per-chunk I/O, cache hit rates, and timing breakdowns.
Use this endpoint after executing a query to analyze performance.
Beta: This endpoint requires the performance upgrade preview (
--use-pacha-treeflag). The performance upgrade preview is a beta feature and should not be used for production workloads.
For more information, see Query telemetry.
curl --request POST \
"https://localhost:8181/api/v3/query_sql_telemetry" \
--header "Authorization: Bearer INFLUX_TOKEN"Responses
data
objecterror
string/query
v1Execute 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/query
v1Execute InfluxQL query (v1-compatible)
Executes an InfluxQL query to retrieve data from the specified database.
Related
Parameters
Header 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/jsonRequest body
application/jsonchunk_size
integerchunked=true.10000chunked
booleanchunk_size.db
stringepoch
stringA unix timestamp precision.
hfor hoursmfor minutessfor secondsmsfor millisecondsuorµfor microsecondsnsfor nanoseconds
Formats timestamps as unix (epoch) timestamps with the specified precision instead of RFC3339 timestamps with nanosecond precision.
ns
, u
, µ
, ms
, s
, m
, hpretty
booleanq
required
stringcurl --request POST \
"https://localhost:8181/query" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"chunk_size": 10000,
"chunked": false,
"db": "DB",
"epoch": "ns",
"pretty": false,
"q": "Q"
}'Responses
results
object[]{
"results": [
{
"series": [
{
"columns": [
"time",
"value"
],
"name": "mytable",
"values": [
[
"2024-02-02T12:00:00Z",
42
]
]
}
]
}
]
}data
objecterror
stringWas this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB 3 Enterprise and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support. Customers using a trial license can email trial@influxdata.com for assistance.