Documentation

/query 1.x compatibility API

This page documents an earlier version of InfluxDB OSS. InfluxDB 3 Core is the latest stable version.

API token hashing is enabled by default in InfluxDB OSS 2.9.0

Stronger token security: tokens are stored as hashes on disk, so a copy of the database file doesn’t expose usable tokens. Existing tokens are hashed on first startup and the original strings can’t be recovered afterward — capture any plaintext tokens you still need before you upgrade.

For more information, see Token hashing.

The /query 1.x compatibility endpoint queries InfluxDB 2.9 using InfluxQL. Send an InfluxQL query in an HTTP GET or POST request to query data from the /query endpoint.

The /query compatibility endpoint uses the database and retention policy specified in the query request to map the request to an InfluxDB bucket. For more information, see Database and retention policy mapping.

Authentication

Use one of the following authentication methods:

  • the 2.x Authorization: Token scheme in the header
  • the v1-compatible u and p query string parameters
  • the v1-compatible Basic authentication scheme in the header

For more information, see Authentication for the 1.x compatibility API.

Query string parameters

u

(Optional) The 1.x username to authenticate the request. If you provide an API token as the password, u is required, but can be any value. See query string authentication.

p

(Optional) The 1.x password or the 2.x API token to authenticate the request. See query string authentication.

db

(Required) The database to query data from. This is mapped to an InfluxDB bucket. See Database and retention policy mapping.

rp

The retention policy to query data from. This is mapped to an InfluxDB bucket. See Database and retention policy mapping.

q

(Required) The InfluxQL query to execute. To execute multiple queries, delimit queries with a semicolon (;).

epoch

Return results with Unix timestamps (also known as epoch timestamps) in the specified precision instead of RFC3339 timestamps with nanosecond precision. The following precisions are available:

  • ns - nanoseconds
  • u or µ - microseconds
  • ms - milliseconds
  • s - seconds
  • m - minutes
  • h - hours

Query examples

Query using basic authentication

The following example:

  • sends a GET request to the /query endpoint
  • uses the Authorization header with the Basic scheme (compatible with InfluxDB 1.x) to provide username and password credentials
  • uses the default retention policy for the database
##############################################################################
# Use Basic authentication with an
# InfluxDB v1-compatible username and password
# to query the InfluxDB 1.x compatibility API.
#
# 
INFLUX_USERNAME
: your v1-compatible username.
#
INFLUX_PASSWORD_OR_TOKEN
: your API token or v1-compatible password.
############################################################################## curl --get "http://localhost:8086/query" \ --user "
INFLUX_USERNAME
:
INFLUX_PASSWORD_OR_TOKEN
"
\
--data-urlencode "db=BUCKET_NAME" \ --data-urlencode "q=SELECT * FROM cpu_usage"
Query using an HTTP POST request
curl \
  --request POST \
  "http://localhost:8086/query?db=DATABASE_NAME&rp=RETENTION_POLICY" \
  --user "
INFLUX_USERNAME
:
INFLUX_PASSWORD_OR_TOKEN
"
\
--header "Content-type: application/vnd.influxql" \ --data "SELECT * FROM cpu_usage WHERE time > now() - 1h"
Query a non-default retention policy

The following example:

  • sends a GET request to the /query endpoint
  • uses the Authorization header with the Token scheme (compatible with InfluxDB 2.x) to provide the API token
  • queries a custom retention policy mapped for the database
curl --get http://localhost:8086/query \
  --header "Authorization: Token 
API_TOKEN
"
\
--data-urlencode "db=DATABASE_NAME" \ --data-urlencode "rp=RETENTION_POLICY_NAME" \ --data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1"
Execute multiple queries
curl --get http://localhost:8086/query \
  --header "Authorization: Token 
API_TOKEN
"
\
--data-urlencode "db=DATABASE_NAME" \ --data-urlencode "q=SELECT * FROM mem WHERE host=host1;SELECT mean(used_percent) FROM mem WHERE host=host1 GROUP BY time(10m)"
Return query results with millisecond Unix timestamps
curl --get http://localhost:8086/query \
  --header "Authorization: Token 
API_TOKEN
"
\
--data-urlencode "db=DATABASE_NAME" \ --data-urlencode "rp=RETENTION_POLICY_NAME" \ --data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1" \ --data-urlencode "epoch=ms"
Execute InfluxQL queries from a file
curl --get http://localhost:8086/query \
  --header "Authorization: Token 
API_TOKEN
"
\
--data-urlencode "db=DATABASE_NAME" \ --data-urlencode "q@path/to/influxql.txt"
Return a gzip-compressed response
curl --get http://localhost:8086/query \
  --header 'Accept-Encoding: gzip' \
  --header "Authorization: Token 
API_TOKEN
"
\
--data-urlencode "db=DATABASE_NAME" \ --data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1"

Replace the following:

  • API_TOKEN: your InfluxDB API token
  • DATABASE_NAME: the name of the database to query. In InfluxDB 2.x, databases and retention policies map to buckets.
  • RETENTION_POLICY_NAME: the name of the retention policy to query. In InfluxDB 2.x, databases and retention policies map to buckets.

For more information about the database and retention policy mapping, see Database and retention policy mapping.


Was this page helpful?

Thank you for your feedback!


InfluxDB OSS 2.9.0: API tokens are hashed by default

Stronger token security in InfluxDB OSS 2.9.0 — tokens are hashed on disk by default. Existing tokens are hashed on first startup and can’t be recovered afterward. Capture any plaintext tokens you still need before you upgrade.

View InfluxDB OSS 2.9.0 release notes

Hashed tokens authenticate exactly like unhashed tokens — clients and integrations keep working.

Also new in 2.9.0:

  • Configurable backup compression
  • Restore support for backups containing hashed tokens
  • Tighter Edge Data Replication queue validation
  • Flux upgrade
  • Compaction reliability improvements

Key enhancements in Explorer 1.8

Explorer 1.8 is now available with streaming data subscriptions (beta), line protocol preview, and query history & saved queries.

View Explorer 1.8 release notes

Explorer 1.8 includes new features and improvements that make it easier to ingest, explore, and manage data.

Highlights:

  • Streaming data subscriptions (beta): Stream data into Explorer from MQTT, Kafka, and AMQP sources.
  • Line protocol preview: Preview line protocol, schema, and parse errors before data is written.
  • Custom sample data: Generate custom sample datasets with line protocol and schema preview.
  • Query history and saved queries: Browse query history and save/re-run named queries.
  • Retention period management: Set, update, or clear retention periods on databases and tables.

For more details, see Explorer 1.8 release notes

InfluxDB 3.9: Performance upgrade preview

InfluxDB 3 Enterprise 3.9 includes a beta of major performance upgrades with faster single-series queries, wide-and-sparse table support, and more.

InfluxDB 3 Enterprise 3.9 includes a beta of major performance and feature updates.

Key improvements:

  • Faster single-series queries
  • Consistent resource usage
  • Wide-and-sparse table support
  • Automatic distinct value caches for reduced latency with metadata queries

Preview features are subject to breaking changes.

For more information, see:

Telegraf Enterprise now in public beta

Get early access to the Telegraf Controller and provide feedback to help shape the future of Telegraf Enterprise.

See the Blog Post

The upcoming Telegraf Enterprise offering is for organizations running Telegraf at scale and is comprised of two key components:

  • Telegraf Controller: A control plane (UI + API) that centralizes Telegraf configuration management and agent health visibility.
  • Telegraf Enterprise Support: Official support for Telegraf Controller and Telegraf plugins.

Join the Telegraf Enterprise beta to get early access to the Telegraf Controller and provide feedback to help shape the future of Telegraf Enterprise.

For more information:

Telegraf Controller v0.0.7-beta now available

Telegraf Controller v0.0.7-beta is now available with new features, improvements, bug fixes, and an important breaking change.

View the release notes
Download Telegraf Controller v0.0.7-beta

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On May 27, 2026, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2