# Turso

Turso is a fully managed database platform built on libSQL, offering serverless SQLite databases with global replication and low-latency access.

- **Category:** databases
- **Auth:** API_KEY
- **Composio Managed App Available?** N/A
- **Tools:** 3
- **Triggers:** 0
- **Slug:** `TURSO`
- **Version:** 20260211_00

## Tools

### Closest Region

**Slug:** `TURSO_CLOSEST_REGION`

Tool to get the closest Turso region based on client location. Use when you need to minimize latency by selecting the nearest deployment region.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Listen To Changes

**Slug:** `TURSO_LISTEN_TO_CHANGES`

Listen to committed table changes in a Turso database via the /beta/listen endpoint. This tool streams real-time insert/update/delete events for a specific table. IMPORTANT: Requires a database-specific URL (e.g., 'https://mydb-myorg.turso.io'), NOT the platform API URL (api.turso.tech). Note: The /beta/listen endpoint is NOT available on AWS regions for Free, Developer, and Scaler plans. When unavailable, the action falls back to a /v2/pipeline health check.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `table` | string | Yes | Name of the table to listen for changes on (e.g., 'users', 'orders') |
| `action` | string ("insert" | "update" | "delete") | Yes | Type of change event to listen for: 'insert' (new rows), 'update' (modified rows), or 'delete' (removed rows) |
| `database_url` | string | Yes | The database-specific URL to connect to (e.g., 'https://mydb-myorg.turso.io'). This is NOT the platform API URL (api.turso.tech). Get this from the 'hostname' field when listing databases via the Platform API. |
| `database_token` | string | No | Optional database-specific JWT token for authentication. If not provided, a token will be automatically generated using the Platform API. You can create one via POST /v1/organizations/{org}/databases/{db}/auth/tokens |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Validate API Token

**Slug:** `TURSO_VALIDATE_API_TOKEN`

Validates a Turso API token and retrieves its expiration time. Use this action to verify that an API token is valid and check when it expires. Returns the token's expiration timestamp, or -1 if the token has no expiration.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `mode` | string | No | Validation mode: 'platform' (recommended) validates via the Platform API at https://api.turso.tech/v1/auth/validate and returns token expiration. 'pipeline' validates by executing a health-check SQL query against a database URL (requires a database-specific base_url like https://<db>-<user>.turso.io). 'auto' tries platform first, falling back to pipeline on failure. |
| `health_sql` | string | No | SQL statement to execute for health validation when mode is 'pipeline' or during 'auto' fallback. Only used when validating against a database instance. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
