Documentation

Write data to InfluxDB 3 Enterprise

InfluxDB 3 Enterprise is designed for high write-throughput and uses an efficient, human-readable write syntax called line protocol. InfluxDB is a schema-on-write database, meaning you can start writing data and InfluxDB creates the logical database, tables, and their schemas automatically, without any required intervention. Once InfluxDB creates the schema, it validates future write requests against the schema before accepting new data. Both new tags and fields can be added later as your schema changes.

Line protocol

InfluxDB 3 Enterprise accepts data in line protocol syntax. Line protocol consists of the following elements:

* Required
  • * table: A string that identifies the table to store the data in.

  • tag set: Comma-delimited list of key value pairs, each representing a tag. Tag keys and values are unquoted strings. Spaces, commas, and equal characters must be escaped.

  • * field set: Comma-delimited list of key value pairs, each representing a field. Field keys are unquoted strings. Spaces and commas must be escaped. Field values can be one of the following types:

  • timestamp: Unix timestamp associated with the data. InfluxDB supports up to nanosecond precision.

How are InfluxDB line protocol elements parsed?

For schema design recommendations, see InfluxDB schema design recomendations.


myTable,tag1=val1,tag2=val2 field1="v1",field2=1i 0000000000000000000


Construct line protocol

With a basic understanding of line protocol, you can now construct line protocol and write data to InfluxDB 3 Enterprise. Consider a use case where you collect data from sensors in your home. Each sensor collects temperature, humidity, and carbon monoxide readings. To collect this data, use the following schema:

  • table: home
    • tags
      • room: Living Room or Kitchen
    • fields
      • temp: temperature in °C (float)
      • hum: percent humidity (float)
      • co: carbon monoxide in parts per million (integer)
    • timestamp: Unix timestamp in second precision

The following line protocol sample represents data collected hourly beginning at 2025-07-14T08:00:00Z (UTC) until 2025-07-14T20:00:00Z (UTC). These timestamps are dynamic and can be updated by clicking the icon in the bottom right corner.

Home sensor data line protocol
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1752480000
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1752480000
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1752483600
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1752483600
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1752487200
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1752487200
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1752490800
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1752490800
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1752494400
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1752494400
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1752498000
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1752498000
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1752501600
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1752501600
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1752505200
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1752505200
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1752508800
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1752508800
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1752512400
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1752512400
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1752516000
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1752516000
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1752519600
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1752519600
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1752523200
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1752523200
  • Copy
  • Fill window

Write data using the CLI

To quickly get started writing data, use the influxdb3 write command. Include the following:

  • --database option that identifies the target database
  • --token option that specifies the token to use (unless the INFLUXDB3_AUTH_TOKEN environment variable is already set)
  • Quoted line protocol data via standard input (stdin)
influxdb3 write \
  --database 
DATABASE_NAME
\
--token
AUTH_TOKEN
\
--precision s \ 'home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000 home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000 home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600 home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600 home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200 home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200 home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800 home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800 home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400 home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400 home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000 home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000 home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600 home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600 home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200 home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200 home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800 home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800 home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400 home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400 home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000 home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000 home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600 home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600 home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200 home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200'
  • Copy
  • Fill window

In the code samples, replace the following placeholders with your values:

  • DATABASE_NAME: the name of the database to write to
  • AUTH_TOKEN: your database token with permission to write to the specified database

Write data from a file

To write line protocol you have saved to a file, pass the --file option–for example, save the sample line protocol to a file named sensor_data and then enter the following command:

influxdb3 write \
  --database 
DATABASE_NAME
\
--token
AUTH_TOKEN
\
--precision s \ --accept-partial \ --file path/to/sensor_data
  • Copy
  • Fill window

Replace the following placeholders with your values:

  • DATABASE_NAME: the name of the database to write to.
  • AUTH_TOKEN: your database token with permission to write to the specified database

Other tools for writing data

There are many ways to write data to your InfluxDB 3 Enterprise database, including:

  • InfluxDB HTTP API: Recommended for batching and higher-volume write workloads.
  • InfluxDB client libraries: Client libraries that integrate with your code to construct data as time series points and write the data as line protocol to your InfluxDB 3 Enterprise database.
  • Telegraf: A data collection agent with over 300 plugins for collecting, processing, and writing data.

For more information, see Write data to InfluxDB 3 Enterprise.


Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

New in InfluxDB 3.2

Key enhancements in InfluxDB 3.2 and the InfluxDB 3 Explorer UI is now generally available.

See the Blog Post

InfluxDB 3.2 is now available for both Core and Enterprise, bringing the general availability of InfluxDB 3 Explorer, a new UI that simplifies how you query, explore, and visualize data. On top of that, InfluxDB 3.2 includes a wide range of performance improvements, feature updates, and bug fixes including automated data retention and more.

For more information, check out: