Delete connection
Delete one connection of an environment to a resource. New deployments of the environment no longer get what the connection gave them. The resource itself stays as it is.
The connection is deleted at once.
planetscale_database
New deployments get no URL of the database anymore, and the database stays connected to the project. The credentials that deployments got from the connection are deleted in PlanetScale in the background, which can finish before or after the response. A deployment that runs loses its database access when its credential is deleted, so make sure that running deployments no longer need the database before you delete the connection. If a delete fails, Unkey tries again later, so no credential stays.
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>:projects/*/apps/*/environments/*/connections/*#delete(to delete any connection)unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/connections/*#delete(to delete the connections of one environment)unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/connections/<connection_id>#delete(to delete one connection)
Replace <workspace_id> with the authenticated workspace ID.
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.
Body
Response
The connection is deleted, and the cleanup at its provider is started.