Disconnect PlanetScale
Disconnect PlanetScale from your workspace. The request takes no parameters. Your databases stay in PlanetScale.
The response comes at once, and Unkey does the disconnect after it, usually within seconds. It removes every database from every project of the workspace:
- It deletes all connections of environments to those databases.
- It deletes, in PlanetScale, the credentials that deployments have for those databases. A deployment that runs loses its access to the database.
- It removes the databases and the PlanetScale account, and revokes its access to PlanetScale.
Until then, databases.listDatabases still returns the databases. Unkey retries a failed delete on its own.
If Unkey has lost its access to PlanetScale while deployments have credentials, it cannot delete them, and you get a 412. Connect PlanetScale again, then send the request again.
The workspace must have the databases, connections and app_v2 flags. Without them you get a 403.
Required Permissions
Your root key must have one of the following permissions:
unkey:v1:<workspace_id>:planetscale/accounts/*#delete(any PlanetScale account of the workspace)unkey:v1:<workspace_id>:planetscale/accounts/<account_id>#delete(the connected account)
Replace <workspace_id> with the authenticated workspace ID. A key that cannot read the account gets a 404, as if no account were connected.
Authorizations
Unkey uses bearer tokens for authentication. Public integrations use root keys, while the dashboard proxy uses short-lived JWTs. To authenticate, include the token in the Authorization header of each request:
Root keys have specific permissions attached to them, controlling what operations they can perform. Resource permissions use Unkey Resource Names plus actions, like unkey:v1:ws_123:projects/*/keyspaces/*/keys/*#write.
Security best practices:
- Keep root keys secure and never expose them in client-side code
- Use different root keys for different environments
- Rotate keys periodically, especially after team member departures
- Create keys with minimal necessary permissions following least privilege principle
- Monitor key usage with audit logs.
Response
The connections are deleted. Unkey removes the credentials, the databases and the PlanetScale account, at once or in the background.