Write data (v1-compatible)

Download InfluxDB API Spec
Write data to InfluxDB OSS v2 using the v1-compatible /write endpoint with line protocol.
POST /write

Write data using a v1-compatible request

Writes data in line protocol syntax to the specified bucket using a v1-compatible request.

This endpoint provides backward compatibility for InfluxDB 1.x write workloads using tools such as InfluxDB 1.x client libraries, the Telegraf outputs.influxdb output plugin, or third-party tools.

Use query parameters to specify options for writing data.

InfluxDB Cloud

  • Validates and queues the request.
  • Handles the write asynchronously - the write might not have completed yet.
  • Returns a Retry-After header that describes when to try the write again.

InfluxDB OSS v2

  • Validates the request and handles the write synchronously.
  • If all points were written successfully, responds with HTTP 2xx status code
  • If any points were rejected, responds with HTTP 4xx status code and details about the problem.

Parameters

Query parameters
u string
The InfluxDB 1.x username to authenticate the request.
p string
The InfluxDB 1.x password to authenticate the request.
db required string
Bucket to write to. If none exists, InfluxDB creates a bucket with a default 3-day retention policy.
rp string
Retention policy name.
precision string
Write precision.
Header parameters
Zap-Trace-Span string
OpenTracing span context
Content-Encoding string
When present, its value indicates to the database that compression is applied to the line protocol body.
Allowed values: gzip , identity
Default: identity

Request body required

Line protocol body
Content-Type: application/json
Example request Ask AI about this
curl --request POST \
  "http://localhost:8086/write?db=DB" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: text/plain" \
  --data-raw 'measurement,tag=value field=1.0'

Responses

204 Write data is correctly formatted and accepted for writing to the bucket.
400 Line protocol is poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol.
code required string
Code is the machine-readable error code.
Allowed: internal error , not found , conflict , invalid , empty value , unavailable
err string
Stack of errors that occurred during processing of the request. Useful for debugging.
line integer <int32>
First line in the request body that contains malformed data.
message string
Human-readable message.
op string
Describes the logical code operation when the error occurred. Useful for debugging.
401 Token doesn’t have sufficient permissions to write to this organization and bucket or the organization and bucket do not exist.
code required string
code is the machine-readable error code.
Allowed: internal error , not implemented , not found , conflict , invalid , unprocessable entity , empty value , unavailable , forbidden , too many requests , unauthorized , method not allowed , request too large , unsupported media type
err string
Stack of errors that occurred during processing of the request. Useful for debugging.
message string
Human-readable message.
op string
Describes the logical code operation when the error occurred. Useful for debugging.
403 The request didn’t provide an authorization token.
code required string
code is the machine-readable error code.
Allowed: internal error , not implemented , not found , conflict , invalid , unprocessable entity , empty value , unavailable , forbidden , too many requests , unauthorized , method not allowed , request too large , unsupported media type
err string
Stack of errors that occurred during processing of the request. Useful for debugging.
message string
Human-readable message.
op string
Describes the logical code operation when the error occurred. Useful for debugging.
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.
code required string
Code is the machine-readable error code.
Allowed: invalid
message required string
Human-readable message.
422 The request was well-formed, but some points were rejected due to semantic errors–for example, schema conflicts or retention policy violations. Error message contains details for one or more rejected points.
code required string
code is the machine-readable error code.
Allowed: internal error , not implemented , not found , conflict , invalid , unprocessable entity , empty value , unavailable , forbidden , too many requests , unauthorized , method not allowed , request too large , unsupported media type
err string
Stack of errors that occurred during processing of the request. Useful for debugging.
message string
Human-readable message.
op string
Describes the logical code operation when the error occurred. Useful for debugging.
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
code required string
code is the machine-readable error code.
Allowed: internal error , not implemented , not found , conflict , invalid , unprocessable entity , empty value , unavailable , forbidden , too many requests , unauthorized , method not allowed , request too large , unsupported media type
err string
Stack of errors that occurred during processing of the request. Useful for debugging.
message string
Human-readable message.
op string
Describes the logical code operation when the error occurred. Useful for debugging.

Was this page helpful?

Thank you for your feedback!