409 LEGACY_OVERLAY_REQUIRES_V4).
You can restore a qualified, DBHost-produced v4 backup in place through the
v4 restore API. Customer SQL and dump uploads are unavailable for every
database; cloning a database with Additional roles is also unavailable. The
v4 restore route accepts a
backup only when every non-system
extension is owned by the database owner. A backup without that verified
ownership is refused with 409 EXTENSION_OWNER_UNSUPPORTED; make a new v4
backup after the ownership is corrected, or contact support if you cannot
change it.
Restore a v4 backup
UseGET /api/v1/databases/{databaseId}/backups to find the ID of a backup
made after Additional roles were enabled. The restore accepts only a
DBHost-produced, S3-verified v4 backup of that same database. It replaces the
current database contents with the selected backup, so writes made after the
backup will no longer be present. Plan for connections to reconnect during
the cutover.
With a full-account API key, call
POST /api/v1/databases/{databaseId}/legacy-overlay-restores with a stable
Idempotency-Key header and {"backupId":"<backup ID>"}. The response gives
an operation ID. Call
POST /api/v1/operations/{operationId}/legacy-overlay-restore/advance with
an empty body to advance that same operation. Read
GET /api/v1/operations/{operationId} for its current status; repeat the
advance call for that operation until it reaches succeeded or returns a
specific conflict. Reuse the same idempotency key after an uncertain
reservation, and do not start a second restore to retry a stage.
DBHost verifies a recovery backup before replacing the database and checks
the role and grant mapping before opening the restored database. Verify your
application’s queries after the operation succeeds. The older generic restore
route remains blocked for databases with Additional roles. Customer-uploaded
restore is unavailable for every database.
Opt in and create
CallPOST /api/v1/databases/{databaseId}/legacy-roles/opt-in with an empty
body. The response contains the overlay ID, generation and reserved or
active status. Repeating the request for the same database uses the same
overlay.
Call POST /api/v1/databases/{databaseId}/legacy-roles with a stable
Idempotency-Key header and an exact body:
accessProfile is custom, read_only or read_write. A database may have
up to ten extra roles. Opt-in requires an effective per-database server
connection cap, and a fourth or later role rechecks it.
Each role has a connection limit from 1 to 20. A successful
create returns ready with the generated roleId and PostgreSQL username,
never the password. DBHost grants database CONNECT for all three profiles.
custom can log in immediately but receives no DBHost schema, table or
default grants; give it access in your migrations. read_only gets SELECT,
and read_write gets DML. DBHost denies CREATE and TEMPORARY to the new role.
Reuse the same idempotency key after an uncertain result; changing its
choices conflicts.
The prepare and admit endpoints remain for a held operation that needs
reconciliation. They are not needed after a successful create. If CONNECT
was withdrawn later, restore it as the database owner and retry the exact
admission. For an uncertain agent outcome, call
POST /api/v1/databases/{databaseId}/legacy-roles/{roleId}/reconcile
with an empty body before retrying another step.
New managed databases use the same one-call behavior at
POST /api/v1/databases/{databaseId}/custom-roles, with the same body and
idempotency header. Their connection limit is a positive integer governed by
the database budget. A withdrawn CONNECT grant returns
409 CONNECT_GRANT_REQUIRED with the exact owner SQL as a fallback.
List, credentials and changes
GET /api/v1/databases/{databaseId}/legacy-roles lists metadata only. Use
?includeRevoked=true to include roles that have been revoked.
POST /api/v1/databases/{databaseId}/legacy-roles/{roleId}/credentials
with an empty body explicitly reveals the ready role’s current password. The
response is marked no-store; keep the password in a secret store and do not
put it in logs or an application repository. The original owner credential is
never returned by this endpoint.
To rotate or revoke a role, call
POST /api/v1/databases/{databaseId}/legacy-roles/{roleId}/changes with a
stable Idempotency-Key and {"kind":"rotate","confirmDisconnect":true}
or {"kind":"revoke","confirmDisconnect":true}. Open sessions may be
disconnected. Read the returned operation via
GET /api/v1/databases/{databaseId}/legacy-roles/{roleId}/changes/{operationId}.
For an uncertain outcome, replay the exact change through POST at that
operation URL with {"confirmDisconnect":true}. If another change holds the
database for the whole wait, a change, read or replay returns
409 DATABASE_BUSY with Retry-After; repeat the same request (same
Idempotency-Key) after that many seconds. Removing a role uses
DELETE /api/v1/databases/{databaseId}/legacy-roles/{roleId} and refuses
unresolved dependencies rather than cascading through customer objects.
Increase a role connection limit
PUT /api/v1/databases/{databaseId}/legacy-roles/{roleId}/connection-limit
accepts {"connectionLimit":3} with Idempotency-Key for an existing ready
Additional role (maximum 20). Only increases are supported; decreases return
409 ROLE_LIMIT_DECREASE_UNSUPPORTED. The original legacy login, added role’s
OID, password, grants and credential generation stay unchanged.
The role’s server limit shares the database’s aggregate cap and reserves no
capacity. Accepted transactions queue within the configured client limits and
wait timeout. The aggregate cap must fit the verified PostgreSQL budget, including
local health and enabled direct-migration reserves. Neither the aggregate cap
nor the subscription changes.
A pending result retains its operationId; resume with PUT to the same URL
and {"operationId":"..."}. GET returns this role’s pending operation or
null. V4 backups, same-database restore and recovery preserve the proved
setting. The existing typed refusal for cloning Additional-role databases
continues to apply.
CLI: dbhost managed legacy-limit DATABASE_ID ROLE_ID 3 --idempotency-key KEY;
resume with dbhost managed legacy-continue-limit DATABASE_ID ROLE_ID OPERATION_ID.