Health endpoints for liveness and readiness
One public liveness check with no sign-in and one signed-in readiness check for staff. This page states the exact route, the exact response schema, the one external uptime monitor contract, and what neither check may show.
Audit of health, ping, readiness, and version endpoints in this pack
What the pack already states and what this page closes. Schemas below follow the envelope on Status and in APPKIT.md. A client also accepts a legacy flat form on read. A server writes only the envelope form.
| Check | Route found in pack | Auth found in pack | Schema found in pack | Gap closed by this page |
|---|---|---|---|---|
| Liveness | /api/health in public/site.js and public/status.html | None, credentials omitted, cache no-store | Implicit only. public/site.js accepts ok true, status live, service campus after merging data into the top level | Exact envelope success and failure schemas, status codes, headers, and leakage rules below |
| Readiness | No exact route stated. public/operations.html and public/status.html describe a signed-in check only | Signed-in staff only, inside the signed-in app. No change to sign-in or role policy is made on this page | Described in words as ready or not ready for database, MAJIC sign-in, and workspace store | Exact route /api/readiness, auth behavior, and envelope JSON schema below |
| Ping | None. No ping route is documented in this pack | Not applicable | None stated | Explicit rule below. Do not add a ping route. Liveness on /api/health is the only public health route |
| Version and environment | None. public/status.html states the live check never shows version detail | Not applicable | None stated | Explicit rule below. Neither endpoint returns a build version, environment mode, commit, internal URL, api_version, meta field, or configuration value |
| External uptime monitoring | No monitor target, interval, timeout, keyword, or header expectation stated. Status page probe only | Not stated. A monitor could mistakenly target signed-in readiness and flap on 401 | No monitor-ready pass or fail rule stated | One consolidated contract below: GET /api/health only, no sign-in, no cookies, 60 second minimum interval, 8000 millisecond client timeout, HTTP 200 with live and campus values, private no-store headers, and a leak-detecting tester that never prints a leaked value |
No other health, ping, readiness, or version route is documented in this pack. Do not add a ping route, a version route, a dependency detail field, a meta field, an api_version field, or a second readiness route on this page.
Unauthenticated liveness endpoint
Use this check to confirm the service answers with no sign-in. It is the only public health route.
Route and request
- Method and route: GET /api/health
- Auth: none. The client sends no sign-in and no cookies, with cache no-store
- Timeout in the client: 8000 milliseconds in public/site.js
- Retry in the client: on page load and only again when the person chooses Check again. No polling is stated in this pack
- Response headers: Content-Type application/json, Cache-Control private, no-store
What it reports
- Only whether the service is live
- It does not report the database, MAJIC sign-in, workspace store, or any upstream dependency. Those items belong to readiness only
- It does not report a build version, environment mode, a build number, a commit, api_version, a meta field, or a configuration count
- It does not report an internal address, a host name, a database name, or a file path
Response schema, success
HTTP 200
{
"ok": true,
"data": {
"status": "live",
"service": "campus",
"checked_at": "2026-11-06T14:17:20Z"
}
}Response schema, not live
HTTP 503
{
"ok": false,
"error": "Service is not confirmed as live. Check the connection and try again.",
"code": "service_unavailable"
}Field rules for liveness
- ok is a boolean inside the envelope. Success uses true. Not live uses false
- On success, data.status is live only and data.service is campus only, as public/site.js accepts after the merge
- data.checked_at is ISO 8601 in UTC with Z, or null when no time is available. It is never an empty string
- On failure there is no data field. error is a plain sentence telling the person what to do, with no internal error text. code is service_unavailable for a 503 response
- HTTP 200 is used only with ok true. HTTP 503 is used for not live. Never return 200 with ok false and never return data on error
- No other field is returned. In particular, no checks object, no dependency name, no build version, no api_version, no meta field, no environment mode, no internal URL, no address, and no secret value is returned
External uptime monitoring: one secret-free contract
Use this contract for every outside uptime monitor. It consolidates liveness, readiness, ping, and version findings into a single public target, so a monitor never needs sign-in, a secret, a version value, or a dependency detail to decide whether the service is live.
The single monitor target
- URL: https://campus.appmajic.ai/api/health
- Method: GET only. Do not use HEAD, POST, or any other method, and do not probe /api/ping, /api/version, /api/status, or /status as a substitute
- Sign-in: none. Cookies: none. The monitor sends no cookies, no Authorization header, and no workspace id
- Headers to send: Accept application/json only. No other custom header is needed
- Timeout: the client timeout is 8000 milliseconds. Set the monitor timeout to 10000 milliseconds or more, so a slow answer is not recorded as down before the client timeout
- Interval: at least 60 seconds between checks. Do not poll faster than once per minute, and do not retry in a loop
What the monitor treats as up and as down
- Up: HTTP 200 with ok true, status live, and service campus, in envelope form or in legacy flat form on read
- Down: HTTP 503, any other status, a timeout, a network failure, a non-JSON answer, or HTTP 200 without live and campus values
- Not configured, not down: HTTP 401, 403, or 404 from a monitor means the monitor target or credentials are wrong. A monitor must never target GET /api/readiness, because readiness requires sign-in and an unsigned call returns 401 by design
- Keyword check, where the monitor supports one: look for live in the status field only. Do not assert on api_version, version, build, environment, or any meta field, and do not store the response body
| Item | Monitor setting or expected result |
|---|---|
| Expected response headers | Content-Type application/json, Cache-Control private, no-store, no Set-Cookie, and no ETag. A cached or shared answer is not a fresh live check |
| Body the monitor may read | Only ok, status, service, and checked_at, in envelope form or in legacy flat form on read. The monitor reads status live and service campus and ignores every other field |
| Leakage guard | If the body contains meta, api_version, version, build, commit, environment, config, checks, database, sign_in, workspace_store, secret, token, or password, the monitor records not monitor-ready, names the field only, and never displays, stores, or forwards the value. That result is a leakage failure to report, not a live result to publish |
| Secret-free rule | No secret, password, token, API key, vault reference, connection string, or workspace id is sent by the monitor or returned by the route. No such value is added to a monitor config, a log line, or a page |
Copy-ready check for an outside monitor
curl -i --max-time 10 -H "Accept: application/json" https://campus.appmajic.ai/api/health- Pass only when the status is 200, the content type is application/json, the cache control is private, no-store, no cookie is set, no ETag is sent, and the body shows ok true with status live and service campus
- Fail as not monitor-ready when a forbidden field named in the leakage guard is present, when checked_at is missing in envelope form, or when any dependency, version, address, or secret detail is present
- Do not add the body, a version value, or a dependency name to a monitor alert, a ticket, or a log line. Quote only live or not live, the date and time checked, and the response time in milliseconds
Run the monitor check on this page
This check fetches GET /api/health with no sign-in and no cookies, with an 8000 millisecond timeout per attempt and one retry after 800 milliseconds only for a transient status, timeout, network, or non-JSON failure, and only one check runs at a time, and reports pass or fail for each item. It never prints the response body and never prints a leaked value. It names a forbidden field only when one is present.
The monitor check has not run yet.
Authenticated readiness endpoint
Use this check before publishing, with sign-in. It verifies the dependencies a college workspace needs and shows only ready or not ready for each item.
Route and request
- Method and route: GET /api/readiness
- Auth: MAJIC sign-in required. The route is never called without sign-in and never called from the public status page. This page makes no change to sign-in or role policy
- Tenancy: the check resolves the signed-in college workspace from the session. It accepts no workspace id from the request that widens access to another college
- Response headers: Content-Type application/json, Cache-Control private, no-store
- Client timeout: 8000 milliseconds, the same client timeout as liveness, with no polling
What it reports
- database, the D1 binding named DB documented in public/operations.html and APPKIT.md
- sign_in, the MAJIC sign-in service for the college company
- workspace_store, the workspace store for the signed-in college workspace
- Each item shows ready or not_ready only. This is the whole reachability report. No item shows an internal address, a build version, an environment mode, a count, or a secret
Response schema, ready
HTTP 200
{
"ok": true,
"data": {
"status": "ready",
"checks": {
"database": "ready",
"sign_in": "ready",
"workspace_store": "ready"
},
"checked_at": "2026-11-06T14:17:20Z"
}
}Response schema, not ready
HTTP 503
{
"ok": false,
"error": "Readiness check did not pass for every item. Check the connection, confirm the college name, and try again.",
"code": "service_unavailable"
}Field rules for readiness
- ok is true only when every data.checks value is ready. Any not_ready value makes ok false, the status not_ready, and the HTTP status 503
- data.checks has exactly three keys, database, sign_in, and workspace_store, each ready or not_ready only
- data.checked_at follows the same ISO 8601 UTC rule as liveness, with null for a missing time
- On failure there is no data field. error is a plain sentence, with no internal error text, stack text, or dependency message. code is service_unavailable for a 503 response
- No other field is returned. In particular, no database name, no sign-in address, no internal URL, no workspace id, no build version, no api_version, no meta field, no environment mode, no configuration value, and no secret value is returned
Authentication failure
HTTP 401
{
"ok": false,
"error": "Sign-in is required. Sign in, confirm the college name, and try again.",
"code": "unauthenticated"
}A 401 answer uses code unauthenticated and a 403 answer uses code forbidden. Neither answer carries a data field or a checks object, because no check was run. It does not mean the database is down. The client must not retry in a loop and must not fall back to the public liveness route as a substitute for readiness. An outside monitor must never target this route.
Operations health view for signed-in staff
A view inside the signed-in app that runs the readiness check above and shows the result in plain words. It is shown only after MAJIC sign-in, only to signed-in staff who can run readiness today, and never on the public status page. This page adds no new role, no new permission, no new route and no new field. The server still returns 401 or 403 when sign-in is required or the signed-in role does not cover the check, and the view shows only the plain sentence in that case.
Layout, in order
- Header: college name as shown at the top of the app, checked time on the device, and response time in milliseconds measured on the device that ran the check
- Overall result: ready or not ready only, with one primary action Check again that runs the check fresh with no sign-in change and no polling
- One row per wire key, in this order: database, sign_in, workspace_store. Each row shows ready or not_ready only, with no address, version, count or error detail
- Footer links: Sign in when sign-in is required, Go to home page, and Read guides. No link calls readiness from a public page
How the view labels the three wire keys
- database is shown as Database, the D1 binding named DB for the signed-in college workspace
- sign_in is shown as MAJIC sign-in, an external service, for the college company. The label states external service so staff read a sign-in failure as an external dependency, not as a database failure
- workspace_store is shown as Workspace store, storage, for the signed-in college workspace. The label states storage so staff read a store failure as a storage failure for that workspace
- The wire keys are not renamed on the wire. The view groups the labels for reading only. It does not add a fourth key and it does not report the FILES bucket binding from this route. FILES is a separate fail-fast binding check in Configuration and safe defaults and in the configuration manifest, with no live status field in the readiness answer
| Case | Wire result | View shows, and what staff do next |
|---|---|---|
| Every check ready | HTTP 200, ok true, status ready, every checks value ready | Overall ready, each row ready, checked time and response time. Publishing may proceed only when the other fail-fast checks in Configuration and safe defaults also pass |
| Database down, or MAJIC sign-in external service down, or workspace store storage down | HTTP 503, ok false, code service_unavailable, no data field, plain error sentence only | Overall not ready, plain error sentence only, checked time and response time. The view does not name which dependency failed, because the answer carries no checks object on failure. Staff do not publish, check the connection, confirm the college name, and choose Check again. A live result on the public status page is not a ready result |
| Sign-in required, or signed-in role does not cover the check | HTTP 401 code unauthenticated, or HTTP 403 code forbidden, no data field, no checks object | Sign-in is required in plain words, with a Sign in link. No row is shown as ready or not_ready, because no check was run. Staff sign in, confirm the college name, and try again. The view must not retry in a loop and must not claim a dependency is down |
| Check does not complete, times out at 8000 milliseconds, or returns no answer text | No valid envelope, or a network failure on the device | Did not complete in plain words, checked time and response time where a time was measured, and Check again. No internal error text, no dependency name, and no claim that no approved source covers a question, because this is a health check and not an answer check. Staff check the connection and try again once |
| Rate limit reported by the server | HTTP 429 with the error shape in APPKIT.md, where the server provides it | The unavailable plain sentence plus wait guidance only from the server, with no exact wait time unless the server provides one. Staff wait before choosing Check again and do not retry in a loop |
Rules that apply to every degraded case
- Show only the plain error sentence from the answer. Do not show the upstream message, a stack trace, an address, a host name, a database name, a file path, a version, a configuration value or a secret
- Do not fall back to the public liveness route as a substitute for readiness, and do not show a public live result as a ready result in this view
- Run the check on view load and only again when the person chooses Check again. No polling, no session storage reuse and no shared cache. Response headers stay Content-Type application/json and Cache-Control private, no-store
- Keep the page heading and the college name visible when the result is not ready, keep controls at least 44 pixels high, keep focus visible by keyboard, and announce the result with a status region that states ready, not ready, sign-in required or did not complete
- When a dependency is down, the safe action is to stop publishing, keep work already saved in that college workspace readable where the app allows it, and route a person who needs help to the handoff office named for the assistant instead of showing a public answer. Do not invent contact details
Checks before a builder ships this view
- Sign in, confirm the college name, and run the view with every check ready. Pass only when overall ready and each row ready are shown with checked time and response time
- Test with the database, the MAJIC sign-in external service and the workspace store storage each down in turn in a test workspace. Pass only when overall not ready is shown with the plain sentence only and no dependency detail
- Test with no sign-in and with a signed-in role that does not cover the check. Pass only when sign-in required is shown with no row result and no claim that a dependency is down
- Test a timeout and a rate limit. Pass only when did not complete or wait guidance is shown with no internal error text and no retry loop
- Open the public status page and confirm it still calls only /api/health with no sign-in, shows only live or not live, and never calls /api/readiness
Use Status for the public live check, Configuration and safe defaults for fail-fast checks before publishing, and Get started for first sign-in setup before you run this view.
Leakage rules for both endpoints
These rules apply to every response, every log line derived from a response, and every page that shows a result.
Never returned
- No secret value, password, token, or API key in any field
- No vault reference value, no connection string, and no file content
- No database name, no bucket name beyond the documented binding names, no internal URL, and no internal address or host name
- No build version, environment mode, build number, commit, api_version, meta field, dependency version, or configuration count or name
- No internal error text, stack text, or upstream response body
- No student record detail, question text, or answer text
How the pages show the result
- public/status.html shows only live or not live, the checked time from the answer as ISO 8601 UTC with the device local label beside it, and response time in milliseconds. It reads ok, status, service, and checked_at after the merge, with top-level precedence, and ignores any other field in the answer. When checked_at is missing or null, the page states that checked time was not provided and shows no fabricated time
- The signed-in app shows only ready or not ready for each of the three items, with the checked time
- The operations health view above shows the same three items grouped as database, MAJIC sign-in external service and workspace store storage, with overall ready or not ready, checked time and response time, and no other field
- A failed check shows the plain error sentence only. It does not show the upstream message that caused the failure
- Neither page stores the response in browser storage and neither page sends the response to an outside tracker. The monitor tester on this page also stores nothing and sends nothing to an outside tracker
Version and environment rule
No ping endpoint and no version endpoint is added by this page. Neither route returns a build version, an api_version field, a meta field, or an environment mode field. Reachability is reported only as ready or not ready per dependency on readiness, and only as live or not live on liveness. When a version or environment is needed for support, the person states the checked time and the status from the page, and staff compare that time with the deployment record held outside the response. An outside monitor must never assert on, display, store, or forward a version value, even when a legacy answer contains one.
Order of checks before publishing
Run liveness first, with no sign-in
Open Status and run the live check on /api/health. It must show live before any readiness check is trusted.
Run readiness second, with sign-in
Sign in, confirm the college name at the top of the app, then run /api/readiness in the operations health view in the signed-in app. Every item must show ready before publishing. A live result is not a ready result and a ready result is not a live result.
Stop on any failure
Any not_live, not_ready, 401, or 403 answer stops publishing. Check the connection, confirm the college name, and try again. Do not publish while any check fails.