All Products
Search
Document Center

Time Series Database:Line protocol reference

Last Updated:Mar 28, 2026

The line protocol is a text-based format for writing data points to TSDB for InfluxDB®.

Syntax

<measurement>[,<tag_key>=<tag_value>[,<tag_key>=<tag_value>]] <field_key>=<field_value>[,<field_key>=<field_value>] [<timestamp>]

Each line represents one data point. Lines are separated by a line feed (\n). The line protocol is whitespace-sensitive.

Example

myMeasurement,tag1=val1,tag2=val2 field1="v1",field2=1i 1465839830100400200

In this example:

  • myMeasurement is the measurement name

  • tag1=val1,tag2=val2 is the tag set

  • field1="v1",field2=1i is the field set

  • 1465839830100400200 is the timestamp in nanoseconds

Elements

ElementRequiredDescriptionType
measurementYesThe name of the measurement. Only one measurement per data point.String
tag setNoAll tag key-value pairs for the data point.Keys and values must be strings
field setYes. At least one field required.All field key-value pairs for the data point.Field keys: string. Field values: float, integer, string, or Boolean
timestampNo. Defaults to the server's local UTC time in nanoseconds.The timestamp of the data point. Only one timestamp per data point.UNIX nanosecond timestamp

Data types

TypeApplies toDetails
FLOATField valuesIEEE-754 64-bit floating-point number. The default numeric type. Examples: 1, 1.0, 1.e+78, 1.E+78. Scientific notation is supported.
INTEGERField valuesSigned 64-bit integer, ranging from -9223372036854775808 to 9223372036854775807. Append i to the value. Example: 1i.
STRINGMeasurements, tag keys, tag values, field keys, field valuesMaximum 64 KB.
BOOLEANField valuesWrite TRUE values as t, T, true, True, or TRUE. Write FALSE values as f, F, false, False, or FALSE.
TIMESTAMPTimestampsUNIX nanosecond timestamp. Minimum: -9223372036854775806 (1677-09-21T00:12:43.145224194Z). Maximum: 9223372036854775806 (2262-04-11T23:47:16.854775806Z). Use the HTTP API to write timestamps at other precisions.
The syntax for writing Boolean values differs from the syntax for querying them. For more information, see FAQ.
Field value types must be consistent within a shard but can differ across shards. For how type conflicts affect SELECT * queries, see FAQ.

Data type examples

Write 1.0 as a float

> INSERT mymeas value=1.0

Write 1 as a float

> INSERT mymeas value=1

Numeric literals without an i suffix are floats by default.

Write -1.234456e+78 as a float

> INSERT mymeas value=-1.234456e+78

Write 1 as an integer

> INSERT mymeas value=1i

Write a string field value

> INSERT mymeas value="stringing along"

Enclose string field values in double quotation marks.

Write a Boolean field value

> INSERT mymeas value=true

Do not enclose Boolean field values in quotation marks. The following statement writes true as a string, not a Boolean:

> INSERT mymeas value="true"

Type conflict within the same shard

> INSERT mymeas value=3 1465934559000000000
> INSERT mymeas value="stringing along" 1465934559000000001
ERR: {"error":"field type conflict: input field \"value\" on measurement \"mymeas\" is type string, already exists as type float"}

Type conflict across shards (succeeds)

> INSERT mymeas value=3 1465934559000000000
> INSERT mymeas value="stringing along" 1466625759000000000
>

When the two timestamps fall in different shards, the type conflict does not produce an error.

Quotation marks, special characters, and additional naming guidelines

Quotation marks

ElementDouble quotation mark (")Single quotation mark (')
TimestampNot usedNot used
measurement, tag key, tag value, field keyNot usedNot used
Field value (STRING)Required. Enclose STRING field values in double quotation marks. Do not quote floats, integers, or Booleans.Not used

Using double or single quotation marks around measurement names, tag keys, tag values, or field keys makes them part of the name — which can complicate query syntax. Avoid quoting these elements in line protocol data.

Invalid: timestamp in double quotation marks

> INSERT mymeas value=9 "1466625759000000000"
ERR: {"error":"unable to parse 'mymeas value=9 \"1466625759000000000\"': bad timestamp"}

Wrapping a timestamp in quotation marks causes a bad timestamp error.

Semantic error: Boolean field value in double quotation marks

> INSERT mymeas value="true"
> SHOW FIELD KEYS FROM "mymeas"
name: mymeas
------------
fieldKey         fieldType
value            string

TSDB for InfluxDB® treats any field value enclosed in double quotation marks as a string.

Semantic error: measurement name in double quotation marks

> INSERT "mymeas" value=200
> SHOW MEASUREMENTS
name: measurements
------------------
name
"mymeas"
> SELECT * FROM mymeas
> SELECT * FROM "mymeas"
> SELECT * FROM "\"mymeas\""
name: "mymeas"
--------------
time                              value
2016-06-14T20:36:21.836131014Z   200

When a measurement name is enclosed in double quotation marks, the quotation marks become part of the name. To query the measurement, escape each double quotation mark with a backslash in the FROM clause: "\"mymeas\"".

Special characters

Escape the following characters with a backslash (\):

ElementCharacters to escape
Measurement namesComma (,), space ( )
Tag keysComma (,), equal sign (=), space ( )
Tag valuesComma (,), equal sign (=), space ( )
Field keysComma (,), equal sign (=), space ( )
Field values (STRING)Double quotation mark (")

Backslashes (\) do not need to be escaped. Any special characters not listed above also do not need to be escaped.

Example: data point with special characters

> INSERT "measurement\ with\ quo⚡️es\ and\ emoji",tag\ key\ with\ sp⚡️ces=tag\,value\,with"commas" field_k\ey="string field value, only \" need be esc⚡️ped"

Additional naming guidelines

  • Comments: A number sign (#) at the start of a line marks a comment. TSDB for InfluxDB® ignores all characters between # and the next line feed (\n).

  • Case sensitivity: Measurement names, tag keys, tag values, field keys, and field values are all case-sensitive.

  • InfluxQL keywords: Avoid using InfluxQL keywords as identifier names. When used as identifiers, InfluxQL keywords may be interpreted as query keywords, causing query errors.

  • The `time` keyword: time can be used as a continuous query name, database name, measurement name, retention policy name, subscription name, or username — without double quotation marks. However, time cannot be used as a field key or tag key. TSDB for InfluxDB® rejects such write requests with an error. For more information, see FAQ.

Write line protocol data

For instructions on writing line protocol data to a database, see the Tools chapter.

Duplicate data points

A data point is uniquely identified by its measurement name, tag set, and timestamp. If you write a data point with the same measurement, tag set, and timestamp as an existing point:

  • If the new point has a different field set than the existing point, the field set becomes the union of the old and new field sets.

  • If a field key conflicts, the new value takes precedence.

For an example and guidance on avoiding duplicates, see FAQ.

Usage notes

  • Sort tags before writing: Sort tags by tag key using the same ordering as the Go bytes.Compare function. Consistent tag ordering improves write performance.

  • Use coarser timestamp precision: We recommend using coarse-grained timestamps to improve data compression performance.

  • Synchronize clocks with NTP: TSDB for InfluxDB® uses the local UTC time of the host to assign timestamps. If the host clock is not synchronized with a Network Time Protocol (NTP) server, written data may have inaccurate timestamps.

InfluxDB® is a trademark registered by InfluxData, which is not affiliated with, and does not endorse, TSDB for InfluxDB®.