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❌ No✅ auto (default)
Seconds✅ s✅ s✅ second
Milliseconds✅ ms✅ ms✅ millisecond
Microseconds✅ u or µ✅ us✅ microsecond
Nanoseconds✅ ns✅ ns✅ nanosecond
Minutes✅ m❌ No❌ No
Hours✅ h❌ No❌ No
DefaultNanosecondNanosecondAuto (guessed)

All timestamps are stored internally as nanoseconds.

POST /api/v3/write_lp

Write line protocol

Writes line protocol data to the specified database.

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

Features

  • Partial writes: By default (accept_partial=true), InfluxDB writes the valid lines when some lines in a batch fail. Set accept_partial=false to reject the whole batch instead.
  • 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)
  • 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
precision string
accept_partial boolean
Whether to write the valid lines when some lines in the batch are rejected. Default is true: InfluxDB writes the valid lines and returns 400 with "partial write of line protocol occurred" and the rejected lines. With false, InfluxDB rejects the whole batch and writes nothing.
Default: true
no_sync boolean

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. Some or all lines were rejected; the body lists each rejected line. With accept_partial=true (the default), the valid lines are written and the error is "partial write of line protocol occurred". With accept_partial=false, nothing is written. In a database that uses explicit schemas (schema_mode: explicit, Enterprise only), a line that writes an undeclared table or column is rejected with a message that names it and points to /api/v3/configure/table.
401 Unauthorized access.
data object
error string
403 Access denied.
413 Request entity too large.
422 Unprocessable entity. The write would exceed a schema limit: the number of databases, tables, columns, tag columns, or fields. A partial write whose rejected lines hit a limit also returns 422 instead of 400.
POST /api/v2/write

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.

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. InfluxDB rejected the whole batch and wrote nothing. This endpoint doesn’t support partial writes: if any line is invalid, no lines are written, and an accept_partial parameter is ignored. To write the valid lines of a batch, use /api/v3/write_lp.
401 Unauthorized access.
data object
error string
403 Access denied.
413 Request entity too large.
POST /write

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. InfluxDB rejected the whole batch and wrote nothing. This endpoint doesn’t support partial writes: if any line is invalid, no lines are written, and an accept_partial parameter is ignored. The body describes the first rejected line. To write the valid lines of a batch, use /api/v3/write_lp.
401 Unauthorized access.
data object
error string
403 Access denied.
413 Request entity too large.

Was this page helpful?

Thank you for your feedback!