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

# /api/database/*

> Database configuration, testing, migration, import, and export endpoints.

# /api/database/\*

Endpoints for managing the database provider.

## GET /api/database/config

Returns the current database provider and whether it's configured.

```json theme={null}
{
  "provider": "sqlite",
  "configured": true
}
```

## POST /api/database/config

Sets a new database provider.

### Request body

```json theme={null}
{
  "provider": "turso",
  "config": {
    "url": "libsql://your-db.turso.io",
    "authToken": "your-token"
  }
}
```

Supported providers: `sqlite`, `supabase`, `turso`, `planetscale`.

## POST /api/database/test

Tests a database connection with the provided credentials.

### Request body

Same format as POST `/api/database/config`.

### Response

```json theme={null}
{ "success": true }
```

or

```json theme={null}
{ "success": false, "error": "Connection refused" }
```

## POST /api/database/migrate

Creates the required tables (`user_settings`, `api_cache`) in the current database provider.

### Response

```json theme={null}
{ "migrated": true }
```

<Note>
  For Supabase and PlanetScale, the endpoint returns the SQL statements for manual execution instead of running them directly.
</Note>

## GET /api/database/export

Exports all database data as JSON.

```json theme={null}
{
  "version": 1,
  "provider": "sqlite",
  "settings": {
    "projectOrder": ["goshuin-atlas", "front-end-checklist"]
  }
}
```

## POST /api/database/import

Imports a previously exported JSON dump.

### Request body

The JSON object returned by the export endpoint.
