curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/auth/tokens?expiration=2w&authorization=full-access' \
-H 'Authorization: Bearer TOKEN'
import { createClient } from "@tursodatabase/api";
const turso = createClient({
org: "...",
token: "",
});
const token = await turso.databases.createToken("my-db", {
expiration: "2w",
authorization: "full-access",
});
{
"jwt": "TOKEN"
}
Databases
Generate Database Auth Token
Generates an authorization token for the specified database.
POST
/
v1
/
organizations
/
{organizationSlug}
/
databases
/
{databaseName}
/
auth
/
tokens
curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/auth/tokens?expiration=2w&authorization=full-access' \
-H 'Authorization: Bearer TOKEN'
import { createClient } from "@tursodatabase/api";
const turso = createClient({
org: "...",
token: "",
});
const token = await turso.databases.createToken("my-db", {
expiration: "2w",
authorization: "full-access",
});
{
"jwt": "TOKEN"
}
curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/auth/tokens?expiration=2w&authorization=full-access' \
-H 'Authorization: Bearer TOKEN'
import { createClient } from "@tursodatabase/api";
const turso = createClient({
org: "...",
token: "",
});
const token = await turso.databases.createToken("my-db", {
expiration: "2w",
authorization: "full-access",
});
{
"jwt": "TOKEN"
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The slug of the organization or user account.
The name of the database.
Query Parameters
Expiration time for the token (e.g., 2w1d30m).
Authorization level for the token (full-access or read-only).
Available options:
full-access, read-only Body
application/json
Additional context such as claims required for the token.
The permissions for the token.
Show child attributes
Show child attributes
Response
Successful response
The generated authorization token (JWT).
Was this page helpful?