Docs Home Return to Homepage
Get Started Login

CraneBase

CraneBase endpoints work on the account’s CraneBase (managed database) services, with a full access key or a key scoped to the service. Reads (every GET, the backup download link included) need the scope’s read permission; everything that changes something needs write. A service that isn’t on the account, or isn’t a CraneBase service, is 404; a key without the permission gets 403. The plan sets how many databases and snapshots a service may hold, and going over is refused with 400. When the database server refuses a change or can’t be reached, the call fails with 400 and the server’s message (500 with a general one for snapshots and deletes).

Names: CraneBase puts sql{serviceId}_ in front of every database and user you create, so shop on service 1042 becomes sql1042_shop. Everywhere else (paths, grant, revoke, snapshots, restores) takes the full name, as the list endpoints return it.

Hosts: a database user can only connect from the service’s hosts (an IPv4 address, or % for any address). A new user is set up on every host, and a new host gets every existing user. A user with webadmin can also sign in to phpMyAdmin.

List Services

GET /cranebase/services Returns the client's CraneBase services, with how many databases and users each has. Scoped keys only see services they can read. Response [ { "id": 1042, "name&...

List Databases

GET /cranebase/services/{serviceId}/databases size is in bytes and size_gb the same in GB. Sizes are refreshed periodically, not on each call. Response [ { "name": "sql1042_shop",...

Create Database

POST /cranebase/services/{serviceId}/databases Creates an empty database. 400 when the plan's database limit is reached or the name is taken. Parameters Field Type Required Description name string Yes...

Delete Database

DELETE /cranebase/services/{serviceId}/databases/{databaseName} {databaseName} is the full name. Takes every user's access away, then drops the database and all its data. This can't be undone. 404 whe...

List Database Users

GET /cranebase/services/{serviceId}/users Response [ { "username": "sql1042_app", "permissions": ["SELECT", "INSERT", "UPDATE", "DELETE...

Create Database User

POST /cranebase/services/{serviceId}/users Creates a user on every host. 400 when the name is taken, 404 when database doesn't exist. Parameters Field Type Required Default Description username string...

Update Database User

PUT /cranebase/services/{serviceId}/users/{username} {username} is the full name. Changes only the fields given; the rest keep their current values. New permissions apply to every database the user ha...

Delete Database User

DELETE /cranebase/services/{serviceId}/users/{username} {username} is the full name. Removes the user from every host. 404 when there's no such user. Response { "message": "User deleted...

Grant Database Access

POST /cranebase/services/{serviceId}/grant Gives a user its permissions on a database. 404 when either doesn't exist, 400 when the user already has access. Parameters Field Type Required Description u...

Revoke Database Access

POST /cranebase/services/{serviceId}/revoke Takes a user's access to a database away. 404 when either doesn't exist. Parameters Field Type Required Description username string Yes Full user name datab...

List Hosts

GET /cranebase/services/{serviceId}/hosts Response [ { "hostname": "203.0.113.10", "description": "Web server", "is_active": true, "created_at&qu...

Add Host

POST /cranebase/services/{serviceId}/hosts Lets the service's users connect from another address. Every existing user is set up on the new host with the access it has now. 400 when the host is already...

Delete Host

DELETE /cranebase/services/{serviceId}/hosts/{hostname} {hostname} is the address as listed (send % as %25). The service's users can no longer connect from it. 404 when there's no such host. Response...

List Backups

GET /cranebase/services/{serviceId}/backups Newest first. type is snapshot (one you took, counted against the plan's snapshot limit) or backup (an automatic backup). status is queued, running, complet...

Create Snapshot

POST /cranebase/services/{serviceId}/backups Queues a snapshot of a database; List Backups shows when it's completed. 404 when the database doesn't exist, 400 when the plan's snapshot limit is reached...

Restore Backup

POST /cranebase/services/{serviceId}/backups/{backupUuid}/restore Queues a restore of a completed backup into one of the service's databases (its own or another), replacing what's in it. 404 when the...

Delete Snapshot

DELETE /cranebase/services/{serviceId}/backups/{backupUuid} Only snapshots can be deleted: 404 for an automatic backup or an unknown UUID. Response { "message": "Snapshot deleted."...

Download Backup

GET /cranebase/services/{serviceId}/backups/{backupUuid}/download Returns a direct download link for a completed backup. Anyone with the link can download the backup, so treat it like a password. 404...

List Tasks

GET /cranebase/services/{serviceId}/tasks The service's 50 latest changes, newest first, whether made here or in the client portal, with the address each came from. action is one of create_database, d...

Snagged on something?

Our sysadmins answer tickets around the clock.