Write data

Write data to InfluxDB 3 Core using line protocol format.

Timestamp precision across write APIs

InfluxDB 3 provides multiple write endpoints for compatibility with different InfluxDB versions. The following table compares timestamp precision support across v1, v2, and v3 write APIs:

Precisionv1 (/write)v2 (/api/v2/write)v3 (/api/v3/write_lp)
Auto detection❌ No❌ Noauto (default)
Secondssssecond
Millisecondsmsmsmillisecond
Microsecondsu or µusmicrosecond
Nanosecondsnsnsnanosecond
Minutesm❌ No❌ No
Hoursh❌ No❌ No
DefaultNanosecondNanosecondAuto (guessed)

All timestamps are stored internally as nanoseconds.

POST /api/v3/write_lp

Write line protocol

Writes line protocol to the specified database.

This is the native InfluxDB 3 Core write endpoint that provides enhanced control over write behavior with advanced parameters for high-performance and fault-tolerant operations.

Use this endpoint to send data in line protocol format to InfluxDB. Use query parameters to specify options for writing data.

Features

  • Partial writes: Use accept_partial=true to allow partial success when some lines in a batch fail
  • Asynchronous writes: Use no_sync=true to skip waiting for WAL synchronization, allowing faster response times but sacrificing durability guarantees
  • Flexible precision: Automatic timestamp precision detection with precision=auto (default)

Auto precision detection

When you use precision=auto or omit the precision parameter, InfluxDB 3 automatically detects the timestamp precision based on the magnitude of the timestamp value:

  • Timestamps < 5e9 → Second precision (multiplied by 1,000,000,000 to convert to nanoseconds)
  • Timestamps < 5e12 → Millisecond precision (multiplied by 1,000,000)
  • Timestamps < 5e15 → Microsecond precision (multiplied by 1,000)
  • Larger timestamps → Nanosecond precision (no conversion needed)

Parameters

Query parameters
db required string
The name of the database. InfluxDB creates the database if it doesn’t already exist, and then writes all points in the batch to the database.
accept_partial string
precision string
The precision for unix timestamps in the line protocol batch.
no_sync string
Header parameters
Content-Type string
The content type of the request payload.
Accept string
The content type that the client can understand. Writes only return a response body if they fail (partially or completely)–for example, due to a syntax problem or type mismatch.
Allowed values: application/json
Default: application/json
Content-Encoding string
The compression applied to the line protocol in the request payload. To send a gzip payload, pass Content-Encoding: gzip header.
Content-Length string
The size of the entity-body, in bytes, sent to InfluxDB.

Request body

Content-Type: application/json
Example request Ask AI about this
curl --request POST \
  "https://localhost:8181/api/v3/write_lp?db=DB" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: text/plain" \
  --data-raw 'measurement,tag=value field=1 1234567890'

Responses

204 Success (“No Content”). All data in the batch is written and queryable.
400 Bad request.
401 Unauthorized access.
data object
error string
403 Access denied.
413 Request entity too large.
422 Unprocessable entity.
POST /api/v2/write v2

Write line protocol (v2-compatible)

Writes line protocol to the specified database.

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

Use this endpoint to send data in line protocol format to InfluxDB. Use query parameters to specify options for writing data.

Parameters

Query parameters
bucket required string

A database name. InfluxDB creates the database if it doesn’t already exist, and then writes all points in the batch to the database.

This parameter is named bucket for compatibility with InfluxDB v2 client libraries.

accept_partial string
precision string
The precision for unix timestamps in the line protocol batch.
Header parameters
Content-Type string
The content type of the request payload.
Content-Encoding string
The compression applied to the line protocol in the request payload. To send a gzip payload, pass Content-Encoding: gzip header.
Allowed values: gzip , identity
Default: identity
Content-Length integer
The size of the entity-body, in bytes, sent to InfluxDB.
Accept string
The content type that the client can understand. Writes only return a response body if they fail (partially or completely)–for example, due to a syntax problem or type mismatch.
Allowed values: application/json
Default: application/json

Request body

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

Responses

204 Success (“No Content”). All data in the batch is written and queryable.
400 Bad request.
401 Unauthorized access.
data object
error string
403 Access denied.
413 Request entity too large.
POST /write v1

Write line protocol (v1-compatible)

Writes line protocol to the specified database.

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 this endpoint to send data in line protocol format to InfluxDB. Use query parameters to specify options for writing data.

Parameters

Query parameters
db required string
The name of the database. InfluxDB creates the database if it doesn’t already exist, and then writes all points in the batch to the database.
precision string
The precision for unix timestamps in the line protocol batch.
u string
Username for v1 compatibility authentication. When using Basic authentication or query string authentication, InfluxDB 3 ignores this parameter but allows any arbitrary string for compatibility with InfluxDB 1.x clients.
p string
Password for v1 compatibility authentication. For query string authentication, pass a database token with write permissions as this parameter. InfluxDB 3 checks that the p value is an authorized token.
rp string
Retention policy name. Honored but discouraged. InfluxDB 3 doesn’t use retention policies.
consistency string
Write consistency level. Ignored by InfluxDB 3. Provided for compatibility with InfluxDB 1.x clients.
Header parameters
Authorization string

Authorization header for token-based authentication. Supported schemes:

  • Bearer AUTH_TOKEN - OAuth bearer token scheme
  • Token AUTH_TOKEN - InfluxDB v2 token scheme
  • Basic <base64-encoded USERNAME:AUTH_TOKEN> - Basic authentication (username is ignored)
Content-Type string
The content type of the request payload.
Accept string
The content type that the client can understand. Writes only return a response body if they fail (partially or completely)–for example, due to a syntax problem or type mismatch.
Allowed values: application/json
Default: application/json
Content-Encoding string
The compression applied to the line protocol in the request payload. To send a gzip payload, pass Content-Encoding: gzip header.
Content-Length string
The size of the entity-body, in bytes, sent to InfluxDB.

Request body

Content-Type: application/json
Example request Ask AI about this
curl --request POST \
  "https://localhost:8181/write?db=DB" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: text/plain" \
  --data-raw 'measurement,tag=value field=1 1234567890'

Responses

204 Success (“No Content”). All data in the batch is written and queryable.
400

Bad request. Some (a partial write) or all of the data from the batch was rejected and not written. If a partial write occurred, then some points from the batch are written and queryable.

The response body:

  • indicates if a partial write occurred or all data was rejected.
  • contains details about the rejected points, up to 100 points.
401 Unauthorized access.
data object
error string
403 Access denied.
413 Request entity too large.

Was this page helpful?

Thank you for your feedback!