Skip to content

UI API Contract Map

This map ties each UI page/controller to the API endpoints and required response fields. If any required field changes, update UI controllers and tests in the same change.

Auth + Session

UI usageEndpointRequired fields / behavior
Auth bootstrap page (/auth)GET /api/v1/auth/bootstrapJSON: token (string)
Auth bootstrap page (/auth)POST /api/v1/session200 OK, sets rm_session cookie
Sidebar session statusGET /api/v1/session/check200 when active, 401/403 when expired
Sidebar logoutPOST /api/v1/session/logout200, clears rm_session cookie
SSE reconnect guardGET /api/v1/session/check401/403 triggers redirect to /auth

Overview (indexApp)

UI sectionEndpointRequired fields
Runtime status panelGET /api/v1/statusrouting, live, live_10m, pending, timeouts
Source diagnosticsGET /api/v1/statussent_search_source_reqs, recv_search_source_reqs, sent_publish_source_reqs, recv_publish_source_reqs, source_store_files, source_store_entries_total
Active search threads listGET /api/v1/searchessearches[] with search_id_hex, state, hits
Search details exportGET /api/v1/searches/:search_idsearch, hits[]
Stop selected searchPOST /api/v1/searches/:search_id/stopstopped (bool)
Delete selected searchDELETE /api/v1/searches/:search_iddeleted (bool), purged_results (bool)
Live status streamGET /api/v1/events (SSE)event: status with full status payload JSON

Searches (appSearch, appSearchDetails)

UI sectionEndpointRequired fields
Start keyword searchPOST /api/v1/kad/search_keywordqueued, keyword_id_hex
Keyword results paneGET /api/v1/kad/keyword_results/:keyword_id_hexkeyword_id_hex, hits[] with file_id_hex, filename, file_size, origin
Search thread listGET /api/v1/searchessearches[]
Search details pageGET /api/v1/searches/:search_idsearch, hits[]

Nodes / Routing (appNodeStats)

UI sectionEndpointRequired fields
Status cards + chartsGET /api/v1/statusrouting, live, live_10m; also time-series counters used by charts
Node tableGET /api/v1/kad/peerspeers[] with kad_id_hex, kad_version, verified, last_seen_secs_ago, last_inbound_secs_ago
Search-derived hit chartGET /api/v1/searchessearches[] with hits
Live status streamGET /api/v1/eventsevent: status payload

Logs (appLogs)

UI sectionEndpointRequired fields
Snapshot status logGET /api/v1/statusAny valid status payload
Search thread panelGET /api/v1/searchessearches[]
Live status logGET /api/v1/eventsevent: status payload

Settings (appSettings)

UI sectionEndpointRequired fields
Settings loadGET /api/v1/settingssettings, restart_required; nested keys under settings.general, settings.sam, settings.api
Settings savePATCH /api/v1/settingsUpdated settings, restart_required
Rotate token actionPOST /api/v1/token/rotatetoken (string), sessions_cleared (bool)
Session refresh after rotatePOST /api/v1/session200 OK, sets rm_session cookie

Contract Test Coverage

src/api/mod.rs includes router-level contract tests for UI-critical endpoints:

  • ui_api_contract_endpoints_return_expected_shapes

This test asserts response shape invariants for:

  • GET /api/v1/status
  • GET /api/v1/searches
  • GET /api/v1/searches/:search_id
  • GET /api/v1/kad/keyword_results/:keyword_id_hex
  • GET /api/v1/kad/peers
  • GET /api/v1/settings