palbaseDocs

Palbase Machines · API

POST/databases/{name}/restore

Bring a database back to a moment

Brings the database back to a moment of its backups: one since it was opened — or last brought back — within its backup days, and not of the last two minutes (its WAL is archived once a minute). It is down meanwhile, its clients told it is being restored; it starts again with the data it held at that moment, its logins' passwords as they are now. Before it goes down, a commit is written on it and archived, so any moment it was quiet at is reached too — a database asleep is woken for it, unless it has slept since before the moment (then nothing was written since, and it is brought back to the latest moment of its backups); brought back, it is awake. A restore whose recovery fails is made again to the latest moment of its backups — nothing it held is lost — and says so in state_reason; one whose archive does not take its last WAL within minutes leaves the database as it was. One restore at a time: another is asked for once the last has ended, or failed (failed: not even to its latest moment). Emits database.restoring, and database.restore_failed when it does not bring the database back to its moment.

Called by your server, with the project's secret key.

Path

namestring · requiredThe database's name: lowercase letters, digits and dashes, starting with a letter and not ending with a dash, 32 at most.

Request body

tostring (date-time) · requiredThe moment, as an RFC 3339 time.
curl
curl -X POST "https://<your-ref>.palbase.studio/databases/<name>/restore" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"to":"2026-01-01T00:00:00Z"}'

Responses

202The database, being brought back

400Validation failed or a required field is missing

401Missing or invalid API key

403Not the project's secret key; or the request requires elevated owner authentication (`owner_only`, `insufficient_user_authentication`).

404The project has no database of this name

409The project already has a database of this name (or one being purged), the environment as many databases as it may, or no room left for this one; a password change is still on its way to the database; or a machine is given the database; or the database is moving to another size, cannot start (a change of its size waits for a restore that brings it back), holds more than the one asked, or would have too few connections for the copies of the machines given it; or, to the console, the database is being brought back to a moment, cannot start, or has run its awake hours for the month

429Over the project's request limit, or its machine time for this period is used up

503Temporarily unavailable; retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation RestoreDatabase of machines's contract.