Roles
Manage database roles (users) — create, list, delete, and reset passwords via the REST API.
A role is a PostgreSQL database user. Roles are native Postgres roles, so they
carry the usual privileges and can own objects, be granted to other roles, and govern
access through GRANT/REVOKE and row-level security.
The API is stabilizing. The paths below reflect the current interface; field-level details may still change before general availability.
List roles
GET /v1/databases/{database_id}/roles
curl https://api.silos.sh/v1/databases/db_abc123/roles \
-H "Authorization: Bearer $SILOS_API_KEY"{
"roles": [
{
"name": "app_user",
"database_id": "db_abc123",
"created_at": "2026-06-01T12:00:00Z"
}
]
}Create a role
POST /v1/databases/{database_id}/roles
The generated password is returned once in the response. Store it securely.
curl -X POST https://api.silos.sh/v1/databases/db_abc123/roles \
-H "Authorization: Bearer $SILOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "app_user" }'{
"role": {
"name": "app_user",
"database_id": "db_abc123",
"password": "generated-password-shown-once"
}
}The password is only returned at creation time. If it's lost, reset it rather than attempting to recover it.
Get a role
GET /v1/databases/{database_id}/roles/{name}
curl https://api.silos.sh/v1/databases/db_abc123/roles/app_user \
-H "Authorization: Bearer $SILOS_API_KEY"{
"role": {
"name": "app_user",
"database_id": "db_abc123",
"created_at": "2026-06-01T12:00:00Z"
}
}Reset a role's password
POST /v1/databases/{database_id}/roles/{name}/reset
Generate a new password for a role. The new password is returned once.
curl -X POST https://api.silos.sh/v1/databases/db_abc123/roles/app_user/reset \
-H "Authorization: Bearer $SILOS_API_KEY"{
"role": {
"name": "app_user",
"password": "new-generated-password-shown-once"
}
}Delete a role
DELETE /v1/databases/{database_id}/roles/{name}
curl -X DELETE https://api.silos.sh/v1/databases/db_abc123/roles/app_user \
-H "Authorization: Bearer $SILOS_API_KEY"Deleting a role that owns objects may fail until ownership is reassigned, exactly as in standard PostgreSQL.