api.databases manages Square Cloud’s managed databases (MongoDB, MySQL, PostgreSQL and Redis). Every method except create and statusAll takes the database id first. To list your databases, use api.account.me(): its databases array has every database the key can see.
Database hosting needs a Standard, Pro or Enterprise plan.
Examples use the api client from Creating the client. databaseId is the id of one of your databases: api.account.me() lists them.
Creating a database
The
password and certificate are only returned by create() (and by resetCredentials()). The call waits at least 120 s before timing out.
Getting a database
Updating a database
update(databaseId, { name, ram }) renames or resizes a database. Pass at least one field (400 NO_UPDATE_DATA otherwise).
Start and stop
CONTAINER_ALREADY_STARTED, CONTAINER_ALREADY_STOPPED, CONTAINER_NOT_FOUND, CONTAINER_INSUFFICIENT_DISK_SPACE, CONTAINER_NETWORK_CONFLICT or ACTION_FAILED. While a snapshot restore runs, they are 403 RESTORE_IN_PROGRESS.
Status and metrics
status(databaseId) returns formatted values; { raw: true } returns numbers. statusAll() returns one summary per database. metrics(databaseId) returns the last 24 hours, one point every 5 minutes, newest first.
Credentials
certificate(databaseId) returns the TLS certificate as base64-encoded PEM. resetCredentials(databaseId, type) rotates the password (and returns the new one) or the certificate (and returns ""). The database must be running (400 DATABASE_NOT_RUNNING).
Deleting a database
Snapshots
api.databases.snapshots has the same list, create and restore as apps. See Snapshots.
Next steps
Workspaces
Share apps with your team.
Database API reference
The REST endpoints behind these methods.
Databases from the CLI
The same actions from the terminal.

