List PlanetScale organizations
List the PlanetScale organizations that the connected PlanetScale account can see. The list has every organization the PlanetScale user belongs to, also the ones they did not share with Unkey. integrations.planetscale.listOrganizationDatabases answers 403 for an organization that is not shared.
Use it to get the organization name for databases.connectDatabase and databases.createDatabase when no database is connected yet. Then every database in databases.listDatabases has it.
The organizations 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
Response
One page of the organizations that the PlanetScale account can see.