Write

Write time series data to InfluxDB Enterprise v1 in line protocol format using the /write endpoint.
POST /write

Write data

Write time series data to InfluxDB Enterprise using line protocol format.

Data must be sent as binary encoded line protocol in the request body. Use the --data-binary flag with curl to preserve newlines.

Enterprise write consistency

In a cluster, the consistency query parameter controls when /write returns success based on how many data nodes have acknowledged a write.

ValueReturns success when…
anyAny node acknowledges the write, or the receiving node queues it for hinted handoff.
one (default)Any node acknowledges the write (hinted handoff alone does not count).
quorumA majority of replicas acknowledge the write. Equivalent to all when replication factor ≤ 2.
allAll replicas acknowledge the write.

For replication-factor interactions and recovery semantics, see Write consistency.

Best Practices:

  • Write points in batches of 5,000 to 10,000 for optimal performance
  • Use the least precise timestamp precision possible for better compression

Parameters

Query parameters
db required string
Target database for the write
rp string
Target retention policy. If not specified, writes to the default retention policy.
precision string
Timestamp precision. InfluxDB assumes nanoseconds if not specified.
Allowed values: n , u , ms , s , m , h
Default: n
consistency string
Enterprise only. Sets the write consistency for the point. See write consistency documentation for detailed descriptions of each option.
Allowed values: any , one , quorum , all
Default: one
u string
Username for authentication
p string
Password for authentication

Request body required

Line protocol data. Multiple points should be separated by newlines. Use @filename to write from a file.
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 successful
400 Bad request (line protocol syntax error or type conflict)
error required string
Error message
401 Unauthorized
error required string
Error message
404 Database not found
error required string
Error message
413 Request entity too large
error required string
Error message
500 Internal server error (e.g., retention policy not found)
error required string
Error message
POST /api/v2/write v2

Write data (v2 compatible)

Write data using the InfluxDB 2.x API format. This endpoint provides forward compatibility with InfluxDB 2.x client libraries.

Bucket Mapping: The bucket parameter maps to InfluxDB 1.x database and retention policy:

  • database/retention-policy - specific retention policy
  • database/ or database - default retention policy

The org parameter is ignored in InfluxDB Enterprise 1.x.

Parameters

Query parameters
bucket required string
Database and retention policy in format database/retention-policy. Use database/ or database for the default retention policy.
org string
Organization (ignored in InfluxDB Enterprise 1.x)
precision string
Timestamp precision
Allowed values: ns , us , ms , s
Default: ns

Request body required

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

Responses

204 Write successful
400 Bad request
error required string
Error message
401 Unauthorized
error required string
Error message

Was this page helpful?

Thank you for your feedback!