List the databases of a PlanetScale organization
List the databases of a PlanetScale organization that the connected PlanetScale account can see.
Use it to find the database to pass to databases.connectDatabase. Get the organization from integrations.planetscale.listOrganizations.
The databases come from PlanetScale at the time of the request. Nothing is cached. Results are paginated; when hasMore is true, pass the returned cursor to fetch the next page.
Important: the workspace must have a PlanetScale account connected. Without one you get a 404. If PlanetScale refuses the connection, you get a 412 and must connect PlanetScale 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/*#read(any PlanetScale account of the workspace)unkey:v1:<workspace_id>:planetscale/accounts/<account_id>#read(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.
Body
Pagination cursor from a previous response to fetch the next page.
Use when hasMore: true in the previous response, and send the same
limit again. If a database is created or deleted between two requests,
the next page can skip a database or repeat one.
^[1-9][0-9]{0,8}$"2"
Response
One page of the databases of the organization.