Turso

App · 20 actions

Manage Turso Cloud databases, groups and their configuration.

Actions

ActionWhat it does
Create databaseCreates a new database in a group for the organization or user.
Create groupCreates a new group for the organization or user.
Delete databaseDelete a database belonging to the organization or user.
Delete groupDelete a group belonging to the organization or user.
Get current userReturns information about the currently authenticated user.
Get databaseReturns a database belonging to the organization or user.
Get database configurationRetrieve an individual database configuration belonging to the organization or user.
Get database instanceReturn the individual database instance by name.
Get database statisticsFetch the top queries of a database, including the count of rows read and written.
Get database usageFetch activity usage for a database in a given time period.
Get groupReturns a group belonging to the organization or user.
Get group configurationRetrieve an individual group configuration belonging to the organization or user.
Get organizationRetrieve details of a specific organization.
List database instancesReturns a list of instances of a database.
List databasesReturns a list of databases belonging to the organization or user.
List groupsReturns a list of groups belonging to the organization or user.
List locationsReturns a list of locations where you can create or replicate databases.
List organizationsReturns a list of organizations the authenticated user owns or is a member of.
Update database configurationUpdate a database configuration belonging to the organization or user.
Validate platform tokenValidates an API token belonging to a user.

Create database

Creates a new database in a group for the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
NamenametextRequired
The name of the new database. Must contain only lowercase letters, numbers, dashes. No longer than 64 characters.
GroupgrouptextRequired
The name of the group where the database should be created. The group must already exist.
Seedseedobject
Seed.
Size limitsize_limittext
The maximum size of the database in bytes. Values with units are also accepted, e.g. 1mb, 256mb, 1gb.
Remote encryptionremote_encryptionobject
Encryption configuration for the database. Can be used when creating a new encrypted database, creating a encrypted database from upload (seed.type = "database_upload"), or forking from an encrypted database (required when the source database is encrypted).

Outputs

dataobject
Result.
Example output
{
  "data": {
    "database": {
      "DbId": "example",
      "Hostname": "example",
      "Name": "example"
    }
  }
}

Create group

Creates a new group for the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
NamenametextRequired
The name of the new group.
LocationlocationtextRequired
The location key for the new group.
Extensionsextensionstext
The extensions to enable for new databases created in this group. Users looking to enable vector extensions should instead use the native libSQL vector datatype.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "group": {
      "delete_protection": false,
      "locations": [],
      "name": "example",
      "primary": "example",
      "uuid": "example",
      "version": "example"
    }
  }
}

Delete database

Delete a database belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Database namedatabase_nametextRequired
The name of the database.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "database": "example"
  }
}

Delete group

Delete a group belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Group namegroup_nametextRequired
The name of the group.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "group": {
      "delete_protection": false,
      "locations": [],
      "name": "example",
      "primary": "example",
      "uuid": "example",
      "version": "example"
    }
  }
}

Get current user

Returns information about the currently authenticated user.

Inputs

None.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "user": {
      "avatarUrl": "example",
      "email": "example",
      "has_pending_invites": false,
      "mfa": false,
      "name": "example",
      "plan": "example",
      "username": "example"
    }
  }
}

Get database

Returns a database belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Database namedatabase_nametextRequired
The name of the database.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "database": {
      "DbId": "example",
      "Hostname": "example",
      "Name": "example",
      "block_reads": false,
      "block_writes": false,
      "delete_protection": false,
      "group": "example",
      "parent": {
        "branched_at": "example",
        "id": "example",
        "name": "example"
      },
      "primaryRegion": "example",
      "regions": []
    }
  }
}

Get database configuration

Retrieve an individual database configuration belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Database namedatabase_nametextRequired
The name of the database.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "allow_attach": false,
    "allowed_aws_vpc_ids": [],
    "allowed_ips": [],
    "block_reads": false,
    "block_writes": false,
    "delete_protection": false,
    "size_limit": "example"
  }
}

Get database instance

Return the individual database instance by name.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Database namedatabase_nametextRequired
The name of the database.
Instance nameinstance_nametextRequired
The name of the instance (location code).

Outputs

dataobject
Result.
Example output
{
  "data": {
    "instance": {
      "hostname": "example",
      "name": "example",
      "region": "example",
      "type": "example",
      "uuid": "example"
    }
  }
}

Get database statistics

Fetch the top queries of a database, including the count of rows read and written.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Database namedatabase_nametextRequired
The name of the database.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "top_queries": []
  }
}

Get database usage

Fetch activity usage for a database in a given time period.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Database namedatabase_nametextRequired
The name of the database.
Start timestart_timedate and time
The datetime to retrieve usage from in ISO 8601 format. Defaults to the current calendar month if not provided. Example: 2023-01-01T00:00:00Z
End timeend_timedate and time
The datetime to retrieve usage to in ISO 8601 format. Defaults to the current calendar month if not provided. Example: 2023-02-01T00:00:00Z

Outputs

dataobject
Result.
Example output
{
  "data": {
    "database": {
      "instances": [],
      "total": {
        "bytes_synced": 1,
        "rows_read": 1,
        "rows_written": 1,
        "storage_bytes": 1
      },
      "uuid": "example"
    }
  }
}

Get group

Returns a group belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Group namegroup_nametextRequired
The name of the group.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "group": {
      "delete_protection": false,
      "locations": [],
      "name": "example",
      "primary": "example",
      "uuid": "example",
      "version": "example"
    }
  }
}

Get group configuration

Retrieve an individual group configuration belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Group namegroup_nametextRequired
The name of the group.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "delete_protection": false
  }
}

Get organization

Retrieve details of a specific organization.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "organization": {
      "blocked_reads": false,
      "blocked_writes": false,
      "name": "example",
      "overages": false,
      "plan_id": "example",
      "plan_timeline": "example",
      "platform": "example",
      "require_mfa": false,
      "restore_enabled": false,
      "slug": "example",
      "type": "example"
    }
  }
}

List database instances

Returns a list of instances of a database. Instances are the individual primary or replica databases in each region defined by the group.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Database namedatabase_nametextRequired
The name of the database.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "instances": []
  }
}

List databases

Returns a list of databases belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Groupgrouptext
Filter databases by group name.
Schemaschematext
The schema database name that can be used to get databases that belong to that parent schema.
Parentparenttext
Filter database branches by using their parent database ID.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "databases": []
  }
}

List groups

Returns a list of groups belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "groups": []
  }
}

List locations

Returns a list of locations where you can create or replicate databases.

Inputs

None.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "locations": {}
  }
}

List organizations

Returns a list of organizations the authenticated user owns or is a member of.

Inputs

None.

Outputs

datalist
Result.
Example output
{
  "data": []
}

Update database configuration

Update a database configuration belonging to the organization or user.

Inputs

Organization slugorganization_slugtextRequired
The slug of the organization or user account.
Database namedatabase_nametextRequired
The name of the database.
Size limitsize_limittext
The maximum size of the database in bytes. Values with units are also accepted, e.g. 1mb, 256mb, 1gb.
Allow attachallow_attachtrue/false
Allow or disallow attaching databases to the current database.
Block readsblock_readstrue/false
Block all database reads.
Block writesblock_writestrue/false
Block all database writes.
Delete protectiondelete_protectiontrue/false
Prevent the database from being deleted.
Allowed ipsallowed_ipslist
List of allowed IP addresses and CIDR blocks. Only connections from these sources are accepted. Pass an empty array to clear the list. Omit to leave unchanged.
Allowed aws vpc IDSallowed_aws_vpc_idslist
List of allowed AWS VPC endpoint IDs (vpce-...). Only connections arriving through these endpoints are accepted. Pass an empty array to clear the list. Omit to leave unchanged.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "allow_attach": false,
    "allowed_aws_vpc_ids": [],
    "allowed_ips": [],
    "block_reads": false,
    "block_writes": false,
    "delete_protection": false,
    "size_limit": "example"
  }
}

Validate platform token

Validates an API token belonging to a user.

Inputs

None.

Outputs

dataobject
Result.
Example output
{
  "data": {
    "exp": 1
  }
}

On this page