---
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: 3478
product: InfluxDB OSS v1
version: v1
---

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

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

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

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

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

204 Write successful

400 Bad request

`error` required string

Error message

401 Unauthorized

`error` required string

Error message
