Skip to main content

Connect with Node.js

Install Client Library

npm install @tdengine/rest


Run this command in your terminal to save TDengine cloud token as variables:

export TDENGINE_CLOUD_TOKEN="<token>"
export TDENGINE_CLOUD_URL="<url>"

Replace <token> and <url> with cloud token and URL. To obtain the value of cloud token and URL, please log in TDengine Cloud and click "Programming" on left menu, then select "Node.js".


const { options, connect } = require("@tdengine/rest");

async function test() {
options.url = process.env.TDENGINE_CLOUD_URL;
options.query = { token: process.env.TDENGINE_CLOUD_TOKEN };
let conn = connect(options);
let cursor = conn.cursor();
try {
let res = await cursor.query("show databases");
} catch (err) {


view source code

For how to write data and query data, please refer to Data In and Tools.

For more details about how to write or query data via REST API, please check REST API.