# Write with line protocol

Use `POST /write` with `Content-Type: text/plain` or `text/plain; charset=utf-8`. The endpoint accepts an ILP subset; it is not a complete InfluxDB or QuestDB compatibility contract.

## Send a batch from a file

```sh
cat > measurements.ilp <<'DATA'
temperature,device=dev-001 value=21.5,healthy=true 1791504000000000000
temperature,device=dev-002 value=19.0,healthy=true 1791504000000000000
DATA
curl -i http://127.0.0.1:9070/write \
  -H 'Content-Type: text/plain' \
  --data-binary @measurements.ilp
```

A successful standalone write returns **204** after local WAL fsync and application. Do not expect a JSON success body. Batch validation is atomic: a conflict in one line rejects the whole batch.

## Encode values correctly

| Type | Example | Notes |
| --- | --- | --- |
| Signed integer | `count=42i` | The `i` suffix distinguishes an integer from a float |
| Float | `value=21.5` | Must be finite; no NaN or infinity |
| Boolean | `healthy=true` | Boolean spellings are supported |
| String | `status="ready"` | Double-quoted; escape quote and backslash |
| Tag | `device=dev-001` | Always a string |

Measurements, keys, and tag values escape space, comma, equals, and backslash with a backslash. Identifiers must be nonempty. Raw control characters, duplicate keys, and malformed escapes are rejected. `timestamp` is reserved as a column name.

## Timestamp precision

Use signed 64-bit nanoseconds from Unix epoch. There is no `precision` query parameter or implicit conversion. A line can omit its timestamp in current source builds; all such points in one request use the same receiving-node clock value.

Blank lines and comments are rejected. LF or CRLF may separate points; the final newline is optional. Do not add a trailing space to a timestamp-free line.

## Size the batch

The sample config permits 4 MiB per body, 64 KiB per line, and 10,000 points per batch. These are configured limits, not a throughput recommendation. Start below them and measure latency, memory, and write rejection rates with your actual workload.

## Handle failures deliberately

Read both HTTP status and the JSON `outcome`. `not_written` means the server did not apply this batch. `unknown` means the batch may have completed; a connection failure without a response is also uncertain.

A corrected `400` or smaller `413` request can be submitted as a new request. A `429` needs bounded backoff and capacity investigation. Never blindly replay an unknown mutation: append mode can duplicate points, and dedup mode can replace newer corrections.

See the [HTTP reference](/smts/docs/http-api/) for the complete status table.

## Go writers

Install the topology-aware Go SDK with `go get github.com/m6yf/pulse-go@v0.2.5`. For workloads that need delivery across transient outages, configure a persistent spool per writer. [Writer recovery in 0.2.5](/smts/docs/release-notes/#go-writer-recovery) · [Go SDK](https://github.com/m6yf/pulse-go/tree/v0.2.5)
