2020-07-29 21:07:24 +00:00
---
title: InfluxDB client libraries
2020-08-25 17:36:29 +00:00
description: >
2021-02-17 14:46:08 +00:00
InfluxDB client libraries includes support for Arduino, C#, C++, Go, Java, JavaScript, PHP, Python, and Ruby.
2020-07-29 21:07:24 +00:00
aliases:
2023-09-13 05:33:31 +00:00
- /influxdb/v1/clients/api_client_libraries/
- /influxdb/v1/clients/
- /influxdb/v1/clients/api
2020-07-29 21:07:24 +00:00
menu:
2023-09-13 05:33:31 +00:00
influxdb_v1:
2020-07-29 21:07:24 +00:00
weight: 30
parent: Tools
2023-09-13 05:33:31 +00:00
v2: /influxdb/v2/api-guide/client-libraries/
2020-07-29 21:07:24 +00:00
---
2024-09-26 17:07:10 +00:00
InfluxDB v2 client libraries are language-specific packages that integrate
with the InfluxDB v2 API and support both **InfluxDB 1.8+** and **InfluxDB 2.x** .
2020-07-29 21:07:24 +00:00
2023-11-06 23:55:26 +00:00
{{% note %}}
2024-09-26 17:07:10 +00:00
If you're getting started with InfluxDB v1, we recommend using the
InfluxDB v1 client libraries and InfluxQL for
[InfluxDB v3 compatibility ](/influxdb/v1/tools/api/#influxdb-v3-compatibility ).
For more information about API and client library compatibility, see the
[InfluxDB v1 API reference ](/influxdb/v1/tools/api/ ).
2023-11-06 23:55:26 +00:00
{{% /note %}}
2020-07-29 21:07:24 +00:00
## Client libraries
Functionality varies between client libraries. Refer to client libraries on GitHub for specifics regarding each client library.
### Arduino
- [InfluxDB Arduino Client ](https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino )
2023-08-03 00:52:10 +00:00
2020-07-29 21:07:24 +00:00
### C\#
- [influxdb-client-csharp ](https://github.com/influxdata/influxdb-client-csharp )
2021-02-17 14:46:08 +00:00
## C++
* [influxdb-cxx ](https://github.com/offa/influxdb-cxx )
2023-08-03 00:52:10 +00:00
2021-02-17 14:46:08 +00:00
2020-07-29 21:07:24 +00:00
### Go
- [influxdb-client-go ](https://github.com/influxdata/influxdb-client-go )
### Java
- [influxdb-client-java ](https://github.com/influxdata/influxdb-client-java )
### JavaScript
* [influxdb-javascript ](https://github.com/influxdata/influxdb-client-js )
2023-08-03 00:52:10 +00:00
2020-07-29 21:07:24 +00:00
### PHP
- [influxdb-client-php ](https://github.com/influxdata/influxdb-client-php )
2023-08-03 00:52:10 +00:00
2020-07-29 21:07:24 +00:00
### Python
* [influxdb-client-python ](https://github.com/influxdata/influxdb-client-python )
2023-08-03 00:52:10 +00:00
2020-07-29 21:07:24 +00:00
### Ruby
- [influxdb-client-ruby ](https://github.com/influxdata/influxdb-client-ruby )
2023-08-03 00:52:10 +00:00
2020-07-29 21:07:24 +00:00
## Install and use a client library
To install and use the Python client library, follow the [instructions below ](#install-and-use-the-python-client-library ). To install and use other client libraries, refer to the client library documentation for detail.
### Install and use the Python client library
1. Install the Python client library.
```sh
pip install influxdb-client
```
2. Ensure that InfluxDB is running. If running InfluxDB locally, visit http://localhost:8086. (If using InfluxDB Cloud, visit the URL of your InfluxDB Cloud UI.)
3. In your program, import the client library and use it to write data to InfluxDB. For example:
```sh
import influxdb_client
from influxdb_client.client.write_api import SYNCHRONOUS
```
4. Define your database and token variables, and create a client and writer object. The InfluxDBClient object takes 2 parameters: `url` and `token`
```sh
database = "< my-db > "
token = "< my-token > "
client = influxdb_client.InfluxDBClient(
url="http://localhost:8086",
token=token,
```
2023-11-06 23:55:26 +00:00
{{% note %}}
The database (and retention policy, if applicable) are converted to a
[bucket ](/influxdb/v2/reference/glossary/#bucket ) data store compatible with InfluxDB v2.
{{% /note %}}
2020-08-25 17:36:29 +00:00
2020-07-29 21:07:24 +00:00
5. Instantiate a writer object using the client object and the write_api method. Use the `write_api` method to configure the writer object.
```sh
client = influxdb_client.InfluxDBClient(url=url, token=token)
write_api = client.write_api(write_options=SYNCHRONOUS)
```
6. Create a point object and write it to InfluxDB using the write method of the API writer object. The write method requires three parameters: database, (optional) retention policy, and record.
2020-08-25 17:36:29 +00:00
```sh
2020-07-29 21:07:24 +00:00
p = influxdb_client.Point("my_measurement").tag("location", "Prague").field("temperature", 25.3)
write_api.write(database:rp, record=p)
```