Signup or Login using the Turso CLI

Make sure to install the Turso CLI if you haven’t already.

turso auth signup

Retrieve your account or organization slug

The Platform API can be used with your personal account or with an organization. You’ll need the obtain the slug of your account or organization using using the Turso CLI:

turso org list

Create a new Platform API Token

Now create a new API Token using the Turso CLI:

turso auth api-tokens mint quickstart

Make sure to save the token somewhere safe. We’ll need it next.


Fetch available Locations

Before we can create a group or database in a specific region, we’ll need to fetch the list of available regions:

curl -L 'https://api.turso.tech/v1/locations' \
  -H 'Authorization: Bearer TOKEN' \

The organizationName is the name of your organization or personal account.


Create a Group

All databases belong to a group that can exist in one or more locations.

Begin by creating a group, giving it a name and primary location:

curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationName}/groups' \
  -H 'Authorization: Bearer TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
      "name": "default",
      "location": "lhr"

Create a Database

Now create your first database in the group you created above:

curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationName}/databases' \
  -H 'Authorization: Bearer TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
      "name": "my-db",
      "group": "default"

Replicate Database to another region

Add another location to your group to replicate your database to another region:

curl -L -X POST 'https://api.turso.tech/v1/organizations/{organizationName}/groups/{groupName}/locations/{location}' \
  -H 'Authorization: Bearer TOKEN'