W↓
All docs
🔑
Sign Up/Sign In
docs.turso.tech/cli/
Public Link
Apr 6, 2025, 5:06:59 PM - complete - 24.1 kB
Starting URLs:
https://docs.turso.tech/cli/
## Page: https://docs.turso.tech/cli/ The Turso CLI gives you everything you need from the command line to manage your database, API tokens, inviting users, and launching the database shell. If you’re waiting for a migration to run, there’s also a relax command. You can also programmatically manage your Turso account, including groups, databases, organizations and invites using the Platform API. 1 2 3 Operate The Turso CLI provides the following commands: | Command | Description | | --- | --- | | `auth` | Authenticate and manage API tokens. | | `contact` | Submit your feedback, ideas and create a meeting with the team. | | `db` | Create and manage databases, access tokens and connect to the shell. | | `dev` | Run Turso locally for development. | | `group` | Create groups for databases with a shared location. | | `org` | Manage billing and invite members. | | `plan` | `overages`, `select`, `show`, `upgrade` | | `quickstart` | Get started with Turso in 5 minutes. | | `relax` | Take some time out and relax with Turso. | | `update` | Update to the Turso CLI to the latest version with one command. | --- ## Page: https://docs.turso.tech/cli/introduction The Turso CLI gives you everything you need from the command line to manage your database, API tokens, inviting users, and launching the database shell. If you’re waiting for a migration to run, there’s also a relax command. You can also programmatically manage your Turso account, including groups, databases, organizations and invites using the Platform API. 1 2 3 Operate The Turso CLI provides the following commands: | Command | Description | | --- | --- | | `auth` | Authenticate and manage API tokens. | | `contact` | Submit your feedback, ideas and create a meeting with the team. | | `db` | Create and manage databases, access tokens and connect to the shell. | | `dev` | Run Turso locally for development. | | `group` | Create groups for databases with a shared location. | | `org` | Manage billing and invite members. | | `plan` | `overages`, `select`, `show`, `upgrade` | | `quickstart` | Get started with Turso in 5 minutes. | | `relax` | Take some time out and relax with Turso. | | `update` | Update to the Turso CLI to the latest version with one command. | --- ## Page: https://docs.turso.tech/cli/installation ## macOS To install the Turso CLI on macOS, we recommend that you use Homebrew: If you don’t use Homebrew, you can use the following command to execute a shell script that installs the CLI: ## Linux Run the following command to execute a shell script that installs the CLI: ## Windows Installing the Turso CLI on Windows requires that you have WSL installed. Once WSL is installed, run the following in PowerShell: You can then execute the script to install the Turso CLI: ## Verify installation You must open a new shell to verify the installation with the following command: --- ## Page: https://docs.turso.tech/cli/authentication Turso CLI ## `login` The Turso CLI uses an access token to authenticate with Turso. You can login using the command: This will open a browser window, asking you to log into your account with GitHub. Once you’re logged in, you can manage your account and databases. You can explore all of the commands via the docs, or by using the `--help` flag for each subcommand: ## `signup` If you’re new to Turso, you can create an account using the Turso CLI: ## `logout` You can logout of the Turso CLI using the `logout` command: --- ## Page: https://docs.turso.tech/cli/upgrading Turso CLI Update the Turso CLI to the latest version to benefit from all the latest features, and fixes. ## macOS brew update brew upgrade ## Linux turso update ## Windows turso update Was this page helpful? Suggest editsRaise issue AuthenticationHelp --- ## Page: https://docs.turso.tech/cli/help You can always find a summary of all commands by running the following command: turso help You can also find out more about each command, as well as any required or optional arguments by passing the `--help` flag to the command: turso auth --help turso db create --help If you require support integrating Turso into your project, we can help. --- ## Page: https://docs.turso.tech/cli/headless-mode The Turso CLI will automatically attempt to open a browser, or wait for further instructions when interacting with various commands. You can opt out of this behaviour by passing the `--headless` flag with operations: turso auth login --headless If you’re using Windows with WSL or a remote CI/CD environment, pass the `--headless` flag. --- ## Page: https://docs.turso.tech/cli/auth To authenticate the Turso CLI with your account, run the following command: turso auth login If you’re using Windows with WSL or a remote CI/CD environment, pass the —headless flag. ## Flags | Flag | Description | | --- | --- | | `--headless` | Useful when the CLI can’t interact with the system’s web browser. | --- ## Page: https://docs.turso.tech/cli/contact You can book a meeting with the Turso team to discuss your project and requirements using the following command: turso contact bookmeeting You will be redirected to a webpage where you can select a date and time for the meeting. --- ## Page: https://docs.turso.tech/cli/db You can obtain a list of all databases for the current user or organization by running the following command: turso db list ## Flags | Flag | Description | | --- | --- | | `--group <group-name>` | Filter databases by group. | --- ## Page: https://docs.turso.tech/cli/group You can obtain a list of all groups by using the following command: turso group list --- ## Page: https://docs.turso.tech/cli/org To switch the current active organization for the CLI, use the following command: turso org switch <organization-slug> --- ## Page: https://docs.turso.tech/cli/plan You can show the current plan usage and limits with the command: turso plan show --- ## Page: https://docs.turso.tech/cli/auth/login To authenticate the Turso CLI with your account, run the following command: turso auth login If you’re using Windows with WSL or a remote CI/CD environment, pass the —headless flag. ## Flags | Flag | Description | | --- | --- | | `--headless` | Useful when the CLI can’t interact with the system’s web browser. | --- ## Page: https://docs.turso.tech/cli/auth/logout To logout of the Turso CLI, run the following command: turso auth logout ## Flags | Flag | Description | | --- | --- | | `-a, --all` | Invalidate all sessions for the current user. | --- ## Page: https://docs.turso.tech/cli/auth/signup To sign up for a new Turso account using the CLI, run the following command: turso auth signup If you’re using Windows with WSL or a remote CI/CD environment, pass the —headless flag. ## Flags | Flag | Description | | --- | --- | | `--headless` | Useful when the CLI can’t interact with the system’s web browser. | --- ## Page: https://docs.turso.tech/cli/auth/token You can obtain your current API token that is used to authenticate with the Turso Platform API by running the following command: turso auth token --- ## Page: https://docs.turso.tech/cli/auth/whoami You can obtain the username for the currently logged in user by running the following command: turso auth whoami --- ## Page: https://docs.turso.tech/cli/contact/bookmeeting You can book a meeting with the Turso team to discuss your project and requirements using the following command: turso contact bookmeeting You will be redirected to a webpage where you can select a date and time for the meeting. --- ## Page: https://docs.turso.tech/cli/contact/feedback You can send feedback to the Turso team by using the following command: turso contact feedback --- ## Page: https://docs.turso.tech/cli/auth/api-tokens/revoke To revoke an API token for the current organization, run the following command: turso auth api-tokens revoke <api-token-name> --- ## Page: https://docs.turso.tech/cli/db/list You can obtain a list of all databases for the current user or organization by running the following command: turso db list ## Flags | Flag | Description | | --- | --- | | `--group <group-name>` | Filter databases by group. | --- ## Page: https://docs.turso.tech/cli/db/create You can create a new database in a specific group using the following command: ## Flags | Flag | Description | | --- | --- | | `--enable-extensions` | Enables experimental support for SQLite extensions. | | `--from-csv` | Create the database from a csv file. | | `--csv-table-name` | Name of the table in the csv file. | | `--from-db` | Select another database to copy data from. | | `--timestamp` | Set a point in time in the past to copy data from the selected database. Must be used with the ‘from-db’ flag. Must be in RFC3339 format like ‘2023-09-29T10:16:13-03:00’ | | `--from-dump` | Create the database from a local SQLite dump. | | `--from-dump-url` | Create the database from a remote SQLite dump. | | `--from-file` | Create the database from a local SQLite3-compatible file. | | `--group` | Create the database in the specified group. | | `--size-limit` | The maximum size of the database in bytes. Values with units are also accepted, e.g. 1mb, 256mb, 1gb. | | `--canary` | Use database canary build. | | `-w`, `--wait` | Wait for the database to be ready to receive requests. | | `-h`, `--help` | Get help for create. | ## Examples The examples below outline the most common use cases for the `db create` command. ### Create database in a specific group You can create a new database in a specific group using the `--group` flag: ### Create database from SQLite file You can create a new Turso database from an existing SQLite file using the `--from-file` flag: ### Create database from SQLite dump You can create a new database using the output of `.dump` using the `--from-dump` flag: ### Create database from another existing database You can create a new Turso database from an existing database using the `--from-db` flag: ### Create database from a point in time You can create a new Turso database from an existing database at a specific point in time using the `--from-db` and `--timestamp` flags: ### Create database from a CSV file You can create a new Turso database from a CSV file using the `--from-csv` flag: ### Create a database with extensions enabled You can create a database with experimental support for SQLite extensions using the `--enable-extensions` flag: --- ## Page: https://docs.turso.tech/cli/db/import You can import an existing SQLite file to Turso Cloud using the following command: turso db import ~/path/to/database.db Make sure the SQLite file has WAL journal mode enabled. If you have more than one group, you will need to pass the `--group` flag. ## Flags | Flag | Description | | --- | --- | | `--group` | Import the database in the specified group. | | `-h`, `--help` | Get help for import. | --- ## Page: https://docs.turso.tech/cli/db/show You can obtain details about the database, including the name, ID, libSQL server version, group, size and location. turso db show <database-name> [flags] You can also obtain the different URLs for the database using the following: ## Flags | Flag | Description | | --- | --- | | `--url` | Show URL for the database HTTP API. | | `--http-url` | Show HTTP URL for the database HTTP API. | --- ## Page: https://docs.turso.tech/cli/db/destroy You can destroy a database by using the following command: turso db destroy <database-name> [flags] ## Flags | Flag | Description | | --- | --- | | `-y`, `--yes` | Confirms the destruction the database. | --- ## Page: https://docs.turso.tech/cli/db/inspect You can inspect the usage of a database, including the total space used, rows read and written with the following command: turso db inspect <database-name> ## Flags | Flag | Description | | --- | --- | | `--queries` | Show database query statistics. | | `--verbose` | Show detailed information, including the location and instance type. | ## Examples ### Top Queries You can fetch the most executed, resource-intensive SQL statements that have been run against your database using the Turso CLI: turso db inspect <database-name> --queries --- ## Page: https://docs.turso.tech/cli/db/shell You can connect directly to a Turso database by using the following command: ## Flags | Flag | Description | | --- | --- | | `--instance <instance>` | Connect to the specified database instance. | | `--location <location-code>` | Connect to the database at the specified location. | | `--proxy <url>` | The proxy to use when connecting to the database. | ## Examples ### Execute SQL You can execute SQL directly against a database using the shell: ### Database dump You can dump the contents of a Turso database using the following command: ### Load from dump You can load a dump file into a new database using the following command: ### Shell with libSQL server If you’re using `turso dev` locally, you can use the shell by providing the URL to your database: --- ## Page: https://docs.turso.tech/cli/db/locations You can fetch a list of supported locations where databases can be located by running the following command: turso db locations ## Flags | Flag | Description | | --- | --- | | `-l`, `--show-latencies` | Display latencies from your current location to each of Turso’s locations | --- ## Page: https://docs.turso.tech/cli/group/list You can obtain a list of all groups by using the following command: turso group list --- ## Page: https://docs.turso.tech/cli/group/create You can create a new group of databases. Groups belong to a primary region. turso group create <group-name> [flags] Creating more than one group is limited to Scaler, Pro and Enterprise plans. Turso will automatically detect the closest region and use that as the primary region. You can override this by specifying the `--location` flag. ## Flags | Flag | Description | | --- | --- | | `--canary` | Use database canary build. | | `--location` | Create the group in the specified priary location using a three-digit code. | | `-w`, `--wait` | Wait for group to be ready before exiting. | --- ## Page: https://docs.turso.tech/cli/group/update You can update the group, including all databases the following command: turso group update <group-name> [flags] ## Flags | Flag | Description | | --- | --- | | `--extensions string` | Enable extensions by passing `all` or `none`. | | `--version string` | Specify the version of the group to update to. Values include `latest` or `canary`. | | `-y`, `--yes` | Skip confirmation prompt and confirm. | ## Examples ### Update a group to enable all extensions You can update a group and all its databases to enable `all` extensions: turso group update <group-name> --extensions all --- ## Page: https://docs.turso.tech/cli/group/destroy You can destroy a group and all of its databases using the following command: turso group destroy <group-name> [flags] ## Flags | Flag | Description | | --- | --- | | `-y`, `--yes` | Confirms destroying the group, with all locations and databases. | --- ## Page: https://docs.turso.tech/cli/group/transfer You can transfer a group (including its databases) to an organization you’re an admin or owner of using the following command: turso group transfer <group-name> <organization-name> [flags] Existing database URL and tokens will continue to work, but should update your application to use the new URL and token as soon as possible. ## Flags | Flag | Description | | --- | --- | | `-y`, `--yes` | Confirms the transfer to a new organization. | --- ## Page: https://docs.turso.tech/cli/group/unarchive group You can unarchive inactive databases by running the following command: turso group unarchive <group-name> Databases get archived after 10 days of inactivity for users on a free plan — learn more. Was this page helpful? Suggest editsRaise issue invalidateswitch --- ## Page: https://docs.turso.tech/cli/dev Developers can build locally with Turso using either of the following methods: * SQLite — local SQLite database file * Turso CLI — managed libSQL server * Turso Database — remote Turso database ## Using a dump locally You can always dump your production database and use it locally for development: 1 2 3 ## SQLite There are a few things to keep in mind when using SQLite for local development: * Doesn’t have all the features of libSQL * Works with non-serverless based Turso SDKs When working with an SDK, you can pass it a `file:` URL to connect to a SQLite database file instead of a remote Turso database: ## Turso CLI If you’re using libSQL specific features like extensions, you should use the Turso CLI: This will start a local libSQL server and create a database for you. You can then connect to it using the `url` option in your SDK: If you want to persist changes, or use a production dump, you can pass the `--db-file` flag with the name of the SQLite file: ## Turso Database If you already have a database created with Turso, you can use that same one in development by passing the `url` option to your SDK. ## Connecting a GUI During development you can easily connect to a SQLite, libSQL, or Turso database using one of the tools below: * Beekeeper Studio — macOS, Linux, and Windows * Outerbase — Runs in the browser * TablePlus — macOS, Windows, and Linux * Dataflare — Paid (with limited free version) macOS, Windows, and Linux * Outerbase Studio - Runs in the browser * DBeaver - macOS, Windows, and Linux --- ## Page: https://docs.turso.tech/cli/org/switch To switch the current active organization for the CLI, use the following command: turso org switch <organization-slug> --- ## Page: https://docs.turso.tech/cli/org/list To list organizations of which you are the owner or a member, run the following command: turso org list --- ## Page: https://docs.turso.tech/cli/org/create To create a new organization that you own, run the following command: turso org create <name> You will be asked to add a payment method and subscribe to the Scaler plan to successfully create a new organization. --- ## Page: https://docs.turso.tech/cli/org/billing To open the billing portal for your organization: turso org billing --- ## Page: https://docs.turso.tech/cli/org/destroy To delete an existing organization that you own, run the following command: turso org destroy <organization-slug> You will need to transfer or delete any existing projects before you can delete an organization. Users cannot also destroy the a personal account or active organization. --- ## Page: https://docs.turso.tech/cli/plan/show You can show the current plan usage and limits with the command: turso plan show --- ## Page: https://docs.turso.tech/cli/plan/select You can switch your current plan at any time using the command: turso plan select You will need to add your credit card details to your account before you can upgrade to a paid plan. Learn more about pricing. --- ## Page: https://docs.turso.tech/cli/plan/upgrade You can upgrade your account to a paid plan at any time using the command: turso plan upgrade You will need to add your credit card details to your account before you can upgrade to a paid plan. --- ## Page: https://docs.turso.tech/cli/auth/api-tokens/mint To create a new API token for the current organization, run the following command: turso auth api-tokens mint <api-token-name> --- ## Page: https://docs.turso.tech/cli/auth/api-tokens/list To list all API tokens for the current organization, run the following command: turso auth api-tokens list --- ## Page: https://docs.turso.tech/cli/db/tokens/create You can create a new token that can be used to connect to one database using the command: ## Flags | Flag | Description | | --- | --- | | `-e`, `--expiration` | The expiration time for a token, can be `never` or a value in days, e.g. `7d` . | | `-r`, `--read-only` | Restrict the token to read only access. | ## Examples The examples below outline the most common use cases for the `db tokens create` command. ### Create a token with read only access You can create a token with read only access to a database using the following command: ### Create a token with a specific expiration time You can create a token with a specific expiration time using the following command: --- ## Page: https://docs.turso.tech/cli/group/tokens/create You can create a new token that can be used to connect to any database in the group using the command: ## Flags | Flag | Description | | --- | --- | | `-e`, `--expiration` | The expiration time for a token, can be `never` or a value in days, e.g. `7d` . | | `-r`, `--read-only` | Restrict the token to read only access. | ## Examples The examples below outline the most common use cases for the `group tokens create` command. ### Create a token with read only access You can create a token with read only access using the command: ### Create a token with a specific expiration time You can create a token with a specific expiration time using the command: --- ## Page: https://docs.turso.tech/cli/group/tokens/invalidate You can invalidate all tokens for a group by running the command: turso group tokens invalidate <group-name> [flags] ## Flags | Flag | Description | | --- | --- | | `-y`, `--yes` | Confirms the invalidation of all existing group tokens. | --- ## Page: https://docs.turso.tech/cli/org/members/list To list all members of the current active organization, run the following command: turso org members list This command is only available to active organizations, use `org switch` if you’re currently authenticated with your personal account. --- ## Page: https://docs.turso.tech/cli/org/members/rm To remove a member from the current organization, use the following command: turso org members rm <username> --- ## Page: https://docs.turso.tech/cli/plan/overages/disable You can disable overages for the current repository by running the following command: turso plan overages disable Any overages that have already been incurred will still be charged. --- ## Page: https://docs.turso.tech/cli/db/tokens/invalidate You can invalidate all tokens for a database by running the following command: turso db tokens invalidate <database-name> [flags] ## Flags | Flag | Description | | --- | --- | | `-y`, `--yes` | Confirms the invalidation of all existing db tokens. | All tokens in the group that provided database belongs will also be invalidated. This means that all existing tokens will no longer be valid and will need to be regenerated. --- ## Page: https://docs.turso.tech/cli/org/members/invite To invite someone who isn’t already a Turso user to the current active organization, run the following command: turso org members invite <email> [flags] ## Flags | Flag | Description | | --- | --- | | `-a`, `--admin` | Add the user as an admin. | --- ## Page: https://docs.turso.tech/cli/org/members/add To add an existing Turso user as a member to the current active organization, run the following command: turso org members add <username> [flags] ## Flags | Flag | Description | | --- | --- | | `-a`, `--admin` | Add the user as an admin. | --- ## Page: https://docs.turso.tech/cli/plan/overages/enable You can enable overages for the current repository by running the following command: turso plan overages enable