HTTP API reference
All endpoints are JSON. Errors always use the shape { "error": "message" } with an appropriate HTTP status. Protected endpoints require the lumen_session cookie issued at sign-in.
Conventions
- API responses are sent with
no-storecache headers, so clients never see stale content after an upgrade. - Every protected endpoint is authorised server-side and scoped to the signed-in account.
- Ownership is enforced on every operation: another account's content is a
404, not a leak. - Rate limits apply to authentication and all writes.
Health
GET/api/health — public. Returns { status, name, version, schema_version, uptime }.
{ "status": "ok", "name": "Simple Worship Presenter", "version": "0.3.3",
"schema_version": 4, "uptime": 8123.4 }
Setup
GET/api/setup/status — public. Returns { needsAdmin, instance }. needsAdmin is true only while the instance has no users.
POST/api/setup/admin — public, but only accepted while the instance has no users. Body: { name, email, password }. Creates the administrator and starts a session. Passwords must be 10–200 characters.
Authentication
| Endpoint | Body | Notes |
|---|---|---|
POST/api/auth/register |
{ name, email, password } |
Creates an account with the configured default quota. 403 when ALLOW_REGISTRATION=0. |
POST/api/auth/login |
{ email, password } |
Returns { user } and sets the session cookie. |
POST/api/auth/logout |
— | Clears the session cookie. |
GET/api/auth/me |
— | Returns the signed-in { user }. 401 when not authenticated. |
Account
POST/api/account/password — body { current_password, new_password }. 401 when the current password is wrong.
DELETE/api/account — body { password }. Permanently removes the account and all of its content, releases the storage, and clears the session.
Settings
GET/api/settings — returns { instance, public_url, quota_bytes, used_bytes, storage, allow_registration, ccli_license }.
storage breaks usage into { media, files, presentations, songs, programs, total }. Everything an account stores counts towards used_bytes, not just uploads: presentation slides, song lyrics, service plans and uploaded files all consume the quota.
PUT/api/settings — body { ccli_license? }. Per-account settings.
Media
| Endpoint | What it does |
|---|---|
GET/api/media | Returns { media } for the signed-in account only. |
POST/api/media | Multipart field file. Content is validated by magic bytes; accepted: PNG, JPEG, GIF, WebP, MP4, MP3, WAV, OGG. 415 for unrecognised content, 413 over the account quota or the configured maximum size. |
GET/api/media/:id/file | Streams the file. 404 unless the media belongs to the caller. |
DELETE/api/media/:id | Removes the file from disk, the record, and the accounted usage. |
Songs
GET/api/songs · POST/api/songs · PUT/api/songs/:id · DELETE/api/songs/:id
Song shape: { title, artist, author, copyright, ccli, tags[], sections[{ id, label, text }], theme }. title is required. Ownership is enforced on every operation.
POST/api/songs/:id/generate — body { lines_per_slide?, order? }. order is a list of section ids and may repeat sections. Returns { slides, title }, where each slide is { text, section, background }.
Presentations
| Endpoint | What it does |
|---|---|
GET/api/presentations | Returns { presentations }, each with its parsed slides array. |
POST/api/presentations | Body { title, slides }. Returns the created presentation. |
PUT/api/presentations/:id | Body { title?, slides? }. Returns the saved presentation, so a save can be verified rather than assumed. |
POST/api/presentations/:id/duplicate | Creates a copy titled <title> copy. |
DELETE/api/presentations/:id | Removes the presentation. |
A slide is either a string or { text, image?, background?, name? }.
Service plans
GET/api/programs · POST/api/programs · PUT/api/programs/:id · DELETE/api/programs/:id · POST/api/programs/:id/duplicate
Plan shape: { title, date, notes, presentation_ids[] }. Removing a plan never deletes the presentations it references.
Mobile remote
A paired phone controls the live presentation. The server owns the presentation state; phones and displays converge on it, so a command from any device reaches every screen. Pairing details and the phone interface are covered in Mobile remote.
POST /api/remote/pairing session
Creates a short-lived, single-use pairing code and a locally generated QR image. The QR and link contain only the code — never an account or session token. Body: { scope? } to restrict which controls the paired device receives. Returns { ok, code, link, qr, expires_in_seconds, cooldown_seconds }.
GET /api/remote/state · POST /api/remote/state session
Reads or updates the live state for the signed-in account's session. The workspace keeps itself in step with any remote through these.
GET /api/remote/devices · DELETE /api/remote/devices/:id · DELETE /api/remote/devices session
List, revoke one, or revoke all paired remotes. Revocation takes effect immediately.
POST /api/remote/pair rate limited
Body: { code }. Exchanges a pairing code for a scoped remote token. Codes are consumed before a token is issued, so a replay cannot pair twice. Returns { ok, token, remote_id, allowed, expires_in_seconds, state, slide }. Garbage codes are rejected with 400.
GET /api/remote/me remote token
Current state for a paired device. Identify with Authorization: Bearer <token>.
POST /api/remote/command remote token or session
Body: { action, index? } where action is one of next, previous, goto, blank, unblank. An unknown action is a 400; an action the device does not hold returns 403. Ownership always comes from the credential.
WebSocket GET /api/remote/ws
The live channel for remotes and displays. Authenticate with a message rather than a URL parameter, so tokens stay out of proxy logs:
{ "type": "auth", "kind": "remote", "token": "…" }
Messages are size limited and schema checked, and authentication must complete within five seconds. See WebSocket proxying for the reverse-proxy configuration.
Import
POST/api/import/package — multipart file. Accepts a ZIP carrying a swp-import.json manifest with an optional media/ folder, or a bare manifest. Media is extracted and slide backgrounds are linked to it by name; media records are read whether the manifest calls the field path, file or name. Paths inside an archive are validated so a package cannot write outside its upload area. The response carries an import summary: what was created, anything skipped and why, and any service plan entry that could not be matched to a presentation.
Package size is limited by IMPORT_MAX_BYTES (2 GB by default) because a package can carry a whole church's media library; individual files inside it are still checked against the usual upload rules. See From SongShow Plus for the workflow this powers.
POST/api/import — the original plain-text importer, kept for backward compatibility. Multipart file; media is stored in the media library and readable text is returned as { text } for conversion into slides.
Scripture
Every scripture endpoint requires sign-in. The translation is shared instance data: reading it never counts against a quota and makes no external request. See the Scripture guide for the user-facing behaviour.
GET/api/bible/translations — returns { translations }, the translations installed on the instance.
GET/api/bible/books — query translation. Returns { translation, books }. 404 when that translation is not installed.
GET/api/bible/chapter — query translation, book, chapter. Returns the chapter with its heading and verses.
GET/api/bible/passage — query translation, ref. Parses references such as John 3:16, Jn 3:16, Psalm 23, 1 Cor 13:4-7 and Gen 1:1-2:3. A reference that cannot be understood returns 400 with an explanation of what to correct.
GET/api/bible/search — query translation, q, limit. Word search across the translation; each result carries its reference.
POST/api/bible/slides — generates slides for a passage, with configurable line count, verse numbers, and reference and translation labels. A verse is never split across slides and text is never trimmed to fit.
Admin
All admin routes require the admin role and return 403 otherwise.
| Endpoint | What it does |
|---|---|
GET/api/admin/instance · PUT/api/admin/instance | Reads and updates the instance default quota and returns usage statistics. Body: { default_quota_bytes? }. |
GET/api/admin/users | Returns { default_quota_bytes, users[] } with each account's name, email, role, quota and usage. |
POST/api/admin/users | Body { name, email, password, quota_bytes?, role? }. Creates an account that can sign in immediately. |
PUT/api/admin/users/:id | Body { name?, quota_bytes?, role? }. Quotas cannot go below current usage; an administrator cannot remove their own admin role. |
DELETE/api/admin/users/:id | Deletes the account and all of its content, freeing the storage. An administrator cannot delete their own account here. |
GET/api/admin/update | Current version, Node version, schema version, uptime, data directory, whether update checking and self-update are configured, and the last check/run results. |
POST/api/admin/update/check | Requires UPDATE_CHECK_URL. Fetches a JSON endpoint returning { version, notes, url } and compares it with the installed version. |
POST/api/admin/update/run | Body { confirm: true }. Requires UPDATE_COMMAND. Runs that command in the application directory and returns the captured output. |
GET/api/admin/backup | Downloads the data file (accounts, presentations, plans, songs, media metadata) as a dated JSON attachment. Uploaded media live alongside it in DATA_DIR/uploads. |
Rate limits
| Endpoint group | Default limit |
|---|---|
/api/auth/*, /api/setup/admin | 10 requests / minute / IP |
All other /api writes | 240 requests / minute / IP |
/api/bible/passage, /api/bible/search | 600 and 300 requests / minute / IP |
Exceeding a limit returns 429 with a Retry-After header. Limits are configurable through RATE_LIMIT_MAX_AUTH and RATE_LIMIT_MAX_WRITE.
Error shape
Every error uses the same shape, with an appropriate status code:
{ "error": "message" }
| Status | Meaning |
|---|---|
401 | Not authenticated. |
403 | Not allowed — wrong role, or registration closed. |
404 | Not found, or not yours. |
413 | Upload exceeds the account quota or the configured maximum size. |
415 | Upload content is not a recognised type. |
429 | Rate limited. See the Retry-After header. |