# PlanetScale

Manage PlanetScale: databases, branches, deploy requests, backups, passwords. Exposes **30 actions** covering the API surface an agent needs - read and write.

## What it can do

| Method | What it does |
| --- | --- |
| `planetscale_organizations_list` | List organizations - GET /organizations. |
| `planetscale_organization_get` | Get one organization - GET /organizations/&#123;name&#125;. |
| `planetscale_databases_list` | List databases in an organization - GET /organizations/&#123;organization&#125;/databases. |
| `planetscale_database_get` | Get one database - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;. |
| `planetscale_database_create` | Create a database - POST /organizations/&#123;organization&#125;/databases. |
| `planetscale_database_delete` | Delete a database - DELETE /organizations/&#123;organization&#125;/databases/&#123;database&#125;. |
| `planetscale_branches_list` | List branches in a database - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches. |
| `planetscale_branch_get` | Get one branch - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches/&#123;branch&#125;. |
| `planetscale_branch_create` | Create a branch - POST /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches. |
| `planetscale_branch_delete` | Delete a branch - DELETE /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches/&#123;branch&#125;. |
| `planetscale_branch_promote` | Promote a branch to main - POST /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches/&#123;branch&#125;/promote. |
| `planetscale_branch_rotate_password` | Rotate a password on a branch - POST /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches/&#123;branch&#125;/passwords/&#123;password_id&#125;/rotate. |
| `planetscale_deploy_requests_list` | List deploy requests - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;/deploy-requests. |
| `planetscale_deploy_request_get` | Get one deploy request - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;/deploy-requests/&#123;number&#125;. |
| `planetscale_deploy_request_create` | Create a deploy request - POST /organizations/&#123;organization&#125;/databases/&#123;database&#125;/deploy-requests. |
| `planetscale_deploy_request_deploy` | Deploy a deploy request - POST /organizations/&#123;organization&#125;/databases/&#123;database&#125;/deploy-requests/&#123;number&#125;/deploy. |
| `planetscale_deploy_request_revert` | Revert a deploy request - POST /organizations/&#123;organization&#125;/databases/&#123;database&#125;/deploy-requests/&#123;number&#125;/revert. |
| `planetscale_deploy_request_close` | Close a deploy request - DELETE /organizations/&#123;organization&#125;/databases/&#123;database&#125;/deploy-requests/&#123;number&#125;. |
| `planetscale_backups_list` | List backups - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;/backups. |
| `planetscale_backup_get` | Get one backup - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;/backups/&#123;backup_id&#125;. |
| `planetscale_backup_create` | Create a backup - POST /organizations/&#123;organization&#125;/databases/&#123;database&#125;/backups. |
| `planetscale_passwords_list` | List passwords for a branch - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches/&#123;branch&#125;/passwords. |
| `planetscale_password_get` | Get one password - GET /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches/&#123;branch&#125;/passwords/&#123;password_id&#125;. |
| `planetscale_password_create` | Create a password - POST /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches/&#123;branch&#125;/passwords. |
| `planetscale_password_delete` | Delete a password - DELETE /organizations/&#123;organization&#125;/databases/&#123;database&#125;/branches/&#123;branch&#125;/passwords/&#123;password_id&#125;. |
| `planetscale_regions_list` | List available regions - GET /organizations/&#123;organization&#125;/regions. |
| `planetscale_oauth_applications_list` | List OAuth applications - GET /organizations/&#123;organization&#125;/oauth-applications. |
| `planetscale_oauth_application_get` | Get one OAuth application - GET /organizations/&#123;organization&#125;/oauth-applications/&#123;app_id&#125;. |
| `planetscale_oauth_application_create` | Create an OAuth application - POST /organizations/&#123;organization&#125;/oauth-applications. |
| `planetscale_oauth_application_delete` | Delete an OAuth application - DELETE /organizations/&#123;organization&#125;/oauth-applications/&#123;app_id&#125;. |

## How to get credentials

This connector uses an **API key / token**. Create one in the provider
dashboard, then paste it into FlyMyAI:

- **`PLANETSCALE_SERVICE_TOKEN_ID`** - PlanetScale - Settings - Service tokens - token id. (https://app.planetscale.com/)
- **`PLANETSCALE_SERVICE_TOKEN`** - The secret value shown when you create the service token.

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `PLANETSCALE_SERVICE_TOKEN_ID` | PlanetScale - Settings - Service tokens - token id. |
| `PLANETSCALE_SERVICE_TOKEN` | The secret value shown when you create the service token. |

## Troubleshooting

- **`401 Unauthorized` / `403 Forbidden`** - the token is wrong, expired, or missing a required scope; regenerate it.
- **`429 Too Many Requests`** - provider rate limit; retry after a short backoff.
- **Unexpected `4xx` on writes** - double-check required fields; the agent confirms before write actions.

## Links

- [PlanetScale API documentation](https://api-docs.planetscale.com)
