> ## Documentation Index
> Fetch the complete documentation index at: https://lava.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PlanetScale

> PlanetScale database management API for managing organizations, databases, branches, and deploy requests.

PlanetScale database management API for managing organizations, databases, branches, and deploy requests. Best for database automation workflows — creating branches for schema changes, managing deploy requests, and monitoring database health. Unlike Vercel (hosting/deployment), PlanetScale handles the database layer with Git-like branching for schema management.

6 example endpoints available through Lava's AI Gateway. See the [PlanetScale API docs](https://api-docs.planetscale.com) for full documentation.

<Warning>This provider requires your own credentials — connect your API key or OAuth account before use.</Warning>

<Info>This is a **catch-all provider** — any valid URL under `https://api.planetscale.com/v1` is supported. Any PlanetScale API endpoint. Construct URL as [https://api.planetscale.com/v1/\&#123;path\&#125](https://api.planetscale.com/v1/\&#123;path\&#125);. The endpoints below are curated examples.</Info>

## Endpoints

### List organizations

**GET** `https://api.planetscale.com/v1/organizations` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.planetscale.com/v1/organizations', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.planetscale.com%2Fv1%2Forganizations" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### List databases

**GET** `https://api.planetscale.com/v1/organizations/{org}/databases` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.planetscale.com/v1/organizations/{org}/databases', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.planetscale.com%2Fv1%2Forganizations%2F%7Borg%7D%2Fdatabases" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### List database branches

**GET** `https://api.planetscale.com/v1/organizations/{org}/databases/{db}/branches` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.planetscale.com/v1/organizations/{org}/databases/{db}/branches', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.planetscale.com%2Fv1%2Forganizations%2F%7Borg%7D%2Fdatabases%2F%7Bdb%7D%2Fbranches" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Create a database branch

**POST** `https://api.planetscale.com/v1/organizations/{org}/databases/{db}/branches` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.planetscale.com/v1/organizations/{org}/databases/{db}/branches', { body: {"name":"feature-branch","parent_branch":"main"} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.planetscale.com%2Fv1%2Forganizations%2F%7Borg%7D%2Fdatabases%2F%7Bdb%7D%2Fbranches" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"name":"feature-branch","parent_branch":"main"}'
    ```
  </Tab>
</Tabs>

### Update database settings

**PATCH** `https://api.planetscale.com/v1/organizations/{org}/databases/{db}` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.planetscale.com/v1/organizations/{org}/databases/{db}', { method: 'PATCH', body: {"production_branch_web_console":true} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X PATCH "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.planetscale.com%2Fv1%2Forganizations%2F%7Borg%7D%2Fdatabases%2F%7Bdb%7D" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"production_branch_web_console":true}'
    ```
  </Tab>
</Tabs>

### Delete a database branch

**DELETE** `https://api.planetscale.com/v1/organizations/{org}/databases/{db}/branches/{branch}` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.planetscale.com/v1/organizations/{org}/databases/{db}/branches/{branch}', { method: 'DELETE' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X DELETE "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.planetscale.com%2Fv1%2Forganizations%2F%7Borg%7D%2Fdatabases%2F%7Bdb%7D%2Fbranches%2F%7Bbranch%7D" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json"
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="All Providers" icon="grid" href="/gateway/supported-providers">
    Browse all supported AI providers
  </Card>

  <Card title="Forward Proxy" icon="route" href="/gateway/forward-proxy">
    Learn how to construct proxy URLs and authenticate requests
  </Card>
</CardGroup>
