# Databases

Branchable Postgres databases: create, branch, rotate a password and schedule backups

Source: https://slashinfra.com/docs/api-reference/control/databases
Last modified: 2026-11-30T16:36:19.000Z

Branchable Postgres databases: create, branch, rotate a password and schedule backups

Resource, request and plan limits are listed on [Limits](https://slashinfra.com/docs/reference/limits).

[Download OpenAPI specification](https://slashinfra.com/docs/control.openapi.json) · Version 0.1.0

[GETList databases](https://slashinfra.com/docs/api-reference/control/databases#getDatabases)[POSTCreate a database](https://slashinfra.com/docs/api-reference/control/databases#postDatabases)[DELETEDelete a database](https://slashinfra.com/docs/api-reference/control/databases#deleteDatabasesByName)[GETGet a database](https://slashinfra.com/docs/api-reference/control/databases#getDatabasesByName)[GETList database backups](https://slashinfra.com/docs/api-reference/control/databases#getDatabasesByNameBackups)[POSTSchedule database backups](https://slashinfra.com/docs/api-reference/control/databases#postDatabasesByNameBackups)[POSTCreate a branch](https://slashinfra.com/docs/api-reference/control/databases#postDatabasesByNameBranches)[DELETEDelete a branch](https://slashinfra.com/docs/api-reference/control/databases#deleteDatabasesByNameBranchesByBranch)[POSTRotate a branch password](https://slashinfra.com/docs/api-reference/control/databases#postDatabasesByNameBranchesByBranchPassword)

### List databases

GET

/databases

Returns every database of one project with its branches, its connection without the password and the RPO. A branch is a machine of its own: the branch names come from its `si.branch` label, of the machines with `si.db=<name>`.

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Query Parameters

`project?`string

The project id or name, `default` when omitted; an unknown project answers 404 `project_not_found`.

#### Response Body

Every database of the project, newest first; a project with none gets `[]`.

`application/json`

- response

- response
- …

Every database of the project, newest first; a project with none gets `[]`.

`[index: integer]?`

One Postgres database of the project and its branches.

Example Request

```
curl -X GET 'https://api.slashinfra.com/databases'
```

Example ResponseSchema

```
[  {    "branches": [      "main",      "dev"    ],    "connection": {      "forward": "si port forward 6f1c0f0e8a 5432",      "internal": "db-app.default.internal:5432",      "user": "user",      "wss": "wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432"    },    "id": "6f1c0f0e8a",    "name": "app",    "project": "proj_6f1c0f0e8a",    "rpo": "last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview only"  }]
```

### Create a database

POST

/databases

Creates a Postgres 19 database `db-<name>` with a public wsproxy port on 6543; its password is in the secret `db:<name>:main` and is answered once, with the URL. Dev and preview only; see [Postgres](https://slashinfra.com/docs/platform/postgres).

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Request Body

The name and optional size of the new database.

- body

- body
- …

The name and optional size of the new database.

`name*`string

The name of the database, unique in its project: `db-<name>` must fit the SVM name rules (`^[a-z][a-z0-9-]{0,31}$`).

`project?`string

The project id or name that the database belongs to; `default` when omitted.

`size?`integer

The base memory of every branch in MiB, a whole number from 512 to 16384 in steps of 512; 512 (the `xs` size) when absent.

#### Response Body

A new database, with its connection and the password that is answered once.

`application/json`

- response

- response
- …

A new database, with its connection and the password that is answered once.

`branches*`array<string>

The branches of the new database: `main`.

`connection*`

The connection of a new database or branch, with the URL and password that it answers once.

`id*`string

The machine id of the main branch.

`name*`string

The name of the database.

`project*`string

The id of the project of the database.

`rpo*`string

The recovery point objective of a database; dev and preview only.

Example Request

```
curl -X POST 'https://api.slashinfra.com/databases' \  -H 'Content-Type: application/json' \  -d '{  "name": "app"}'
```

Example ResponseSchema

```
{  "branches": [    "main"  ],  "connection": {    "forward": "string",    "internal": "string",    "password": "string",    "url": "postgresql://user:s3cret@db-app.default.internal:5432/postgres",    "user": "string",    "wss": "string"  },  "id": "6f1c0f0e8a",  "name": "app",  "project": "proj_6f1c0f0e8a",  "rpo": "string"}
```

### Delete a database

DELETE

/databases/{name}

Deletes every branch machine of the database, its `backup` snapshots and its `db:<name>:*` secrets, and writes the `database.delete` audit row. The delete of a machine is confirmed by its node, as for any SVM.

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Path Parameters

`name*`string

The name of the database: the `si.db` label of its machines, unique in the project.

Length`1 <= length`

#### Query Parameters

`project?`string

The project id or name, `default` when omitted; an unknown project answers 404 `project_not_found`.

#### Response Body

Every branch machine is deleting, and its backup snapshots and password secrets are gone; no body.

`response?`string`text/plain`

Every branch machine is deleting, and its backup snapshots and password secrets are gone; no body.

Example Request

```
curl -X DELETE 'https://api.slashinfra.com/databases/app'
```

Example ResponseSchema

```
"string"
```

### Get a database

GET

/databases/{name}

Returns one database of the project with its branches, its connection without the password and the RPO. The password is never part of this answer.

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Path Parameters

`name*`string

The name of the database: the `si.db` label of its machines, unique in the project.

Length`1 <= length`

#### Query Parameters

`project?`string

The project id or name, `default` when omitted; an unknown project answers 404 `project_not_found`.

#### Response Body

One Postgres database of the project and its branches.

`application/json`

- response

- response
- …

One Postgres database of the project and its branches.

`branches*`array<string>

The branches of the database, `main` first; each is a machine of its own.

`connection*`

How a client reaches the database; its URL and password are never part of it after the create answer.

`id*`string

The machine id of the main branch: ten symbols of the SVM id alphabet.

`name*`string

The name of the database, unique in its project.

`project*`string

The id of the project of the database.

`rpo*`string

The recovery point objective: the last checkpoint of the disk, at most 60 s or 512 MiB of writes behind; dev and preview only.

Example Request

```
curl -X GET 'https://api.slashinfra.com/databases/app'
```

Example ResponseSchema

```
{  "branches": [    "main",    "dev"  ],  "connection": {    "forward": "si port forward 6f1c0f0e8a 5432",    "internal": "db-app.default.internal:5432",    "user": "user",    "wss": "wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432"  },  "id": "6f1c0f0e8a",  "name": "app",  "project": "proj_6f1c0f0e8a",  "rpo": "last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview only"}
```

### List database backups

GET

/databases/{name}/backups

Returns the `backup` snapshots of every branch of the database, newest first, with their state and sizes. A database without a backup gets `[]`.

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Path Parameters

`name*`string

The name of the database: the `si.db` label of its machines, unique in the project.

Length`1 <= length`

#### Query Parameters

`project?`string

The project id or name, `default` when omitted; an unknown project answers 404 `project_not_found`.

#### Response Body

The `backup` snapshots of the database, newest first; a database without a backup gets `[]`.

`application/json`

- response

- response
- …

The `backup` snapshots of the database, newest first; a database without a backup gets `[]`.

`[index: integer]?`

One disk-only snapshot.

Example Request

```
curl -X GET 'https://api.slashinfra.com/databases/app/backups'
```

Example ResponseSchema

```
[  {    "created_ms": 1762747200000,    "error": "timeout",    "expires_ms": 1765339200000,    "id": "0zs0pshr3x",    "kind": "user",    "logical_bytes": 2147483648,    "name": "build-1-20261110-031900",    "project": "proj_6f1c0f0e8a",    "source": "6f1c0f0e8a",    "state": "ready",    "stored_bytes": 536870912,    "used_by": [      "string"    ]  }]
```

### Schedule database backups

POST

/databases/{name}/backups

Creates the one `snapshot` schedule of the main branch: every fire runs `CHECKPOINT` over exec, captures the disk as a `backup` snapshot named `<schedule>-YYYYMMDDTHHMMSSZ`, and keeps the newest `keep` backups. `GET /databases/:name/backups` lists them. The RPO of a restore is the last checkpoint, at most 60 s or 512 MiB of writes behind.

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Path Parameters

`name*`string

The name of the database: the `si.db` label of its machines, unique in the project.

Length`1 <= length`

#### Query Parameters

`project?`string

The project id or name, `default` when omitted; an unknown project answers 404 `project_not_found`.

#### Request Body

The schedule of the automatic backups of the main branch.

- body

- body
- …

The schedule of the automatic backups of the main branch.

`cron*`string

A five-field cron whose next two fires are at least the plan minimum apart.

`keep*`integer

How many `backup` snapshots of the schedule to keep, from 1 to 100.

#### Response Body

One schedule of an SVM.

`application/json`

- response

- response
- …

One schedule of an SVM.

`action*`||

The command, inbox message or snapshot of one fire.

`concurrency*`string

`skip` refuses a fire while the previous run still runs; `allow` starts both.

Value in`"skip"``"allow"`

`created_ms*`integer

The creation time in milliseconds since the Unix epoch.

`cron*`string

The normalized five-field cron.

`enabled*`boolean

Whether the minute tick fires it.

`id*`string

The schedule id.

`name*`string

The name of the schedule, unique per SVM.

`next_at*`integer

The next fire in milliseconds since the Unix epoch; it moves when the tick claims a run.

`project*`string

The id of the project of the SVM, which the schedule inherits and never takes as a parameter.

`timezone*`string

The IANA timezone of the cron.

Example Request

```
curl -X POST 'https://api.slashinfra.com/databases/app/backups' \  -H 'Content-Type: application/json' \  -d '{  "cron": "0 3 * * *",  "keep": 7}'
```

Example ResponseSchema

```
{  "action": {    "command": "make backup",    "timeout_s": 600,    "type": "command"  },  "concurrency": "skip",  "created_ms": 1767225600000,  "cron": "0 3 * * *",  "enabled": true,  "id": "01JCK3AAAAAAAAAAAAAAAAAAAA",  "name": "nightly-backup",  "next_at": 1767225600000,  "project": "proj_6f1c0f0e8a",  "timezone": "Europe/Berlin"}
```

### Create a branch

POST

/databases/{name}/branches

Creates a branch machine `db-<database>-<branch>` forked from the `from` branch (`main` by default), or started from a `backup` snapshot. The answer carries the branch URL and password once; see [Postgres](https://slashinfra.com/docs/platform/postgres).

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Path Parameters

`name*`string

The name of the database: the `si.db` label of its machines, unique in the project.

Length`1 <= length`

#### Query Parameters

`project?`string

The project id or name, `default` when omitted; an unknown project answers 404 `project_not_found`.

#### Request Body

The name of the branch and where its disk comes from.

- body

- body
- …

The name of the branch and where its disk comes from.

`from?`string

The branch to fork, by its name; `main` when absent, and an unknown branch answers 404.

`name*`string

The name of the branch: the machine name `db-<database>-<name>` must fit the SVM name rules, and `main` is the database itself.

`snapshot?`string

A `backup` snapshot of this database to start the branch from, by id or name; it wins over `from`, and a snapshot of another database answers 404.

#### Response Body

A new branch of a database, with its own connection and the copied password that is answered once.

`application/json`

- response

- response
- …

A new branch of a database, with its own connection and the copied password that is answered once.

`branches*`array<string>

Every branch of the database, `main` first.

`connection*`

The connection of a new database or branch, with the URL and password that it answers once.

`database*`string

The name of the database that the branch belongs to.

`id*`string

The machine id of the new branch.

`name*`string

The name of the branch.

`project*`string

The id of the project of the database.

`rpo*`string

The recovery point objective of a database; dev and preview only.

Example Request

```
curl -X POST 'https://api.slashinfra.com/databases/app/branches' \  -H 'Content-Type: application/json' \  -d '{  "name": "dev"}'
```

Example ResponseSchema

```
{  "branches": [    "string"  ],  "connection": {    "forward": "string",    "internal": "string",    "password": "string",    "url": "postgresql://user:s3cret@db-app.default.internal:5432/postgres",    "user": "string",    "wss": "string"  },  "database": "app",  "id": "6f1c0f0e8b",  "name": "dev",  "project": "proj_6f1c0f0e8a",  "rpo": "string"}
```

### Delete a branch

DELETE

/databases/{name}/branches/{branch}

Deletes one branch machine and its password secret. `main` is the database: it answers 409 `main_branch`, and `DELETE /databases/:name` deletes the database.

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Path Parameters

`name*`string

The name of the database: the `si.db` label of its machines, unique in the project.

Length`1 <= length`

`branch*`string

The branch name: `si.branch` of its machine, `main` for the database itself.

Length`1 <= length`

#### Query Parameters

`project?`string

The project id or name, `default` when omitted; an unknown project answers 404 `project_not_found`.

#### Response Body

The branch machine is deleting and its password secret is gone; no body.

`response?`string`text/plain`

The branch machine is deleting and its password secret is gone; no body.

Example Request

```
curl -X DELETE 'https://api.slashinfra.com/databases/app/branches/dev'
```

Example ResponseSchema

```
"string"
```

### Rotate a branch password

POST

/databases/{name}/branches/{branch}/password

Generates a new 32-byte password, changes the Postgres role with `ALTER ROLE` over exec, then replaces the project secret `db:<database>:<branch>`. The answer carries the branch connection with the new URL and password once; an old connection stops working at the next authentication.

#### Authorization

`apiKey`

header`Authorization``Bearer <token>`

An API key (`si_` and 43 base64url characters), sent as `Authorization: Bearer si_...`; see [Using the API](https://slashinfra.com/docs/reference/api).

#### Path Parameters

`name*`string

The name of the database: the `si.db` label of its machines, unique in the project.

Length`1 <= length`

`branch*`string

The branch name: `si.branch` of its machine, `main` for the database itself.

Length`1 <= length`

#### Query Parameters

`project?`string

The project id or name, `default` when omitted; an unknown project answers 404 `project_not_found`.

#### Response Body

The connection of the branch with its new password and URL, answered once.

`application/json`

- response

- response
- …

The connection of the branch with its new password and URL, answered once.

`connection*`

The connection of a new database or branch, with the URL and password that it answers once.

Example Request

```
curl -X POST 'https://api.slashinfra.com/databases/app/branches/dev/password'
```

Example ResponseSchema

```
{  "connection": {    "forward": "string",    "internal": "string",    "password": "string",    "url": "postgresql://user:s3cret@db-app.default.internal:5432/postgres",    "user": "string",    "wss": "string"  }}
```

GET

/databases

Example Request

```
curl -X GET 'https://api.slashinfra.com/databases'
```

```
[
{
"branches": [
"main",
"dev"
],
"connection": {
"forward": "si port forward 6f1c0f0e8a 5432",
"internal": "db-app.default.internal:5432",
"user": "user",
"wss": "wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432"
},
"id": "6f1c0f0e8a",
"name": "app",
"project": "proj_6f1c0f0e8a",
"rpo": "last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview only"
}
]
```

POST

/databases

Example Request

```
curl -X POST 'https://api.slashinfra.com/databases' \
-H 'Content-Type: application/json' \
-d '{
"name": "app"
}'
```

```
{
"branches": [
"main"
],
"connection": {
"forward": "string",
"internal": "string",
"password": "string",
"url": "postgresql://user:s3cret@db-app.default.internal:5432/postgres",
"user": "string",
"wss": "string"
},
"id": "6f1c0f0e8a",
"name": "app",
"project": "proj_6f1c0f0e8a",
"rpo": "string"
}
```

DELETE

/databases/{name}

Example Request

```
curl -X DELETE 'https://api.slashinfra.com/databases/app'
```

```
"string"
```

GET

/databases/{name}

Example Request

```
curl -X GET 'https://api.slashinfra.com/databases/app'
```

```
{
"branches": [
"main",
"dev"
],
"connection": {
"forward": "si port forward 6f1c0f0e8a 5432",
"internal": "db-app.default.internal:5432",
"user": "user",
"wss": "wss://6543-6f1c0f0e8a.slashinfra.dev/v1?address=127.0.0.1:5432"
},
"id": "6f1c0f0e8a",
"name": "app",
"project": "proj_6f1c0f0e8a",
"rpo": "last checkpoint (≤ 60 s or 512 MiB of writes); dev/preview only"
}
```

GET

/databases/{name}/backups

Example Request

```
curl -X GET 'https://api.slashinfra.com/databases/app/backups'
```

```
[
{
"created_ms": 1762747200000,
"error": "timeout",
"expires_ms": 1765339200000,
"id": "0zs0pshr3x",
"kind": "user",
"logical_bytes": 2147483648,
"name": "build-1-20261110-031900",
"project": "proj_6f1c0f0e8a",
"source": "6f1c0f0e8a",
"state": "ready",
"stored_bytes": 536870912,
"used_by": [
"string"
]
}
]
```

POST

/databases/{name}/backups

Example Request

```
curl -X POST 'https://api.slashinfra.com/databases/app/backups' \
-H 'Content-Type: application/json' \
-d '{
"cron": "0 3 * * *",
"keep": 7
}'
```

```
{
"action": {
"command": "make backup",
"timeout_s": 600,
"type": "command"
},
"concurrency": "skip",
"created_ms": 1767225600000,
"cron": "0 3 * * *",
"enabled": true,
"id": "01JCK3AAAAAAAAAAAAAAAAAAAA",
"name": "nightly-backup",
"next_at": 1767225600000,
"project": "proj_6f1c0f0e8a",
"timezone": "Europe/Berlin"
}
```

POST

/databases/{name}/branches

Example Request

```
curl -X POST 'https://api.slashinfra.com/databases/app/branches' \
-H 'Content-Type: application/json' \
-d '{
"name": "dev"
}'
```

```
{
"branches": [
"string"
],
"connection": {
"forward": "string",
"internal": "string",
"password": "string",
"url": "postgresql://user:s3cret@db-app.default.internal:5432/postgres",
"user": "string",
"wss": "string"
},
"database": "app",
"id": "6f1c0f0e8b",
"name": "dev",
"project": "proj_6f1c0f0e8a",
"rpo": "string"
}
```

DELETE

/databases/{name}/branches/{branch}

Example Request

```
curl -X DELETE 'https://api.slashinfra.com/databases/app/branches/dev'
```

```
"string"
```

POST

/databases/{name}/branches/{branch}/password

Example Request

```
curl -X POST 'https://api.slashinfra.com/databases/app/branches/dev/password'
```

```
{
"connection": {
"forward": "string",
"internal": "string",
"password": "string",
"url": "postgresql://user:s3cret@db-app.default.internal:5432/postgres",
"user": "string",
"wss": "string"
}
}
```
