Postgres is in Alpha. It is a branchable Postgres 19 database for development and preview work, not production; each branch is a VM of its own that costs like one and sleeps when nobody uses it.
Create a database
Section titled “Create a database”Create makes the database and its main branch. size is the base memory of every branch, from 512 to 16384 MiB in steps of 512, and 512 when omitted. The create answer carries the password and URL once, so save them then. A plan that does not allow public ports cannot create a database.
- Open Databases.
- Select Create database.
- Enter
appin Name. - Enter
512in Size (MiB). - Select Create database. The
app is readydialog shows the connection; copy it before you select Done.
si org db create app --size 512id: 6f1c0f0e8aname: appbranches: mainuser: userurl: postgresql://user:...@db-app.default.internal:5432/postgreswss: wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432internal: db-app.default.internal:5432forward: si port forward 6f1c0f0e8a 5432rpo: last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview onlycurl -sS -X POST "https://api.slashinfra.com/databases" \ -H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \ -d '{"name":"app","size":512}'API reference: Control API operation
{"id":"6f1c0f0e8a","name":"app","project":"proj_6f1c0f0e8a","branches":["main"],"connection":{"wss":"wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432","internal":"db-app.default.internal:5432","url":"postgresql://user:...@db-app.default.internal:5432/postgres","forward":"si port forward 6f1c0f0e8a 5432","user":"user","password":"..."},"rpo":"last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview only"}import os, requests
res = requests.post( "https://api.slashinfra.com/databases", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"}, json={"name": "app", "size": 512},)res.raise_for_status()database = res.json()print(database["id"], database["connection"]["internal"])6f1c0f0e8a db-app.default.internal:5432const res = await fetch('https://api.slashinfra.com/databases', { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'app', size: 512 }),})if (!res.ok) throw new Error(await res.text())const database = (await res.json()) as { id: string; connection: { internal: string } }console.log(database.id, database.connection.internal)6f1c0f0e8a db-app.default.internal:5432A database belongs to the project in its project field, default when omitted. Its name is unique in that project; a duplicate answers 409 name_taken.
Connect to a database
Section titled “Connect to a database”The create answer carries the password and URL once. The password is also stored as the project secret db:app:main, and a branch gets db:app:preview with the password it copied. The API’s get and list never return the password or the URL. The secrets API refuses to change or delete a db: secret; it goes with the database.
| Field | What it is |
|---|---|
url |
postgresql://user:<password>@db-app.default.internal:5432/postgres, with the password percent-encoded |
internal |
db-app.default.internal:5432, the private name inside the project |
forward |
si port forward 6f1c0f0e8a 5432, the command that opens a local TCP port |
wss |
wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432, the public wsproxy endpoint |
user |
user, the one Postgres role in every branch |
password |
32 random bytes, base64url, answered once |
Scroll horizontally to see all columns.
Port 6543 is the wsproxy. It relays to Postgres on 127.0.0.1:5432 inside the VM. The endpoint is public because Postgres authenticates with SCRAM. A WebSocket driver such as @neondatabase/serverless uses it; psql speaks TCP, so it uses a forward or the private name.
From a VM of the same project, connect to db-app.default.internal:5432 with the same role and password. No key and no open port are needed.
From your laptop, open a forward and leave it running:
si port forward 6f1c0f0e8a 5432127.0.0.1:5432 -> SVM 6f1c0f0e8a:5432Ctrl-C closes every forwardIn a second terminal, connect with your password:
psql 'postgresql://user:YOUR_PASSWORD@127.0.0.1:5432/postgres' -c 'select 1' ?column?---------- 1(1 row)List databases
Section titled “List databases”List returns every database of one project, newest first, with its branches, its connection without the password and its RPO. A project with none gets [].
- Open Databases. The table lists Name, Branches, Private name and Recovery point.
si org db lsname id branches user internalapp 6f1c0f0e8a main user db-app.default.internal:5432curl -sS "https://api.slashinfra.com/databases" \ -H "Authorization: Bearer $SI_API_KEY"API reference: Control API operation
[{"id":"6f1c0f0e8a","name":"app","project":"proj_6f1c0f0e8a","branches":["main"],"connection":{"wss":"wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432","internal":"db-app.default.internal:5432","forward":"si port forward 6f1c0f0e8a 5432","user":"user"},"rpo":"last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview only"}]import os, requests
res = requests.get( "https://api.slashinfra.com/databases", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()for database in res.json(): print(database["name"], ",".join(database["branches"]))app mainconst res = await fetch('https://api.slashinfra.com/databases', { headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())const databases = (await res.json()) as { name: string; branches: string[] }[]for (const database of databases) console.log(database.name, database.branches.join(','))app mainGet a database
Section titled “Get a database”Get returns one database by name, with its branches and its connection without the password. An unknown name answers 404 database_not_found.
- Open Databases.
- Select
appin the table. Its Connection, Branches and Backups sections are on the same page.
si org db get appid: 6f1c0f0e8aname: appbranches: mainuser: userwss: wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432internal: db-app.default.internal:5432forward: si port forward 6f1c0f0e8a 5432rpo: last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview onlycurl -sS "https://api.slashinfra.com/databases/app" \ -H "Authorization: Bearer $SI_API_KEY"API reference: Control API operation
{"id":"6f1c0f0e8a","name":"app","project":"proj_6f1c0f0e8a","branches":["main"],"connection":{"wss":"wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432","internal":"db-app.default.internal:5432","forward":"si port forward 6f1c0f0e8a 5432","user":"user"},"rpo":"last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview only"}import os, requests
res = requests.get( "https://api.slashinfra.com/databases/app", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()database = res.json()print(database["name"], len(database["branches"]))app 1const res = await fetch('https://api.slashinfra.com/databases/app', { headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())const database = (await res.json()) as { name: string; branches: string[] }console.log(database.name, database.branches.length)app 1Create a branch
Section titled “Create a branch”A branch forks the disk of main or another branch and gets its own VM, CPU, memory and storage meter. Every branch uses the database size: each 512 MiB step gives 0.25 CPU, so a 512 MiB branch has 0.25 CPU and a 0.5 CPU ceiling. A branch counts as a VM against the plan’s 5 or 50 VMs. CPU and memory count while it runs, and storage counts while it sleeps. Its sleep mode is auto: a branch nobody uses sleeps like a VM, its open connections end, and the next connection wakes it.
The branch copies the parent’s password into db:app:preview, so its URL works with the same password until you rotate it. The create answer carries that URL and password once. To start from a backup instead of a branch, send snapshot with the backup’s id or name; it wins over from. The snapshot must be a backup of this database, or the request answers 404 snapshot_not_found, or 409 not_a_backup for another kind.
- Open Databases and select
app. - In Branches, select Create branch.
- Enter
previewin Branch name. - Choose
mainin From. - Select Create branch. The
preview is readydialog shows its connection; copy it before you select Done.
si org db branch app preview --from mainid: 6f1c0f0e8bname: previewdatabase: appbranches: main,previewuser: userurl: postgresql://user:...@db-app-preview.default.internal:5432/postgreswss: wss://6543-6f1c0f0e8b.slashinfra.dev/v1?address=127.0.0.1:5432internal: db-app-preview.default.internal:5432forward: si port forward 6f1c0f0e8b 5432rpo: last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview onlycurl -sS -X POST "https://api.slashinfra.com/databases/app/branches" \ -H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \ -d '{"name":"preview","from":"main"}'API reference: Control API operation
{"id":"6f1c0f0e8b","name":"preview","database":"app","project":"proj_6f1c0f0e8a","branches":["main","preview"],"connection":{"wss":"wss://6543-6f1c0f0e8b.slashinfra.dev/v1?address=127.0.0.1:5432","internal":"db-app-preview.default.internal:5432","url":"postgresql://user:...@db-app-preview.default.internal:5432/postgres","forward":"si port forward 6f1c0f0e8b 5432","user":"user","password":"..."},"rpo":"last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview only"}import os, requests
res = requests.post( "https://api.slashinfra.com/databases/app/branches", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"}, json={"name": "preview", "from": "main"},)res.raise_for_status()branch = res.json()print(branch["id"], branch["connection"]["internal"])6f1c0f0e8b db-app-preview.default.internal:5432const res = await fetch('https://api.slashinfra.com/databases/app/branches', { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'preview', from: 'main' }),})if (!res.ok) throw new Error(await res.text())const branch = (await res.json()) as { id: string; connection: { internal: string } }console.log(branch.id, branch.connection.internal)6f1c0f0e8b db-app-preview.default.internal:5432Rotate a branch password
Section titled “Rotate a branch password”Rotate generates a new 32-byte password, changes the Postgres role with ALTER ROLE, and replaces the secret db:app:preview. The answer carries the new URL and password once. An old connection stops working at the next authentication. si org db password app rotates main when you omit the branch.
- Open Databases and select
app. - In Branches, select Reset password on the
previewrow. - Select Reset password in the dialog. The
New password for previewdialog shows the new connection; copy it before you select Done.
si org db password app previewcurl -sS -X POST "https://api.slashinfra.com/databases/app/branches/preview/password" \ -H "Authorization: Bearer $SI_API_KEY"API reference: Control API operation
import os, requests
res = requests.post( "https://api.slashinfra.com/databases/app/branches/preview/password", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(res.json()["connection"]["internal"])const res = await fetch('https://api.slashinfra.com/databases/app/branches/preview/password', { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())const answer = (await res.json()) as { connection: { internal: string } }console.log(answer.connection.internal)Schedule backups
Section titled “Schedule backups”Schedule creates the one snapshot schedule of the main branch. Every fire runs CHECKPOINT, captures the disk as a backup snapshot named backup-YYYYMMDDTHHMMSSZ, and keeps the newest keep. The cron runs in UTC. A second schedule answers 409 name_taken.
The RPO of a restore is the last checkpoint, at most 60 seconds or 512 MiB of writes behind. There is no point-in-time recovery and no WAL archive. A backup is a disk snapshot, and a schedule that has not fired yet lists no backups.
- Open Databases and select
app. - In Backups, select Schedule backups.
- Enter
0 3 * * *in Cron. - Enter
7in Keep. - Select Schedule backups. The dashboard says
Backup scheduled; the first snapshot appears after the first fire.
si org db backup app --cron '0 3 * * *' --keep 7backupcurl -sS -X POST "https://api.slashinfra.com/databases/app/backups" \ -H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \ -d '{"cron":"0 3 * * *","keep":7}'API reference: Control API operation
{"id":"01JCK3AAAAAAAAAAAAAAAAAAAA","project":"proj_6f1c0f0e8a","name":"backup","cron":"0 3 * * *","timezone":"UTC","action":{"type":"snapshot","keep":7,"before":"..."},"concurrency":"skip","enabled":true,"next_at":1796007600000,"created_ms":1795961221924}import os, requests
res = requests.post( "https://api.slashinfra.com/databases/app/backups", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"}, json={"cron": "0 3 * * *", "keep": 7},)res.raise_for_status()schedule = res.json()print(schedule["name"], schedule["cron"], schedule["action"]["keep"])backup 0 3 * * * 7const res = await fetch('https://api.slashinfra.com/databases/app/backups', { method: 'POST', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ cron: '0 3 * * *', keep: 7 }),})if (!res.ok) throw new Error(await res.text())const schedule = (await res.json()) as { name: string; cron: string; action: { keep: number } }console.log(schedule.name, schedule.cron, schedule.action.keep)backup 0 3 * * * 7List backups
Section titled “List backups”List returns every backup snapshot of every branch, newest first, with its state and sizes. A backup’s name is backup-YYYYMMDDTHHMMSSZ in UTC. state is creating while the capture runs, then ready or failed. stored_bytes is the compressed size of the capture, and the dashboard’s Size is that value. A database with no backup gets [].
- Open Databases and select
app. The Backups section lists Name, Created, Size and State; before the first fire it saysNo backups yet.
si org db backup appno backups; run si org db backup app --cron '0 3 * * *' --keep 7curl -sS "https://api.slashinfra.com/databases/app/backups" \ -H "Authorization: Bearer $SI_API_KEY"API reference: Control API operation
[]import os, requests
res = requests.get( "https://api.slashinfra.com/databases/app/backups", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(len(res.json()))0const res = await fetch('https://api.slashinfra.com/databases/app/backups', { headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())console.log(((await res.json()) as unknown[]).length)0Delete a branch
Section titled “Delete a branch”Delete removes the branch VM and its db:app:preview secret. main is the database itself: it answers 409 main_branch, and DELETE /databases/app deletes the database. The database, main and the other branches stay. The CLI has no command to delete a branch; use the dashboard or the API.
- Open Databases and select
app. - In Branches, select Delete branch on the
previewrow. - Select Delete branch in the dialog. The dashboard says
Branch preview deleted.
curl -sS -i -X DELETE "https://api.slashinfra.com/databases/app/branches/preview" \ -H "Authorization: Bearer $SI_API_KEY"API reference: Control API operation
HTTP/2 204...import os, requests
res = requests.delete( "https://api.slashinfra.com/databases/app/branches/preview", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(res.status_code)204const res = await fetch('https://api.slashinfra.com/databases/app/branches/preview', { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())console.log(res.status)204Delete a database
Section titled “Delete a database”Delete removes every branch VM, every backup snapshot and every db:app:* secret, and writes a database.delete audit row. It cannot be undone. The answer is 204 when the VMs are deleting, not when they are gone.
- Open Databases and select
app. - Select Delete database.
- Select Delete database in the dialog. The dashboard returns to the list.
si org db rm appdeleted database appcurl -sS -i -X DELETE "https://api.slashinfra.com/databases/app" \ -H "Authorization: Bearer $SI_API_KEY"API reference: Control API operation
HTTP/2 204...import os, requests
res = requests.delete( "https://api.slashinfra.com/databases/app", headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},)res.raise_for_status()print(res.status_code)204const res = await fetch('https://api.slashinfra.com/databases/app', { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },})if (!res.ok) throw new Error(await res.text())console.log(res.status)204Options
Section titled “Options”| Field | Type | Default | Allowed values | What it changes |
|---|---|---|---|---|
name (create) |
string | Required | db-<name> has 1 to 32 lowercase letters, digits and hyphens, starting with a letter; unique in the project |
The database name and its main VM name, db-<name>. |
project (--project) |
string | default |
A project name, or its proj_ id |
The project that holds the database. A body field on create, a query parameter on every other operation. |
size (--size) |
integer | 512 | 512 to 16384, in steps of 512 | The base memory of every branch, and its CPU: each 512 MiB gives 0.25 CPU. The size cannot change. |
name (branch create) |
string | Required | db-<database>-<branch> has 1 to 32 lowercase letters, digits and hyphens, starting with a letter; unique in the database; not main |
The branch name and its VM name. |
from (--from) |
string | main |
A branch of this database | The branch to fork. Ignored when snapshot is set. |
snapshot (--snapshot) |
string | None | A backup snapshot of this database, by id or name |
The disk to start the branch from. It wins over from. |
cron (--cron) |
string | Required for a schedule | Five fields: minute, hour, day, month, weekday, with the next two fires at least the plan minimum apart | When the backup runs, in UTC. |
keep (--keep) |
integer | Required for a schedule | 1 to 100 | How many backup snapshots the schedule keeps; the oldest goes when a new one is made. |
ref (path) |
string | Required | A database name, unique in the project query |
The database that get, delete, branch, backups and password act on. |
branch (path, [BRANCH]) |
string | Required in the path; main in the CLI |
main, or a branch name of the database |
The branch that delete and password act on. |
Scroll horizontally to see all columns.
Errors
Section titled “Errors”| Code | When | Fix |
|---|---|---|
invalid_name |
Create or branch create sends a name that breaks the rule in Options. | Fit db-<name> or db-<database>-<branch> to 1 to 32 lowercase letters, digits and hyphens, starting with a letter. |
invalid_size |
Create sends a size outside 512 to 16384, or not a step of 512. | Send a whole number from 512 to 16384 in steps of 512. |
size_unavailable |
No node offers the requested memory. | Choose a smaller size. |
name_taken |
Create, branch create or schedule uses a name that is already used. | Choose another name; a database has one backup schedule. |
database_create_failed |
The VM or its initdb failed; nothing was kept. |
Try again. |
database_init_failed |
The database did not start; nothing was kept. | Try again. |
no_capacity |
No node has free capacity for the VM. | Wait for Retry-After and retry. |
public_ports_not_allowed |
The plan refuses public ports, and a database opens its wsproxy port 6543 public. | Use a plan with public ports. |
database_not_found |
Get, delete, branch, backups or password names no database of the project. | Check the name and the project. |
branch_not_found |
Branch create’s from, delete or password names no branch of the database. |
Check the branch name. |
snapshot_not_found |
Branch create’s snapshot names no snapshot of the project, or one of another database. |
Check the snapshot name or id and the database. |
not_a_backup |
snapshot names a snapshot that is not a backup. |
Choose a backup snapshot. |
password_missing |
The branch has no stored password secret. | Reset the password, or create the branch again. |
database_unavailable |
The password change cannot reach the database; it is starting or not reachable. | Try again in a moment. |
main_branch |
Delete branch names main. |
Delete the database instead. |
invalid_cron |
The cron is not five fields. | Send minute, hour, day, month and weekday. |
schedule_too_frequent |
Two fires are closer together than the plan allows. | Use a longer interval. |
invalid_keep |
keep is outside 1 to 100. |
Send a whole number from 1 to 100. |
project_not_found |
The project query or create body names no project of the organization, or one outside the key’s scope. | Check the name or id, and the key’s project scope. |
Scroll horizontally to see all columns.
Errors that any request can return are in the error catalog.
Permissions
Section titled “Permissions”| Operation | Who can | Key action |
|---|---|---|
| Create a database | Any member | database:write |
| List databases | Any member | database:read |
| Get a database | Any member | database:read |
| Create a branch | Any member | database:write |
| Rotate a branch password | Any member | database:write |
| Schedule backups | Any member | database:write |
| List backups | Any member | database:read |
| Delete a branch | Any member | database:delete |
| Delete a database | Any member | database:delete |
Scroll horizontally to see all columns.
Limits
Section titled “Limits”- A database name must make
db-<name>a valid VM name: 1 to 32 lowercase letters, digits and hyphens, starting with a letter. A branch name must makedb-<database>-<branch>fit the same rule, so a long database name leaves fewer characters for the branch. - The size is 512 to 16384 MiB in steps of 512, and 512 is the default. Every branch uses the database size, and the size cannot change after create.
- Each branch has a 50 GiB sparse disk, like a VM; empty space does not count as stored data, and a full disk answers
507. - Each 512 MiB step gives 0.25 CPU of base CPU. A 512 MiB branch has 0.25 CPU and a 0.5 CPU ceiling; a 16384 MiB branch has 8 CPU and a 16 CPU ceiling.
- A branch counts as a VM against the plan: Standard allows 5 VMs and Pro 50, branches included. A create beyond the limit fails and keeps nothing.
- A database has one
backupschedule.keepis 1 to 100backupsnapshots, and they do not count against the plan’s 50 or 200 snapshot limit. - The RPO is the last checkpoint, at most 60 seconds or 512 MiB of writes behind. There is no point-in-time recovery and no WAL archive.
- A backup is a disk snapshot of one branch. The database cannot serve logical replication, because its
wal_levelisminimal. - The Postgres image has no SSH server, no desktop, no outbound network and a minimal shell.
- A plan without public ports cannot create a database.
The full list is in Limits.
- Private network: reach the database from your VMs by its
.internalname. - Snapshots and forks: what a
backupsnapshot is and how retention deletes it. - Control API databases: every operation, field and status code.