IKHSAN
ENID Baca dalam Bahasa Indonesia

homeio

Public

Forked from doctor-io/homeio

Branch
main
Latest commit
958d74616 October 2026

api-reference.md

Open raw
API Reference

This reference is generated from the current app/api/**/route.ts tree and verified against route exports. Auth means the route is protected by the shared requireApiSession() helper or an auth-specific session check. There is no central middleware.

Response Conventions

  • Preferred success shape for new routes: { "data": ... }.
  • Preferred error shape: { "error": string, "code"?: string, "details"?: unknown }.
  • Current code is inconsistent. Examples: app/api/v1/files/route.ts returns { data, meta }; app/api/v1/scheduled-tasks/route.ts returns { tasks }; auth routes use auth-specific shapes.
  • Routes that parse JSON generally return 400 for invalid JSON or validation failure.
  • Protected routes return 401 when session authentication fails.
  • POST /api/auth/login returns 429 with { "error": "Too many login attempts" } after 5 failed attempts per 15 minutes for the same normalized username/client IP.

Auth Routes

MethodPathAuthRequestResponse
POST/api/auth/loginNJSON username/passwordsession cookie + user/session payload or error
POST/api/auth/logoutNsession cookieclears cookie
GET/api/auth/meYsession cookiecurrent user/session
POST/api/auth/registerNJSON username/passwordcreates first user/session
GET/api/auth/statusNnoneregistration/status payload
POST/api/auth/unlockNJSON passwordunlock result
GET/api/healthNnonehealth payload

Apps And Store

MethodPathAuthPurpose
GET/api/v1/appsYList installed apps
POST/api/v1/apps/[appId]/startYStart app stack
POST/api/v1/apps/[appId]/stopYStop app stack
POST/api/v1/apps/[appId]/restartYRestart app stack
POST/api/v1/apps/[appId]/check-updatesYCheck one app for updates
GET/api/v1/apps/[appId]/logs/streamYSSE container logs
GET/api/v1/store/appsYList catalog apps
GET/api/v1/store/apps/[appId]YApp detail
GET/api/v1/store/apps/[appId]/composeYCompose for catalog/installed app
PATCH/api/v1/store/apps/[appId]/settingsYUpdate stored app settings
POST/api/v1/store/apps/[appId]/installYStart install operation
POST/api/v1/store/apps/[appId]/updateYStart update operation
POST/api/v1/store/apps/[appId]/redeployYStart redeploy operation
POST/api/v1/store/apps/[appId]/uninstallYStart uninstall operation
GET/api/v1/store/operations/[operationId]YOperation snapshot
GET/api/v1/store/operations/[operationId]/streamYSSE operation progress
POST/api/v1/store/check-updatesYCheck catalog/installed updates
POST/api/v1/store/custom-apps/installYInstall custom app
GET/api/v1/store/sourcesYList catalog sources
POST/api/v1/store/sourcesYCreate catalog source
PATCH/api/v1/store/sources/[sourceId]YUpdate catalog source
DELETE/api/v1/store/sources/[sourceId]YDelete catalog source
POST/api/v1/store/sources/[sourceId]/refreshYRefresh catalog source

Contracts: lib/shared/contracts/apps.ts, lib/shared/contracts/docker.ts. Operation SSE events: operation.step, operation.completed, operation.failed, heartbeat.

Store operation mutation routes can return 409 with code: "operation_conflict" when the same app already has an active operation, or 429 with code: "operation_limit_reached" when serverEnv.STORE_MAX_CONCURRENT_OPERATIONS is reached.

Docker

MethodPathAuthPurpose
GET/api/v1/docker/infoYDocker daemon info
GET/api/v1/docker/statsYContainer stats snapshot
GET/api/v1/docker/stats/streamYSSE stats stream
POST/api/v1/docker/prune/imagesYPrune Docker images
POST/api/v1/docker/prune/volumesYPrune Docker volumes

Docker stats SSE events: stats.updated, heartbeat.

Files

MethodPathAuthPurpose
GET/api/v1/filesYList directory
GET/api/v1/files/rootYFile root info
GET/api/v1/files/contentYRead file content
PUT/api/v1/files/contentYWrite text file
GET/api/v1/files/assetYStream asset content
GET/api/v1/files/downloadYDownload file
POST/api/v1/files/uploadYUpload files
POST/api/v1/files/opsYCreate/rename/paste/info/star operations
GET/api/v1/files/searchYSearch files
GET/api/v1/files/starredYList starred files
GET/api/v1/files/zipYDownload folder zip
POST/api/v1/files/trash/moveYMove entry to trash
POST/api/v1/files/trash/restoreYRestore trash entry
POST/api/v1/files/trash/deleteYDelete trash entry
POST/api/v1/files/trash/emptyYEmpty trash
GET/api/v1/files/network/discover/serversYDiscover SMB servers
POST/api/v1/files/network/discover/sharesYDiscover SMB shares
GET/api/v1/files/network/sharesYList SMB shares
POST/api/v1/files/network/sharesYAdd SMB share
DELETE/api/v1/files/network/shares/[shareId]YRemove SMB share
POST/api/v1/files/network/shares/[shareId]/mountYMount SMB share
POST/api/v1/files/network/shares/[shareId]/unmountYUnmount SMB share
GET/api/v1/files/shared/foldersYList local folder shares
POST/api/v1/files/shared/foldersYAdd local folder share
DELETE/api/v1/files/shared/folders/[shareId]YRemove local folder share
GET/api/v1/files/usbYList USB drives
GET/api/v1/files/usb/streamYSSE USB events
POST/api/v1/files/usb/[driveId]/mountYMount USB drive
POST/api/v1/files/usb/[driveId]/unmountYUnmount USB drive
POST/api/v1/files/usb/[driveId]/ejectYEject USB drive
GET/api/v1/files/google-drive/authNStart Google Drive OAuth
GET/api/v1/files/google-drive/callbackNOAuth callback
GET/api/v1/files/google-drive/connectionsYList Drive connections
DELETE/api/v1/files/google-drive/connections/[id]YDelete Drive connection
GET/api/v1/files/google-drive/[id]/browseYBrowse Drive folder
GET/api/v1/files/google-drive/[id]/downloadYDownload Drive file
POST/api/v1/files/google-drive/[id]/uploadYUpload Drive file
POST/api/v1/files/google-drive/[id]/foldersYCreate Drive folder
PATCH/api/v1/files/google-drive/[id]/files/[fileId]YMove/rename Drive file
DELETE/api/v1/files/google-drive/[id]/files/[fileId]YDelete Drive file

Contracts: lib/shared/contracts/files.ts, lib/shared/contracts/usb.ts, lib/shared/contracts/google-drive.ts. File service errors use FileServiceErrorCode.

POST /api/v1/files/upload accepts multipart FormData with path, optional includeHidden, and repeated file parts. The route stream-parses multipart content with busboy, passes each file stream to the file service, and avoids holding whole uploads in memory. The client upload helper uses XMLHttpRequest for progress and supports AbortSignal cancellation. Next's route-handler proxy upload limit is configured by experimental.proxyClientMaxBodySize in next.config.mjs; external reverse proxies may still enforce their own limit.

POST /api/v1/files/ops also supports action: "unzip" for archive extraction beside create/rename/paste/info/star operations.

Network

MethodPathAuthPurpose
GET/api/v1/network/statusYNetwork status
GET/api/v1/network/networksYWiFi scan
POST/api/v1/network/connectYConnect WiFi
POST/api/v1/network/disconnectYDisconnect WiFi
GET/api/v1/network/events/streamYSSE network events

Contract: lib/shared/contracts/network.ts.

Notifications

MethodPathAuthPurpose
GET/api/v1/notificationsYList notifications
DELETE/api/v1/notificationsYClear notifications
POST/api/v1/notifications/read-allYMark all read
GET/api/v1/notifications/streamYSSE notification events

Contract: lib/shared/contracts/notifications.ts.

Scheduled Tasks

MethodPathAuthPurpose
GET/api/v1/scheduled-tasksYList tasks
POST/api/v1/scheduled-tasksYCreate task
GET/api/v1/scheduled-tasks/[taskId]YTask detail
PATCH/api/v1/scheduled-tasks/[taskId]YUpdate task
DELETE/api/v1/scheduled-tasks/[taskId]YDelete task
POST/api/v1/scheduled-tasks/[taskId]/runYRun task now

Contract: lib/shared/contracts/scheduled-tasks.ts.

Settings And System

MethodPathAuthPurpose
GET/api/v1/settings/appearanceYAppearance settings
PUT/api/v1/settings/appearanceYSave appearance settings
GET/api/v1/settings/telemetryYAnonymous usage stats setting
PUT/api/v1/settings/telemetryYTurn anonymous usage stats on or off ({ "enabled": boolean })
GET/api/v1/settings/google-oauthYPublic Google OAuth config status
PUT/api/v1/settings/google-oauthYSave Google OAuth client credentials
DELETE/api/v1/settings/google-oauthYClear Google OAuth client credentials
GET/api/v1/system/infoYServer info
GET/api/v1/system/metricsYMetrics snapshot
GET/api/v1/system/streamYSSE metrics stream
GET/api/v1/system/preferencesYSystem preferences
PUT/api/v1/system/preferencesYSave system preferences
GET/api/v1/system/securityYSecurity settings
PUT/api/v1/system/securityYSave security settings
GET/api/v1/system/updatesYUpdate status
POST/api/v1/system/updates/checkYCheck for updates
POST/api/v1/system/updates/applyYApply update
GET/api/v1/system/backupsYList backups
POST/api/v1/system/backups/runYRun backup
PUT/api/v1/system/backups/settingsYSave backup settings
POST/api/v1/system/backups/[backupId]/restoreYRestore backup
GET/api/v1/system/power/capabilitiesYPower capabilities
GET/api/v1/system/power/scheduleYReboot schedule
PUT/api/v1/system/power/scheduleYSave reboot schedule
POST/api/v1/system/power/shutdownYShutdown host
POST/api/v1/system/power/rebootYReboot host
POST/api/v1/system/power/factory-resetYSchedule factory reset
GET/api/v1/system/disksYList disks
POST/api/v1/system/disks/formatYFormat partition
POST/api/v1/system/disks/mountYMount partition
POST/api/v1/system/disks/unmountYUnmount partition
POST/api/v1/system/disks/create-partitionYCreate partition
POST/api/v1/system/disks/delete-partitionYDelete partition
POST/api/v1/system/disks/wipeYWipe disk
GET/api/v1/logsYRead logs

Contracts: lib/shared/contracts/system.ts, lib/shared/contracts/disks.ts, lib/shared/contracts/server-info.ts.

Terminal

MethodPathAuthPurpose
POST/api/v1/terminal/executeYExecute allowlisted command
WS/api/terminalConfigured by TERMINAL_WS_REQUIRE_AUTHFull PTY terminal

WebSocket client-to-server messages in lib/server/modules/terminal/websocket-server.ts:

MessageShapeEffect
input{ "type": "input", "data": string }Writes data to PTY
resize{ "type": "resize", "cols"?: number, "rows"?: number }Resizes PTY
attach{ "type": "attach", "target": string }Switches to docker exec -it <target> bash, fallback sh
ping{ "type": "ping" }Sends { "type": "pong" }

Server-to-client terminal output is mostly raw PTY bytes as WebSocket text. Error messages can be JSON: { "type": "error", "code": string, "message": string }.

Known Auth Gaps

Current /api/v1/** routes are protected by the shared requireApiSession() helper except the Google Drive OAuth bootstrap/callback routes listed above. See security.md for remaining risks.

bytes
12,979
lines
220
Type
md
Latest commit
16 October 2026