Authentication

Download InfluxDB API Spec

Authentication is disabled by default in InfluxDB v1. When disabled, the database accepts any request without checking credentials—supplied credentials are silently ignored. When enabled, every HTTP request must include valid credentials.

Use one of the following schemes to authenticate to the InfluxDB v1 API:

  • Basic authentication
  • Query string authentication
  • Token authentication

Basic Authentication

Use HTTP Basic Authentication by including your username and password in the request.

curl -u username:password "http://localhost:8086/query?q=SHOW+DATABASES"

Or encode credentials in the URL (not recommended for production):

curl "http://username:password@localhost:8086/query?q=SHOW+DATABASES"

Query String Authentication

Pass your credentials as query parameters. Use u for username and p for password.

curl "http://localhost:8086/query?u=username&p=password&q=SHOW+DATABASES"

Query string authentication exposes credentials in URLs and server logs. Use Basic Authentication or Token Authentication for production environments.

Token Authentication

For v2-compatible endpoints (/api/v2/*), use the Authorization header with the Token scheme.

Include your InfluxDB 1.x username and password separated by a colon:

curl -H "Authorization: Token username:password" \
  "http://localhost:8086/api/v2/query"

This format is compatible with InfluxDB 2.x client libraries, allowing you to use the same code with both InfluxDB 1.8+ and InfluxDB 2.x.


Was this page helpful?

Thank you for your feedback!