How to write line protocol with the influxdb3 CLI

Writing line protocol with the influxdb3 CLI is a direct way to test ingestion into InfluxDB 3 Core from a terminal. It is useful when a developer or operator needs to prove that a database accepts a point before sending data from an application, script, or agent.

For a quick CLI check, pass one quoted line protocol string to influxdb3 write and query the point back through the same CLI session. The string names the table, tag set, field set, and timestamp that InfluxDB 3 Core stores when the write is accepted.

Here, factory_metrics already exists and the token is stored in INFLUXDB3_AUTH_TOKEN. The line includes a seconds-precision timestamp, so --precision s is set explicitly instead of relying on timestamp magnitude detection.

Steps to write line protocol with the influxdb3 CLI:

  1. Set the InfluxDB token for the current terminal session.
    $ export INFLUXDB3_AUTH_TOKEN='AUTH_TOKEN'

    Use a token with read and write permission on the target InfluxDB 3 Core database. Do not paste a real token into shared transcripts, screenshots, or shell history.

  2. Confirm that the target database is available.
    $ influxdb3 show databases
    +-----------------+
    | iox::database   |
    +-----------------+
    | _internal       |
    | factory_metrics |
    +-----------------+

    Create the database first when the target name is missing.
    Related: How to create an InfluxDB 3 Core database

  3. Write one line protocol point with seconds precision.
    $ influxdb3 write --database factory_metrics --precision s 'temperature,site=plant-1,line=line-a value=22.4 1767225600'
    780ms: 1 request (1.28 requests/sec), 1 lines (1 lines/s), 58B (74B/s)

    The line writes to the temperature table, stores site and line as tags, stores value as a float field, and uses 2026-01-01T00:00:00 as the point time.

  4. Confirm that the write created the user table.
    $ influxdb3 query --database factory_metrics "SELECT table_name FROM information_schema.tables WHERE table_schema = 'iox'"
    +-------------+
    | table_name  |
    +-------------+
    | temperature |
    +-------------+
  5. Query the inserted point from the same database.
    $ influxdb3 query --database factory_metrics "SELECT time, site, line, value FROM temperature WHERE site = 'plant-1' ORDER BY time"
    +---------------------+---------+--------+-------+
    | time                | site    | line   | value |
    +---------------------+---------+--------+-------+
    | 2026-01-01T00:00:00 | plant-1 | line-a | 22.4  |
    +---------------------+---------+--------+-------+

    An empty result usually means the database, table name, token scope, tag predicate, or timestamp precision does not match the write.
    Related: How to troubleshoot InfluxDB line protocol writes