# Quickstart

> Get started with Turso API in a few easy steps.
> Canonical HTML: https://tursodb.cn/docs/api-reference/quickstart/
> Upstream Source (MIT): https://docs.turso.tech/api-reference/quickstart
> Language: en

---
<div class="doc-callout doc-callout-info"><div class="doc-callout-title">NOTE</div><div class="doc-callout-body">

**Using TypeScript?** You can skip the raw HTTP examples and use the [`@tursodatabase/api`](https://www.npmjs.com/package/@tursodatabase/api) client instead. See the [SDK quickstart](/docs/api-reference/introduction/#quickstart-with-the-typescript-sdk).

</div></div>


**1. Signup or Login using the Turso CLI**

Make sure to [install the Turso CLI](/docs/cli/installation/) if you haven't
already.

```bash Signup
turso auth signup
```

```bash Login
turso auth login
```

**2. 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:

```bash
turso org list
```

**3. Create a new Platform API Token**

Now create a new API Token using the Turso CLI:

```bash
turso auth api-tokens mint quickstart
```

You can scope the token to a specific organization with `--org`:

```bash
turso auth api-tokens mint quickstart --org my-org
```

<div class="doc-callout doc-callout-info"><div class="doc-callout-title">NOTE</div><div class="doc-callout-body">

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

</div></div>


**4. 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:

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

```ts Node.js
import { createClient } from "@tursodatabase/api";

const turso = createClient({
  org: "...",
  token: "",
});

const locations = await turso.locations.list();
```

<div class="doc-callout doc-callout-info"><div class="doc-callout-title">NOTE</div><div class="doc-callout-body">

The `organizationSlug` is the name of your organization or personal account.

</div></div>


**5. 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`:

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

```ts Node.js
import { createClient } from "@tursodatabase/api";

const turso = createClient({
  org: "...",
  token: "",
});

const group = await turso.groups.addLocation("default", "lhr");
```

**6. Create a Database**

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

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

```ts Node.js
import { createClient } from "@tursodatabase/api";

const turso = createClient({
  org: "...",
  token: "",
});

const database = await turso.databases.create("my-db", "ams");
```

**7. Connect to your database**

You now have a database, distributed across multiple regions that you can connect to using one of the official or experimental SDKs:

<div class="doc-cards">
<a class="doc-card" href="/docs/sdk/ts/quickstart/"><div class="doc-card-title"><span>TypeScript</span><span class="doc-card-arrow" aria-hidden="true">→</span></div></a>
<a class="doc-card" href="/docs/sdk/rust/quickstart/"><div class="doc-card-title"><span>Rust</span><span class="doc-card-arrow" aria-hidden="true">→</span></div></a>
<a class="doc-card" href="/docs/sdk/go/quickstart/"><div class="doc-card-title"><span>Go</span><span class="doc-card-arrow" aria-hidden="true">→</span></div></a>
<a class="doc-card" href="/docs/sdk/python/quickstart/"><div class="doc-card-title"><span>Python</span><span class="doc-card-arrow" aria-hidden="true">→</span></div></a>
<div class="doc-card doc-card-static"><div class="doc-card-title"><span>Android</span></div></div>
<a class="doc-card" href="/docs/sdk/swift/quickstart/"><div class="doc-card-title"><span>Swift</span><span class="doc-card-arrow" aria-hidden="true">→</span></div></a>
<a class="doc-card" href="/docs/sdk/php/quickstart/"><div class="doc-card-title"><span>PHP</span><span class="doc-card-arrow" aria-hidden="true">→</span></div></a>
<div class="doc-card doc-card-static"><div class="doc-card-title"><span>Ruby</span></div></div>
<div class="doc-card doc-card-static"><div class="doc-card-title"><span>Ruby on Rails</span></div></div>
<div class="doc-card doc-card-static"><div class="doc-card-title"><span>C</span></div></div>
</div>
<div class="doc-cards">

</div>
