Turso database

View as Markdown

A Turso Database artifact stores SQLite databases available over HTTP. Each artifact version is a separate database with its own address, which an application connects to with the Turso SDK and a personal access token.

Create a database

In Artifacts, click New artifact and select Turso Database. The database exists only after you create a version: in the Versions tab, click New version and enter a name, e.g. v1 or staging.

Image loading...Create a new version window of a Turso Database artifact

A version has its own tables, so it can serve as a separate database for an environment, a branch or a test.

What is the database URL?

The version address has the form https://<version>-<artifact>-<workspace>.turso-1.registry.sh, e.g.:

https://v1-my-app-db-my-workspace.turso-1.registry.sh

The Connect to database window, opened with a button in the artifact header, shows the full address with a code example.

Connect with the Turso SDK

The @tursodatabase/serverless client connects to the database over HTTP. As authToken, pass a personal access token with access to artifacts:

js
import { createClient } from '@tursodatabase/serverless/compat';

const db = createClient({
  url: 'https://v1-my-app-db-my-workspace.turso-1.registry.sh',
  authToken: process.env.ACCESS_TOKEN,
});

await db.execute('CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, body TEXT)');
await db.execute({ sql: 'INSERT INTO notes (body) VALUES (?)', args: ['hello'] });
const result = await db.execute('SELECT id, body FROM notes');

In a pipeline, save the token as an encrypted ACCESS_TOKEN variable and run the same code in a BUILD action with a Node.js image.

Image loading...Connect to database window with the Turso SDK snippet

Query the database over HTTP

The database also accepts queries without the SDK, on the /v2/pipeline endpoint with the token in the Authorization header:

bash
curl -sS "https://v1-my-app-db-my-workspace.turso-1.registry.sh/v2/pipeline" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"requests":[{"type":"execute","stmt":{"sql":"SELECT count(*) FROM notes"}},{"type":"close"}]}'
$$$$

The response is JSON with columns and rows in the results field.

Browse tables in the web interface

The Browse tab shows the tables of the selected version with the size of their data and indexes. Click a table to see its rows.

Image loading...Browse tab with a Turso database table

See also:

Last modified on Nov 26, 2026