curl -L -X GET 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/usage?from=2023-01-01T00:00:00Z&to=2023-02-01T00:00:00Z' \
-H 'Authorization: Bearer TOKEN'
import { createClient } from "@tursodatabase/api";
const turso = createClient({
org: "...",
token: "",
});
const usageStatsWithDate = await turso.databases.usage("my-db");
const usageStatsWithDate = await turso.databases.usage("my-db", {
from: new Date("2023-01-01"),
to: new Date("2023-02-01"),
});
const usageStatsWithString = await turso.databases.usage("my-db", {
from: "2023-01-01T00:00:00Z",
to: "2023-02-01T00:00:00Z",
});
{
"database": {
"uuid": "<unknown>",
"instances": [
{
"uuid": "cd831986-94e5-11ee-a6fe-7a52e1f7759a",
"usage": {
"rows_read": 0,
"rows_written": 0,
"storage_bytes": 4096,
"bytes_synced": 0
}
},
{
"uuid": "0be90471-6906-11ee-8553-eaa7715aeaf2",
"usage": {
"rows_read": 0,
"rows_written": 0,
"storage_bytes": 4096,
"bytes_synced": 0
}
}
],
"total": {
"rows_read": 0,
"rows_written": 0,
"storage_bytes": 8192,
"bytes_synced": 0
}
}
}{
"error": "invalid from parameter: parsing time \"2023-12-12T00:00:00\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"\" as \"Z07:00\""
}{
"error": "could not find database with name [databaseName]: record not found"
}Databases
Retrieve Database Usage
Fetch activity usage for a database in a given time period.
GET
/
v1
/
organizations
/
{organizationSlug}
/
databases
/
{databaseName}
/
usage
curl -L -X GET 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/usage?from=2023-01-01T00:00:00Z&to=2023-02-01T00:00:00Z' \
-H 'Authorization: Bearer TOKEN'
import { createClient } from "@tursodatabase/api";
const turso = createClient({
org: "...",
token: "",
});
const usageStatsWithDate = await turso.databases.usage("my-db");
const usageStatsWithDate = await turso.databases.usage("my-db", {
from: new Date("2023-01-01"),
to: new Date("2023-02-01"),
});
const usageStatsWithString = await turso.databases.usage("my-db", {
from: "2023-01-01T00:00:00Z",
to: "2023-02-01T00:00:00Z",
});
{
"database": {
"uuid": "<unknown>",
"instances": [
{
"uuid": "cd831986-94e5-11ee-a6fe-7a52e1f7759a",
"usage": {
"rows_read": 0,
"rows_written": 0,
"storage_bytes": 4096,
"bytes_synced": 0
}
},
{
"uuid": "0be90471-6906-11ee-8553-eaa7715aeaf2",
"usage": {
"rows_read": 0,
"rows_written": 0,
"storage_bytes": 4096,
"bytes_synced": 0
}
}
],
"total": {
"rows_read": 0,
"rows_written": 0,
"storage_bytes": 8192,
"bytes_synced": 0
}
}
}{
"error": "invalid from parameter: parsing time \"2023-12-12T00:00:00\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"\" as \"Z07:00\""
}{
"error": "could not find database with name [databaseName]: record not found"
}curl -L -X GET 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/usage?from=2023-01-01T00:00:00Z&to=2023-02-01T00:00:00Z' \
-H 'Authorization: Bearer TOKEN'
import { createClient } from "@tursodatabase/api";
const turso = createClient({
org: "...",
token: "",
});
const usageStatsWithDate = await turso.databases.usage("my-db");
const usageStatsWithDate = await turso.databases.usage("my-db", {
from: new Date("2023-01-01"),
to: new Date("2023-02-01"),
});
const usageStatsWithString = await turso.databases.usage("my-db", {
from: "2023-01-01T00:00:00Z",
to: "2023-02-01T00:00:00Z",
});
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
Response
Successful response
The database usage object, containg the total and individual instance usage for rows read and written, as well as the total storage size (in bytes).
Show child attributes
Show child attributes
Was this page helpful?