---
title: Write data (v1-compatible)
description: Write data to InfluxDB OSS v2 using the v1-compatible /write endpoint with line protocol.
url: https://docs.influxdata.com/influxdb/v2/api/write-data-v1-compatible/
estimated_tokens: 1511
product: InfluxDB OSS v2
version: v2
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/v2/api/write-data-v1-compatible/
---

[Download InfluxDB API Spec](/openapi/influxdb-oss-v2-api.yml)

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](/influxdb/v2/reference/syntax/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.

#### Related guides

* [Write data with the InfluxDB API](/influxdb/v2/write-data/developer-tools/api)

#### 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`requiredstring

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 bodyrequired

Line protocol body

Content-Type:`application/json`

Example request[Ask AI about this](#)

```sh
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

204Write data is correctly formatted and accepted for writing to the bucket.

400Line 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`requiredstring

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.

401Token doesn’t have sufficient permissions to write to this organization and bucket or the organization and bucket do not exist.

`code`requiredstring

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.

403The request didn’t provide an authorization token.

`code`requiredstring

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.

413Write 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`requiredstring

Code is the machine-readable error code.

Allowed:`invalid`

`message`requiredstring

Human-readable message.

422The 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`requiredstring

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.

429Token is temporarily over quota. The Retry-After header describes when to try the write again.

503Server is temporarily unavailable to accept writes. The Retry-After header describes when to try the write again.

defaultInternal server error

`code`requiredstring

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.
