Documentation

Use the InfluxDB v1 HTTP query API and InfluxQL to query data

Limited availability

InfluxDB Clustered is currently only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.

Use the InfluxDB v1 HTTP query API to query data in InfluxDB Clustered with InfluxQL.

The examples below use cURL to send HTTP requests to the InfluxDB v1 HTTP API, but you can use any HTTP client.

InfluxQL feature support

InfluxQL is being rearchitected to work with the InfluxDB v3 storage engine. This process is ongoing and some InfluxQL features are still being implemented. For information about the current implementation status of InfluxQL features, see InfluxQL feature support.

Use the v1 /query endpoint and the GET request method to query data with InfluxQL:

GET https://cluster-host.com/query

Provide the following with your request:

  • Headers:
    • Authorization: Bearer DATABASE_TOKEN
  • Query parameters:
    • db: the database to query
    • rp: Optional: the retention policy to query
    • q: URL-encoded InfluxQL query
curl --get https://cluster-host.com/query \
  --header "Authorization: Bearer 
DATABASE_TOKEN
"
\
--data-urlencode "db=
DATABASE_NAME
"
\
--data-urlencode "q=SELECT * FROM home"

Replace the following configuration values:

  • DATABASE_NAME: the name of the database to query.
  • DATABASE_TOKEN: a database token with read access to the specified database.

Authenticate with username and password

If using basic authentication or query string authentication (username and password) to interact with the v1 HTTP query API, provide the following credentials:

  • username: an arbitrary string (InfluxDB Clustered ignores the username)
  • password: a database token with read access to the specified database.
curl --get https://cluster-host.com/query \
  --header "Authorization: Basic ignored:
DATABASE_TOKEN
"
\
--data-urlencode "db=
DATABASE_NAME
"
\
--data-urlencode "q=SELECT * FROM home"
curl --get https://cluster-host.com/query \
  --data-urlencode "u=ignored" \
  --data-urlencode "p=
DATABASE_TOKEN
"
\
--data-urlencode "db=
DATABASE_NAME
"
\
--data-urlencode "q=SELECT * FROM home"

Return results as JSON or CSV

By default, the /query endpoint returns results in JSON, but it can also return results in CSV. To return results as CSV, include the Accept header with the application/csv or text/csv MIME type:

curl --get https://cluster-host.com/query \
  --header "Authorization: Token 
DATABASE_TOKEN
"
\
--header "Accept: application/csv" \ --data-urlencode "db=
DATABASE_NAME
"
\
--data-urlencode "q=SELECT * FROM home"

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following: