InfluxDB v1 HTTP API for InfluxDB v2 OSS
License: MIT
The InfluxDB v1 compatibility API provides a programmatic interface for interactions with InfluxDB v2 using InfluxDB v1-compatible endpoints.
The InfluxDB 1.x compatibility /write and /query endpoints work with InfluxDB 1.x client libraries and third-party integrations like Grafana and others.
This documentation is generated from the InfluxDB OpenAPI specification.
Authentication
The InfluxDB 1.x API requires authentication for all requests. InfluxDB Cloud uses InfluxDB API tokens to authenticate requests.
For more information, see the following:
TokenAuthentication
Use the Token authentication scheme to authenticate to the InfluxDB API.
In your API requests, send an Authorization
header. For the header value, provide the word Token
followed by a space and an InfluxDB API token. The word Token
is case-sensitive.
Syntax
Authorization: Token YOUR_INFLUX_TOKEN
For examples and more information, see the following:
Security Scheme Type | API Key |
---|---|
Header parameter name: | Authorization |
BasicAuthentication
Use the HTTP Basic authentication scheme with clients that support the InfluxDB 1.x convention of username and password (that don’t support the Authorization: Token
scheme):
For examples and more information, see how to authenticate with a username and password.
Security Scheme Type | HTTP |
---|---|
HTTP Authorization Scheme | basic |
QuerystringAuthentication
Use the Querystring authentication scheme with InfluxDB 1.x API parameters to provide credentials through the query string.
For examples and more information, see how to authenticate with a username and password.
Security Scheme Type | API Key |
---|---|
Query parameter name: | u=&p= |
Query
Query using the InfluxDB v1 HTTP API
Authorizations:
TokenAuthenticationBasicAuthenticationQuerystringAuthentication
query Parameters
db required | string Bucket to query. |
p | string User token. |
q | string Defines the influxql query to run. |
rp | string Retention policy name. |
u | string Username. |
header Parameters
Accept | string Default: application/json Enum: “application/json” “application/csv” “text/csv” “application/x-msgpack” Specifies how query results should be encoded in the response. Note: With |
Accept-Encoding | string Default: identity Enum: “gzip” “identity” The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand. |
Content-Type | string Value: “application/vnd.influxql” |
Zap-Trace-Span | string Example: trace_id,1,span_id,1,baggage,[object Object] OpenTracing span context |
Request Body schema: text/plain
InfluxQL query to execute.
string
Responses
200
Query results
429
Token is temporarily over quota. The Retry-After header describes when to try the read again.
default
Error processing query
post/query
/query
Response samples
- 200
- default
Content type
application/csv
application/csv
text/csv
application/json
application/x-msgpack
No sample
Write
Write time series data into InfluxDB in a V1-compatible format
Authorizations:
TokenAuthenticationBasicAuthenticationQuerystringAuthentication
query Parameters
db required | string Bucket to write to. If none exists, InfluxDB creates a bucket with a default 3-day retention policy. |
p | string User token. |
precision | string Write precision. |
rp | string Retention policy name. |
u | string Username. |
header Parameters
Content-Encoding | string Default: identity Enum: “gzip” “identity” When present, its value indicates to the database that compression is applied to the line protocol body. |
Zap-Trace-Span | string Example: trace_id,1,span_id,1,baggage,[object Object] OpenTracing span context |
Request Body schema: text/plain
Line protocol body
string
Responses
204
Write data is correctly formatted and accepted for writing to the bucket.
400
Line protocol poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol. All data in body was rejected and not written.
401
Token does not have sufficient permissions to write to this organization and bucket or the organization and bucket do not exist.
403
No token was sent and they are required.
413
Write has been rejected because the payload is too large. Error message returns max size supported. All data in body was rejected and not written.
429
Token is temporarily over quota. The Retry-After header describes when to try the write again.
503
Server is temporarily unavailable to accept writes. The Retry-After header describes when to try the write again.
default
Internal server error
post/write
/write
Response samples
- 400
- 401
- 403
- 413
- default
Content type
application/json
Copy
Expand all Collapse all
{ - "code": "internal error", - "message": "string", - "op": "string", - "err": "string", - "line": 0 }