REST API
The apps use this API; you can too. Every endpoint under /v1 needs a device token, except pairing.
A walk-through with curl
Section titled “A walk-through with curl”First get a pairing code (single use, valid for 10 minutes), either on the server:
docker compose exec rundown node src/cli.ts pairor with the admin token:
curl -X POST https://rundown.example.com/v1/pairing-codes -H "Authorization: Bearer $ADMIN_TOKEN"Pair, and keep the token (it’s shown once):
curl -X POST https://rundown.example.com/v1/pair -H 'Content-Type: application/json' \ -d '{"code":"ABCDE-FGHJK","name":"My iPhone"}'# {"device":{…},"token":"rdn_…"}export TOKEN=rdn_…Upload an action (the script itself, or {"source": …, "filename": …} as JSON). It’s validated like
an import in the app:
curl -X POST 'https://rundown.example.com/v1/actions?filename=http-uptime.js' \ -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/javascript' \ --data-binary @actions/examples/http-uptime.jsAdd an item. The first run starts right away, then it follows the schedule:
curl -X PUT https://rundown.example.com/v1/items/my-site -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ -d '{"actionId":"dev.rundown.http-uptime","name":"My site","inputs":{"url":"https://example.com"}}'Then watch it:
curl https://rundown.example.com/v1/items -H "Authorization: Bearer $TOKEN"docker compose logs -f rundown | grep '"msg":"notification"'Endpoints
Section titled “Endpoints”| Method and path | |
|---|---|
GET /health |
{ status, version, uptimeSeconds }, without auth. |
POST /v1/pairing-codes |
Admin token, or a paired device’s token (the apps use it to add your other devices, found through iCloud). { code, expiresAt, link } (link is the rundown://pair?… link when RUNDOWN_PUBLIC_URL is set). |
POST /v1/pair |
{ code, name } → { device, token }. Ten failed attempts per address block pairing for 10 minutes. |
GET /v1/status |
Counts, runs in progress, the next due time, the scheduler. |
GET /v1/devices, DELETE /v1/devices/{id} |
Paired devices (with their push environment); deleting one revokes its token. |
PUT /v1/devices/current/push, DELETE … |
{ token: "<hex APNs token>", environment: "sandbox" | "production" } → { device, pushConfigured }. Registers (or removes) the calling device’s push token. |
GET /v1/actions, POST /v1/actions |
Installed actions; upload (creates or replaces by meta.id). |
GET /v1/actions/{id}, DELETE /v1/actions/{id} |
One action, with its source; deleting removes its items too. |
GET /v1/items, POST /v1/items |
Items with their summaries; create (the server picks the ID). |
GET /v1/items/{id} |
One item, with its state and store. |
PUT /v1/items/{id} |
Create with this ID, or change fields (fields you leave out stay as they are). |
DELETE /v1/items/{id} |
Deletes the item with its runs and notifications. |
POST /v1/items/{id}/run |
Runs now and returns the outcome. ?dryRun=1 saves nothing and doesn’t notify. |
GET /v1/items/{id}/runs |
The latest runs (up to 50) with logs and errors. |
GET /v1/items/{id}/notifications, GET /v1/notifications |
Notification history, including held-back ones and why. ?since=<ISO date> and ?limit= (at most 500). |
Item fields
Section titled “Item fields”| Field | |
|---|---|
actionId |
Required when creating; can’t change. |
name |
Defaults to the action’s name. |
inputs |
{ key: value }. Checked against the action’s inputs; null removes a value. |
secrets |
{ key: "value" } for secret inputs; null removes one. Never returned; secrets in responses lists only the keys that are set. |
notificationPrefs |
{ type: true/false } |
intervalOverride |
"30m", seconds, or null; at least the action’s schedule.min. |
paused, failureAlerts |
true/false |
mutedUntil |
An ISO 8601 date, or null. |
sortIndex |
An integer. |
state, store |
Only when creating: for moving an item from a device. |
Changing the name, inputs, secrets or interval, or resuming a paused item, runs it again soon. Muting and notification switches don’t.
Errors
Section titled “Errors”Errors look like:
{ "error": { "code": "…", "message": "…", "issues": [{ "path": "…", "message": "…" }] } }