Writing data
Send MessagePack or line protocol data to Arc with curl, Python, Go, or Telegraf.
Arc accepts MessagePack for efficient typed batches and InfluxDB line protocol for simple, portable writes. Both APIs return 204 No Content when a write is accepted.
| Use case | Recommended path |
|---|---|
| Application writes and large batches | MessagePack columnar |
| Shell scripts and existing InfluxDB clients | Line protocol |
| Host, service, and infrastructure metrics | Telegraf |
| Historical files | Data import |
The examples use a database named metrics and read the token from ARC_TOKEN. Create the database once before writing:
arcli db create metrics
export ARC_TOKEN="your-token"MessagePack
Send MessagePack to POST /api/v1/write/msgpack. The columnar format groups values by column, which keeps batches compact:
{
"m": "cpu",
"columns": {
"time": [1788973200000000, 1788973201000000],
"host": ["server01", "server02"],
"usage": [45.2, 67.8]
}
}mis the measurement name.- Every array in
columnsmust have the same length. - Values within a column must use a consistent type.
timeis a numeric Unix timestamp. Arc detects seconds, milliseconds, microseconds, or nanoseconds by magnitude.
curl can send an already encoded MessagePack file:
curl --request POST http://localhost:8000/api/v1/write/msgpack \
--header "Authorization: Bearer $ARC_TOKEN" \
--header "Content-Type: application/msgpack" \
--header "x-arc-database: metrics" \
--data-binary @cpu.msgpackUse the Python or Go example to encode a payload, then write the resulting bytes to cpu.msgpack when a file-based workflow is useful.
For sustained ingestion, batch multiple rows per request. Arc also accepts gzip and zstd request compression through the Content-Encoding header.
Line protocol
Line protocol is convenient for scripts and tools that already speak the InfluxDB protocol:
measurement,tag=value field=value timestampThis example writes a floating-point field, an integer field, and a nanosecond timestamp:
cpu,host=server01,region=us-east usage=45.2,requests=12i 1788973200000000000Send it to Arc's native POST /api/v1/write/line-protocol endpoint.
curl --request POST http://localhost:8000/api/v1/write/line-protocol \
--header "Authorization: Bearer $ARC_TOKEN" \
--header "Content-Type: text/plain" \
--header "x-arc-database: metrics" \
--data-binary "cpu,host=server01,region=us-east usage=45.2,requests=12i $(date +%s)000000000"Arc also supports the InfluxDB 1.x /write and InfluxDB 2.x /api/v2/write endpoints for compatible clients. See the write API reference for their parameters.
Telegraf
For system and service metrics, use Telegraf's native Arc output plugin. It batches metrics as MessagePack, supports compression, and can collect from hundreds of existing input plugins.
Send Telegraf metrics to Arc
Install Telegraf, configure the Arc output, and verify your metrics.
Verify the write
Query the measurement with arcli:
arcli query --database metrics "SELECT * FROM cpu ORDER BY time DESC LIMIT 10"The --database metrics option sends x-arc-database: metrics, so the SQL only needs the measurement name: FROM cpu.
Arc buffers writes briefly, so newly accepted data may take a few seconds to appear in a query.