Query data
/api/v3/query_influxqlExecute InfluxQL query
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
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
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
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/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 Core and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.