---
title: Use compatibility APIs and client libraries to write data
description: Use HTTP API endpoints compatible with InfluxDB v2 and v1 clients to write points as line protocol data to InfluxDB Cloud Dedicated.
url: https://docs.influxdata.com/influxdb3/cloud-dedicated/write-data/http-api/compatibility-apis/
estimated_tokens: 3914
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb3/cloud-dedicated/write-data/http-api/compatibility-apis/
date: '2026-06-10T16:04:20-05:00'
lastmod: '2026-06-10T16:04:20-05:00'
---

Use compatibility APIs when you need to migrate existing InfluxDB v1 or v2 write
workloads to InfluxDB 3.x.
The `/api/v2/write` (v2-compatible) and `/write` (v1-compatible) HTTP API
endpoints work with InfluxDB [client libraries](/influxdb3/cloud-dedicated/reference/client-libraries/), [Telegraf](/telegraf/v1/), and third-party integrations
to write points as line protocol data to InfluxDB Cloud Dedicated.

#### Choose the write endpoint for your workload

When creating new write workloads, use the[InfluxDB HTTP API `/api/v3/write_lp` endpoint](/influxdb3/cloud-dedicated/write-data/http-api/v3-write-lp/)and [client libraries](/influxdb3/cloud-dedicated/write-data/client-libraries/).

When bringing existing v1 write workloads, use the[v1-compatible `/write` endpoint](#influxdb-v1-compatibility).

When bringing existing v2 write workloads, use the[v2-compatible `/api/v2/write` endpoint](#influxdb-v2-compatibility).

**For Telegraf**, use the InfluxDB v1.x [`outputs.influxdb`](/telegraf/v1/output-plugins/influxdb/) or v2.x [`outputs.influxdb_v2`](/telegraf/v1/output-plugins/influxdb_v2/) output plugins.
See how to [use Telegraf to write data](/influxdb3/cloud-dedicated/write-data/use-telegraf/).

#### Compatibility APIs differ from native APIs

Keep in mind that the compatibility APIs differ from the v1 and v2 APIs in previous versions in the following ways:

* Tags in a table (measurement) are *immutable*
* A tag and a field can’t have the same name within a table.

## InfluxDB v2 compatibility

The `/api/v2/write` InfluxDB v2 compatibility endpoint provides backwards
compatibility with clients that can write data to InfluxDB OSS v2.x and Cloud 2 (TSM).

```
POST /api/v2/write?bucket=mydb&precision=ns
```

### Authenticate v2 API requests

InfluxDB Cloud Dedicated requires each API request to be authenticated with a [token](/influxdb/cloud-dedicated/admin/tokens/)

.

Use the `Authorization: Bearer` or `Authorization: Token` scheme to authenticate v2 API write requests:

#### Syntax

```http
Authorization: Bearer DATABASE_TOKEN
```

```http
Authorization: Token DATABASE_TOKEN
```

#### Examples

Use `Bearer` to authenticate a v2 write request:

```sh
curl -i "https://cluster-id.a.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
    --header "Authorization: Bearer DATABASE_TOKEN" \
    --header "Content-type: text/plain; charset=utf-8" \
    --data-binary 'home,room=kitchen temp=72 1641024000'
```

Use `Token` to authenticate a v2 write request:

```sh
curl -i "https://cluster-id.a.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
    --header "Authorization: Token DATABASE_TOKEN" \
    --header "Content-type: text/plain; charset=utf-8" \
    --data-binary 'home,room=kitchen temp=72 1641024000'
```

### v2 API write parameters

For InfluxDB Cloud Dedicated v2 API `/api/v2/write` requests, set parameters as listed in the following table:

|    Parameter     | Allowed in |Ignored|                        Value                        |
|------------------|------------|-------|-----------------------------------------------------|
|   `bucket` \*    |Query string|Honored|                    Database name                    |
|   `precision`    |Query string|Honored|   [Timestamp precision](#timestamp-precision-v2)    |
|`Content-Encoding`|   Header   |Honored|`gzip` (compressed data) or `identity` (uncompressed)|
| `Authorization`  |   Header   |Honored|  `Bearer DATABASE_TOKEN` or `Token DATABASE_TOKEN`  |

\* = Required

#### Timestamp precision

> [!Note]
> > [!Note]
> By default, InfluxDB Cloud Dedicated uses the timestamp magnitude to auto-detect the precision.
> To avoid any ambiguity, you can specify the precision of timestamps in your data.

Use one of the following `precision` values in v2 API `/api/v2/write` requests:

* `ns`: nanoseconds
* `us`: microseconds
* `ms`: milliseconds
* `s`: seconds
* `m`: minutes
* `h`: hours

## InfluxDB v1 compatibility

The `/write` InfluxDB v1 compatibility endpoint provides backwards compatibility with clients that can write data to InfluxDB v1.x.

```
POST /write?db=mydb&precision=ns
```

### Authenticate v1 API requests

InfluxDB Cloud Dedicated requires each API request to be authenticated with a [token](/influxdb/cloud-dedicated/admin/tokens/)

.
With InfluxDB v1-compatible endpoints in InfluxDB 3, you can use database tokens in InfluxDB 1.x username and password
schemes, in the InfluxDB v2 `Authorization: Token` scheme, or in the OAuth `Authorization: Bearer` scheme.

* [Authenticate with a username and password scheme](#authenticate-with-a-username-and-password-scheme)
* [Authenticate with a token scheme](#authenticate-with-a-token-scheme)

#### Authenticate with a username and password scheme

With InfluxDB v1-compatible endpoints, you can use the InfluxDB 1.x convention of
username and password to authenticate database writes by passing a [token](/influxdb/cloud-dedicated/admin/tokens/)

as the `password` credential.
When authenticating requests to the v1 API `/write` endpoint, InfluxDB Cloud Dedicated checks that the `password` (`p`) value is an authorized [token](/influxdb/cloud-dedicated/admin/tokens/)

.
InfluxDB Cloud Dedicated ignores the `username` (`u`) parameter in the request.

Use one of the following authentication schemes with clients that support Basic authentication or query parameters:

* [Basic authentication](#basic-authentication-v1)
* [Query string authentication](#query-string-authentication-v1)

##### Basic authentication

Use the `Authorization` header with the `Basic` scheme to authenticate v1 API `/write` requests.
When authenticating requests, InfluxDB Cloud Dedicated checks that the `password` part of the decoded credential is an authorized [token](/influxdb/cloud-dedicated/admin/tokens/)

.
InfluxDB Cloud Dedicated ignores the `username` part of the decoded credential.

###### Syntax

```http
Authorization: Basic <base64-encoded [USERNAME]:DATABASE_TOKEN>
```

Encode the `[USERNAME]:DATABASE_TOKEN` credential using base64 encoding, and then append the encoded string to the `Authorization: Basic` header.

###### Example

The following example shows how to use cURL with the `Basic` authentication scheme:

```sh
curl -i "https://cluster-id.a.influxdb.io/write?db=DATABASE_NAME&precision=s" \
  --user "any:DATABASE_TOKEN" \
  --header "Content-type: text/plain; charset=utf-8" \
  --data-binary 'home,room=kitchen temp=72 1641024000'
```

##### Query string authentication

In the URL, pass the `p` query parameter to authenticate `/write` requests.
When authenticating requests, InfluxDB Cloud Dedicated checks that the `p` (*password*) value is an authorized [token](/influxdb/cloud-dedicated/admin/tokens/)

and ignores the `u` (*username*) parameter.

###### Syntax

```sh
https://cluster-id.a.influxdb.io/write/?u=any&p=DATABASE_TOKEN
```

###### Example

The following example shows how to use cURL with query string authentication:

```sh
curl -i "https://cluster-id.a.influxdb.io/write?db=DATABASE_NAME&precision=s&p=DATABASE_TOKEN" \
  --header "Content-type: text/plain; charset=utf-8" \
  --data-binary 'home,room=kitchen temp=72 1641024000'
```

#### Authenticate with a token scheme

Use the `Authorization: Bearer` or the `Authorization: Token` scheme to pass a [token](/influxdb/cloud-dedicated/admin/tokens/)

for authenticating
v1 API `/write` requests.

`Bearer` and `Token` are equivalent in InfluxDB Cloud Dedicated.
The `Token` scheme is used in the InfluxDB 2.x API.`Bearer` is defined by the [OAuth 2.0 Framework](https://www.rfc-editor.org/rfc/rfc6750#page-14).
Support for one or the other may vary across InfluxDB API clients.

##### Syntax

```http
Authorization: Bearer DATABASE_TOKEN
```

```http
Authorization: Token DATABASE_TOKEN
```

##### Examples

Use `Bearer` to authenticate a v1 write request:

```sh
curl -i "https://cluster-id.a.influxdb.io/write?db=DATABASE_NAME&precision=s" \
    --header "Authorization: Bearer DATABASE_TOKEN" \
    --header "Content-type: text/plain; charset=utf-8" \
    --data-binary 'home,room=kitchen temp=72 1641024000'
```

Use `Token` to authenticate a v1 write request:

```sh
curl -i "https://cluster-id.a.influxdb.io/write?db=DATABASE_NAME&precision=s" \
    --header "Authorization: Token DATABASE_TOKEN" \
    --header "Content-type: text/plain; charset=utf-8" \
    --data-binary 'home,room=kitchen temp=72 1641024000'
```

### v1 API write parameters

For InfluxDB Cloud Dedicated v1 API `/write` requests, set parameters as listed in the following table:

|  Parameter  | Allowed in |        Ignored         |                                                        Value                                                         |
|-------------|------------|------------------------|----------------------------------------------------------------------------------------------------------------------|
|`consistency`|Query string|        Ignored         |                                                         N/A                                                          |
|   `db` \*   |Query string|        Honored         |                                                    Database name                                                     |
| `precision` |Query string|        Honored         |                                    [Timestamp precision](#timestamp-precision-v1)                                    |
|    `rp`     |Query string|Honored, but discouraged|                                                   Retention policy                                                   |
|     `u`     |Query string|        Ignored         |               For [query string authentication](#query-string-authentication-v1), any arbitrary string               |
|     `p`     |Query string|        Honored         |For [query string authentication](#query-string-authentication-v1), a [token](/influxdb/cloud-dedicated/admin/tokens/)|

`Content-Encoding` | Header | Honored | `gzip` (compressed data) or `identity` (uncompressed)`Authorization` | Header | Honored | `Bearer DATABASE_TOKEN`, `Token DATABASE_TOKEN`, or `Basic <base64 [USERNAME]:DATABASE_TOKEN>`

\* = Required

#### Timestamp precision

By default, InfluxDB Cloud Dedicated uses the timestamp magnitude to auto-detect the precision.
To avoid any ambiguity, you can specify the precision of timestamps in your data.

Use one of the following `precision` values in v1 API `/write` requests:

* `ns`: nanoseconds
* `us`: microseconds
* `ms`: milliseconds
* `s`: seconds
* `m`: minutes
* `h`: hours

## Client library examples

Use language-specific client libraries with your custom code to write data to InfluxDB Cloud Dedicated.

### v1 client libraries

v1 client libraries send data in [line protocol](/influxdb3/cloud-dedicated/reference/syntax/line-protocol/) syntax to the v1 API `/write` endpoint.

#### Node.js ####

Create a v1 API client using the [node-influx](/influxdb/v1/tools/api_client_libraries/#javascriptnodejs) JavaScript client library:

```js
const Influx = require('influx')

// Instantiate a client for writing to InfluxDB Cloud Dedicated v1 API
const client = new Influx.InfluxDB({
  host: 'cluster-id.a.influxdb.io',
  port: 443,
  protocol: 'https',
  database: 'DATABASE_NAME',
  username: 'ignored',
  password: 'DATABASE_TOKEN'
})
```

Create a v1 API client using the [influxdb-python](/influxdb/v1/tools/api_client_libraries/#python) Python client library:

```py
from influxdb import InfluxDBClient

# Instantiate a client for writing to InfluxDB Cloud Dedicated v1 API
client = InfluxDBClient(
  host='cluster-id.a.influxdb.io',
  ssl=True,
  database='DATABASE_NAME',
  username='',
  password='DATABASE_TOKEN',
  headers={'Content-Type': 'text/plain; charset=utf-8'}
)
```

### v2 client libraries

v2 client libraries send data in [line protocol](/influxdb3/cloud-dedicated/reference/syntax/line-protocol/) syntax to the v2 API `/api/v2/write` endpoint.

For more information about using v2 client libraries, see [v2 client libraries](/influxdb3/cloud-dedicated/reference/client-libraries/v2/).

## Telegraf configuration

If you have existing v1 workloads that use Telegraf,
you can use the [InfluxDB v1.x `influxdb` Telegraf output plugin](/telegraf/v1/output-plugins/influxdb/) to write data.

The following table shows `outputs.influxdb` plugin parameters and values for writing to the InfluxDB Cloud Dedicated v1 API:

|    Parameter     |        Ignored         |                               Value                               |
|------------------|------------------------|-------------------------------------------------------------------|
|    `database`    |        Honored         |                           Database name                           |
|`retention_policy`|Honored, but discouraged|[Duration](/influxdb3/cloud-dedicated/reference/glossary/#duration)|
|    `username`    |        Ignored         |                          String or empty                          |
|    `password`    |        Honored         |         [token](/influxdb/cloud-dedicated/admin/tokens/)          |

`content_encoding` | Honored | `gzip` (compressed data) or `identity` (uncompressed)`skip_database_creation` | Ignored | N/A (see how to [create a database](/influxdb3/cloud-dedicated/admin/databases/create/))

To configure the v1.x output plugin for writing to InfluxDB Cloud Dedicated, add the following `outputs.influxdb` configuration in your `telegraf.conf` file:

```toml
[[outputs.influxdb]]
  urls = ["https://cluster-id.a.influxdb.io"]
  database = "DATABASE_NAME"
  skip_database_creation = true
  retention_policy = ""
  username = "ignored"
  password = "DATABASE_TOKEN"
  content_encoding = "gzip"
```

Replace the following configuration values:

* `DATABASE_NAME`:
  the name of the [database](/influxdb3/cloud-dedicated/admin/databases/) to write to
* `DATABASE_TOKEN`:
  your InfluxDB Cloud Dedicated [token](/influxdb/cloud-dedicated/admin/tokens/)

#### Related

* [Line protocol reference](/influxdb3/cloud-dedicated/reference/syntax/line-protocol/)
* [Get started writing data](/influxdb3/cloud-dedicated/get-started/write/)
* [InfluxDB v2 API client libraries](/influxdb3/cloud-dedicated/reference/client-libraries/v2/)
* [Use the InfluxDB v2 API with InfluxDB Cloud Dedicated](/influxdb3/cloud-dedicated/guides/api-compatibility/v2/)
* [Use the InfluxDB v1 API with InfluxDB Cloud Dedicated](/influxdb3/cloud-dedicated/guides/api-compatibility/v1/)
| Parameter | Allowed in | Ignored | Value |
| --- | --- | --- | --- |
| Parameter | Allowed in | Ignored | Value |
| bucket   * | Query string | Honored | Database name |
| precision | Query string | Honored | Timestamp precision |
| Content-Encoding | Header | Honored | gzip  (compressed data) or  identity  (uncompressed) |
| Authorization | Header | Honored | Bearer DATABASE_TOKEN  or  Token DATABASE_TOKEN |

| Parameter | Allowed in | Ignored | Value |
| --- | --- | --- | --- |
| Parameter | Allowed in | Ignored | Value |
| consistency | Query string | Ignored | N/A |
| db   * | Query string | Honored | Database name |
| precision | Query string | Honored | Timestamp precision |
| rp | Query string | Honored, but discouraged | Retention policy |
| u | Query string | Ignored | For  query string authentication , any arbitrary string |
| p | Query string | Honored | For  query string authentication , a  token |

| Parameter | Ignored | Value |
| --- | --- | --- |
| Parameter | Ignored | Value |
| database | Honored | Database name |
| retention_policy | Honored, but discouraged | Duration |
| username | Ignored | String or empty |
| password | Honored | token |
