---
title: Write
description: Write time series data to InfluxDB v1 in line protocol format using the /write endpoint.
url: https://docs.influxdata.com/influxdb/v1/api/write/
estimated_tokens: 765
product: InfluxDB OSS v1
version: v1
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/v1/api/write/
---

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

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

POST`/write`

### Write data

Write time series data to InfluxDB 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.

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

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`

`u`string

Username for authentication

`p`string

Password for authentication

#### Request bodyrequired

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](#)

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

400Bad request (line protocol syntax error or type conflict)

`error`requiredstring

Error message

401Unauthorized

`error`requiredstring

Error message

404Database not found

`error`requiredstring

Error message

413Request entity too large

`error`requiredstring

Error message

500Internal server error (e.g., retention policy not found)

`error`requiredstring

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 1.x.

#### Parameters

##### Query parameters

`bucket`requiredstring

Database and retention policy in format `database/retention-policy`.
Use `database/` or `database` for the default retention policy.

`org`string

Organization (ignored in InfluxDB 1.x)

`precision`string

Timestamp precision

Allowed values:`ns`, `us`, `ms`, `s`

Default:`ns`

#### Request bodyrequired

Content-Type:`application/json`

Example request[Ask AI about this](#)

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

204Write successful

400Bad request

`error`requiredstring

Error message

401Unauthorized

`error`requiredstring

Error message
