Skip to content

Turso.API Token reference

Source: src/Turso/ApiToken.ts

A Turso API token. It lets an app create and delete groups and databases. To run SQL, use a DatabaseToken instead. Limit it to one group with group and scopes to give an app only the access it needs.

Turso only shows the token once, when it’s created, so Alchemy stores it in state as a Redacted value. Changing a prop creates a new token, and destroying it cancels the token.

Token for the whole organization

const token = yield* Turso.ApiToken("Ci", {});

Token that can only create databases in one group

const token = yield* Turso.ApiToken("Tenants", {
group: group.name,
scopes: ["read", "db:create", "db:delete", "db:mint-token"],
});