restore/v1
Put an app's data back as it was at a moment. You ask for a moment ("Tuesday 15:00"); the app restores the closest point it has at or before it and tells you which one it used. Providers differ only in how close they get:
- pitr keeps continuous history: any second inside its window.
- backups, the default, uses PocketBase's own backups (local or S3): the latest backup made at or before the moment. It steps aside when pitr is on for the app.
The app restarts to apply a restore; its data from before the restore is kept until the next one.
A wire contract (restore.go); a multisite host may provide it for its instances (from host-level snapshots).
Use
| Operation | HTTP | Token scope |
|---|---|---|
| Points: what can be restored | GET /api/_c/restore/v1 |
restore:read |
| RestoreTo a moment | POST /api/_c/restore/v1/restore with {"at": "<RFC 3339 time>"} |
restore |
Points answers with the provider's name and either a window (kind: "continuous") or a list of snapshots
(kind: "snapshots", newest first), whether a restore is running, and the last restore. RestoreTo answers with
the point it restores from; 422 no_point when there's nothing at or before the moment, 409 busy while another
restore runs. Only superusers may call either.
- Dashboard: Settings → Backups gets a "Restore to a moment" section from this contract (ui/main.js), whichever extension provides it: a time picker over pitr's window, or one that says which backup a moment uses.
- Go:
restorev1.Contract.Must(app).RestoreTo(ctx, auth, restorev1.RestoreInput{At: t}), orrestorev1.NewClient(url, token, http)from outside. - Hooks:
restorev1.OnRestoreTo(app, fn)in Go,onRestoreRestoreToinpb_hooks: refuse or log a restore. - MCP:
restore_pointsandrestore_restore_to.
Provide
Implement restorev1.Restorer and provide it in your extension's Register (ProvideDefault if a better
provider should replace yours). Report the point you'll actually restore from, and restart the app to apply it.
Commands and APIs
Every operation is a REST endpoint, a pocketone command and an MCP tool, all generated from the contract and behind the same token scope check and hooks. See Remote CLI, or the full CLI, Extension APIs and MCP references.
points
Says what the app's data can be restored to: a window of time (continuous history) or a list of moments (backups), and whether a restore is running.
| REST | GET /api/_c/restore/v1 |
| CLI | pocketone remote restore points |
| MCP | restore_points |
| Token scope | restore:read |
restore_to
Puts the app's data back as it was at the given moment, from the latest point at or before it. The app restarts to apply it; its current data is kept aside until the next restore.
| REST | POST /api/_c/restore/v1/restore |
| CLI | pocketone remote restore to --at <time> |
| MCP | restore_restore_to |
| Token scope | restore |
| Input field | Flag | Type |
|---|---|---|
at |
--at |
time |
Extensions
| Extension | |
|---|---|
| pitr | provides |
| backups | provides (default) |
License
MIT
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.