remote/v1
Remote control of an app from afar: who your credential is and what the app offers, its status, a restart, and its
log. Every client starts here: GET /api/_c/remote/v1 is the one fixed path, and its answer lists every other
contract the app offers. Contracts that add an area (deploy/v1) require this one.
A wire contract (remote.go); a multisite host can provide it for its instances, so it works for instances running stock PocketBase images.
Use
| Operation | HTTP | Token scope |
|---|---|---|
| Whoami | GET /api/_c/remote/v1 |
public (the answer says more when you're signed in) |
| Status | GET /api/_c/remote/v1/status |
remote:read |
| Restart | POST /api/_c/remote/v1/restart |
remote |
| Logs | GET /api/_c/remote/v1/logs?n=100 (server-sent events) |
remote:read |
- CLI:
pocketone remote whoami | status | restart | logs. - Go:
remotev1.Contract.Must(app)in the app, orremotev1.NewClient(url, token, http)from outside. The command-line client (linked remotes, saved logins, sign-in) is remoteclient. - Hooks:
remotev1.OnRestart(app)in Go,onRemoteRestartinpb_hooks, for every operation. - MCP: a tool per operation (
remote_status, ...).
Provide
Implement remotev1.Remote and provide it in your extension's Register:
remotev1.Contract.Provide(app, myRemote{})
A multisite host provides it for every instance with remotev1.Contract.ProvideForInstances(host, factory) and
serves it with remotev1.W.HostHandler in its instance routes (multisite.Host.InstanceRoutes, after the gates;
see pocker and
docker).
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.
whoami
Says who the credential is, the app's name and URL, and the contracts it offers.
| REST | GET /api/_c/remote/v1 |
| CLI | pocketone remote whoami |
| MCP | remote_whoami |
| Token scope | public |
status
Reports whether the app is running, its versions, uptime and mode.
| REST | GET /api/_c/remote/v1/status |
| CLI | pocketone remote status |
| MCP | remote_status |
| Token scope | remote:read |
restart
Restarts the app; requests in flight finish first.
| REST | POST /api/_c/remote/v1/restart |
| CLI | pocketone remote restart |
| MCP | remote_restart |
| Token scope | remote |
logs
Streams the app's log: the last entries, then new ones as they're written.
| REST | GET /api/_c/remote/v1/logs |
| CLI | pocketone remote logs --n <n> |
| MCP | remote_logs |
| Token scope | remote:read |
| Answer | a stream of JSON entries (server-sent events); the command prints one line each |
| Input field | Flag | Type |
|---|---|---|
n |
--n |
int |
Extensions
| Extension | |
|---|---|
| docker | provides |
| remotes | provides (default) |
| deploy | requires |
License
MIT
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.