Turso
Connect
Connect Turso from the terminal. Pass --help for the flags Turso accepts, plus --no-browser for headless environments.
polylane cloud connect --provider tursoA platform API token from your Turso organization settings or the Turso CLI.
Connect one Turso organization with a platform API token. Polylane encrypts the token before it stores it, and the agent never sees it.
- In Turso, open your organization settings and go to API Tokens. Or run
turso auth api-tokens mint polylane --org <organization>from the CLI. - Copy the platform API token.
- Paste the token into Polylane.
- Enter the organization slug. A Turso token is scoped to one organization, so Polylane cannot find the organization from the token alone.
- Polylane checks the token and starts the first sync.
Connect Turso from a CI job or any other environment without a browser.
You can connect Turso without a browser. A CI job can call the same endpoint that the console calls. One authenticated POST creates the connection and starts the first sync.
Prerequisites
- A Polylane API key with the
cloud_accounts:writeandcloud_accounts:readscopes. See API keys and OAuth. - Your workspace ID, which starts with
ws_. Read it fromGET /v1/workspaceswith the same key. - A Turso platform API token, minted in your organization settings or with
turso auth api-tokens mint polylane --org <organization>.
Create the connection
curl -X POST https://api.polylane.com/v1/cloud_accounts \
-H "x-api-key: $POLYLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "turso",
"workspaceId": "ws_0abc123",
"token": "<platform-api-token>",
"organization": "my-org-slug"
}'
One call connects one Turso organization.
- Always set
organization. A token that is scoped to one organization cannot list organizations, so the call fails without it.
The response lists the connected accounts, and the first sync is already running. This example shows only the two fields that the next steps read:
{
"success": true,
"result": {
"provider": "turso",
"accounts": [{ "id": "acc_34gky74ibc92h8t2efn8csrh", "status": "syncing" }],
"failures": []
}
}
An account that is already connected goes into failures, not accounts. A repeated call never makes a second connection.
Wait for the first sync
Poll each returned account by its id until status is ready. The status is new at registration and syncing while resources arrive:
until [ "$(curl -s "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY" | jq -r '.result.status')" = "ready" ]; do
sleep 15
done
Give the loop a deadline, so that a failed connection fails the job and does not stop it indefinitely. When the account is ready, its resources are in the topology and Polylane has started its first check.
Disconnect from the API
Deleting the connection stops every sync and check and deletes the credentials that Polylane held. The call needs the cloud_accounts:delete scope:
curl -X DELETE "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY"
Then revoke the Turso token, as the Disconnecting section tells.
How it works
Access
Polylane uses the Turso Platform API only. It does not connect to your databases and does not hold database credentials.
Infrastructure graph
Polylane syncs the organization every 15 minutes. It maps database groups and databases, with their locations, placement, branch parent and read and write status. A group contains its databases, a schema database manages the databases that use its schema, and a parent database defines each branch made from it.
Polylane stores the hostname of each database. A service elsewhere in your stack that connects to that hostname links to the database on the topology.
Usage checks
The Platform API gives usage as counters for the billing period, not as time series. Thus databases show no metric charts. Polylane reads the counters on each run and compares the change since the previous run with the history of the account. By default, it runs these checks every 30 minutes:
- Rows read and rows written per hour.
- Bytes synced per hour, which is the traffic of embedded replicas.
- Storage growth per hour, and the number of databases.
- The heaviest query across all active databases.
- Quota burn: the plan quota that is closest to its limit, projected to the end of the billing period. A projection above the quota adds a capacity warning to the check run. It does not open an issue alone.
Investigations
Polylane has no Turso agent tools. During an investigation, agents read the synced groups and databases, their links to other services, and the results of the checks.
Troubleshooting
"Turso does not recognize this platform API token" error
- A platform API token is different from a database auth token. Mint one with
turso auth api-tokens mint polylane --org <organization>or in your organization settings. - Make sure that the token is not revoked in Turso.
"This Turso token is scoped to one organization" error
- Enter the organization slug of the organization that the token was minted for.
"This Turso token cannot read the databases in this organization" error
- Make sure that the organization slug is the one that the token was minted for.
"Multiple Turso organizations are reachable" error
- The token can reach more than one organization. Name the organization to connect.
- With the API, set the
organizationfield to the organization slug.
Missing resources
- The first sync can take a few minutes.
- Click Sync in the account header to start a sync immediately.
Disconnecting
Disconnecting stops every sync and check, and deletes the token that Polylane stored. The token stays valid in Turso. Revoke it in your Turso organization settings or with turso auth api-tokens revoke.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in Turso is removed as well; nothing is left behind.
polylane cloud disconnect <id>Supported resources
2Resource types that show up in your infrastructure graph.