Guide

API authorization and response matrix

Staff, supervisors and administrators who need one place to check sign-in, workspace and role for each endpoint stated in this site pack, and how sign-in required, forbidden, not found and method not allowed replies are handled

What this page consolidates

This page puts the endpoint and response statements already written on the health page, in the configuration and safe defaults guide, in the analytics inventory and analytics definitions pages, on the security page and in the app kit notes in this site pack into one matrix. It adds no new sign-in path, no new role, no new tenancy path and no new permission. It changes no sign-in check, no workspace scope and no permission. A statement that is not in those files is marked as Not in the record provided. Signed-in module code, workspace settings and the signed-in app script are not in this site pack, so route paths and status codes for those modules are not listed as fact here.

  • A workspace is the MAJIC company. App roles sit on top of MAJIC roles, as stated in the app kit notes in this pack
  • The server checks the permission again when a record is saved. A hidden button is never the only control, as stated on the security page
  • Lists, notifications, page titles and audit detail carry no survivor name, note text, message content or access code, and lists keep a neutral case reference, as stated on the security page and in the guides
  • Test records flagged as test stay out of grant counts and exports, as stated on the reports page and in the guides

Public endpoints with no sign-in

These endpoints need no sign-in to read or to submit a public request. They return no case, message or account detail.

Public endpoints with no sign-in
EndpointSign-in, workspace and roleSuccess and failure repliesGuard against cross-workspace data
Public pages and guides, GET /, /features, /reports, /guides/, /security, /guides/* and the same public pages listed in this site packNo sign-in needed to read. No workspace data. No role check. Documented in the call inventory in site.js as read in the browser with no JavaScript retryA missing address shows the 404 page with the heading That page is not here and a link to the home page. No sign-in required or forbidden reply applies on this pack for a public page read. A not found reply for a page is the 404 page, not a case or message replyThe 404 page states that nothing entered on another page was changed and that it does not change any case, message or form. The diagnostics reference on that page identifies the page load only and carries no case, message or form detail
POST /api/public/request, the only write endpoint in this packNo credentials are sent with this call in this pack. No workspace record. No role check. Server record holds topic, kind derived from topic, and page pathname only, capped at 200 characters. Kind is derived only after validation passes and grants no access, as stated in the configuration guideSuccess is shown only when the reply is a plain object with ok exactly true. A 422 reply with field errors uses only known fields on the form with cleaned messages capped at 200 characters. Timeout is 12000 ms with 0 retries. Other failures keep entries on the page, keep the draft, discard the partial reply and show a plain message. A manual retry reuses the same X-Client-Request-Id as a deduplication hint onlyPage stays pathname only, never form content as page. Unknown fields are stripped and never sent. No case, message or form detail is returned. The local funnel list in the tab is never a server count source and never joins to an audit record by client request id, diagnostics reference or draft content, as stated in site.js
GET /health for a machine liveness checkNo credentials and no form data. No workspace data. No role check. Do not parse the page body and do not require the app or sign-in checks to respond, as stated on the health pageTreat a 200 response as liveness. Alert only when /health does not return 200. This page loading is liveness with no dependency check and no automatic app or sign-in checkThe health page reports only whether each part responded and shows no case, message, account or internal detail

Session and health checks with sign-in and workspace

These checks read sign-in state or served files only. They show no case, message, account or internal detail. No check runs on load on the health page. Select Check again to run the app and sign-in checks on that page.

Session and health checks with sign-in and workspace
EndpointSign-in, workspace and roleSuccess and failure repliesGuard against cross-workspace data
GET /api/me for the health readiness check, signed-in only on the health pageSame-origin with a signed-in session, only when the person selects Check again. Cache no-store. No role-specific rule for this check in this pack. Readiness needs a signed-in session. Do not alert readiness from an unauthenticated probe and do not clear a readiness alert with an unauthenticated probeOnly a 200 reply with ok exactly true at /api/me counts as Responding, as stated in the configuration guide. A 401 reply with ok exactly false counts as Sign-in required, not ready. A forbidden reply, a not found reply, a method not allowed reply, a timeout reply and a server reply count as Degraded. No reply counts as Not responding. Response text is discarded and never shownNo account name, email or case detail is read or shown. Results describe this check only and state no cause. No version, host, address or internal error text is shown
GET /app/ for the health app check, on demand onlySame-origin, only when the person selects Check again. No workspace data. No role check. Shows that signed-in app files were servedA 200 response with a final address of /app/ or /app counts as Responding. A sign-in request, a forbidden reply, a not found reply, a method not allowed reply, a timeout reply, a server reply and a success reply at another address count as Degraded. No reply counts as Not responding. Response text is discardedNo internal detail is shown. Results describe this check only and state no cause
GET /theme.css, /site.css, /site.js, /icons/icon.svg and /manifest.webmanifest for the site assets and configuration checkSame-origin, only when the person selects Check again. No workspace data. No role checkA 200 reply for each asset at its own address counts as Responding. Any other reply counts as Degraded, even when the site itself responded. No reply counts as Not responding. Response text is discardedNo internal detail is shown
GET /sw.js for service worker registrationNo sign-in, no workspace data and no role check in this pack. Read only, scope /8000 ms timeout, 1 retry and 600 ms backoff in this pack. Final failure shows a status with a Retry action and retries once when the browser reports online or the page becomes visible. Pages still loadNo workspace data. Retry applies to reads only, never to a write that creates a request
GET / for the offline page check and automatic reloadsSame-origin, no workspace data, no role check5000 ms check timeout, at most 3 checks, 800 ms base backoff doubling to an 8000 ms cap plus up to 500 ms jitter, at most 3 automatic reloads in 60 seconds. When checks are exhausted or the reply is not a ready reply, status stays on the offline page and no case, message or form changesNo case, message or form detail. No reload loop runs
GET /api/me for the app shell session expired probe in public/app/index.htmlSame-origin, after 2500 ms, 5000 ms timeout, read only, cache no-store, manual redirect, Accept application/json. No workspace data shown. No name or email stored or shownA 401 reply, an opaqueredirect reply and a redirect reply show Your session expired with Sign in and resume. The resume path is stored with token-like address values removed, at most 2 attempts within 2 hours. No reply leaves the loading page unchangedWork saved on the server was not changed. Entries not saved on the page were not saved and need to be entered again, as stated on the loading screen
Documented session label check for GET /api/me in site.js comments and the analytics inventory tableDocumented as same-origin, cache no-store, read only. The pack documents the check in comments and in the inventory table and no fetch for /api/me appears in the site.js file in this pack, so a reader should not assume the label check runs from this pack aloneDocumented policy is to leave the link label unchanged on any error or non-401 failure. Only a 401 changes the label, as documented. Nothing is storedNo name or email is shown on shared devices, as documented

Single response contract for API endpoints in this pack

Use this contract for every endpoint named in this page. A success reply and a failure reply have one shape each. A client that accepts an older shape on read only does not make that shape canonical. No new endpoint is added by this section.

EndpointCanonical success replyCanonical failure replyClient normalization, with no breaking change
POST /api/public/requestHTTP 200 to 299, JSON plain object, ok exactly true. The client shows success only for that shape. Any other shape is not success.Validation failure: HTTP 422, JSON plain object, ok exactly false, error as a plain string, fieldErrors as an array of field and message items, at most 8 items, message cleaned and capped at 200 characters, field limited to a known field on the form. Other failure: HTTP 400 to 599, timeout, network failure, offline state, empty reply, invalid JSON or a reply with no ok field. The client keeps entries on the page, keeps the draft, discards the partial reply and shows a plain message.site.js accepts on read only the older field error shapes errors, fieldErrors or fields as an array, and errors or fieldErrors as an object map, and normalizes them to the canonical fieldErrors array. A server must not emit an older shape as a new reply. Unknown fields are ignored. A manual retry reuses the same X-Client-Request-Id as a deduplication hint only. Timeout is 12000 ms with 0 automatic retries.
GET /api/me, health readiness check and app shell session probeHTTP 200, final path /api/me, non HTML reply, JSON plain object, ok exactly true. The health page counts that shape as Responding. Response text after reading ok is discarded and never shown.Sign in required: HTTP 401, final path /api/me, non HTML reply, JSON plain object, ok exactly false. The health page counts that shape as Sign-in required, not ready. Any other status, an HTML reply, a missing or non boolean ok value, a mismatched status and ok value, an empty final path, a reply at another address, or no reply counts as Degraded on the health page, and as Not responding when no reply arrived.The health page reads only the ok value from the JSON body and discards every other body field. The app shell probe in public/app/index.html reads status only, with manual redirect and Accept application/json, and does not read the ok value. That probe is not a readiness proof. It treats a 401 reply, an opaqueredirect reply and a redirect reply as session expired, a 403 or 404 reply as workspace not available, and a 408, 429 or 5xx reply as server unavailable. Do not use the probe result as a readiness alert. Readiness needs a signed in session and the canonical success shape above.
GET /health, GET /app/, site assets and GET /sw.jsHTML or non HTML document or asset reply, HTTP 200, final path matching the requested address, and for the app shell an HTML content type, for an asset a non HTML content type. GET /health with HTTP 200 is liveness only.Any other status, a final path at another address, a mismatched content type, or no reply counts as Degraded on the health page, and as Not responding when no reply arrived. Response text is discarded and never shown.These endpoints have no ok envelope. Do not parse a page body as JSON and do not require the app or sign in checks to respond for liveness. Site assets, the app check and the sign-in check use fetchWithRetry with MAX_RETRIES 1, 8000 ms timeout and 600 ms backoff doubling on 408, 429, 5xx, timeout and TypeError. The service worker check in the health page uses startCheck with a single timed fetch and no retry. Service worker registration in site.js uses 8000 ms timeout, 1 retry and 600 ms backoff. The offline page check uses 5000 ms timeout with at most 3 checks. The app shell probe uses 5000 ms timeout after 2500 ms with no retry.
  • Success needs the status, the final path, the content type where stated, and ok exactly true together. A status alone, a body alone, or a path alone is not success.
  • A failure reply never carries survivor name, note text, message content, access code, secret value, account name or email. The health page and the app shell show no such detail.
  • Field error messages in a 422 reply are cleaned, capped at 200 characters, limited to known fields on the form, and shown with the same per field summary as client validation.
  • Retry applies to read only checks only. The write endpoint POST /api/public/request has 0 automatic retries, so a manual retry cannot create a duplicate request without the person choosing it again.

Workspace and role rules for signed-in work

The rules in this section are stated in the app kit notes, the security page and the guides in this pack. They apply across signed-in work. Route paths and status codes for signed-in modules are not in this site pack, so they are not listed here as fact.

  • The workspace (tenant) is the MAJIC company, so a workspace id is the MAJIC company id. App roles sit on top of MAJIC roles. The Majic team can open any workspace, as stated in the app kit notes in this pack
  • Every SQL statement in the app names tenant_id and binds the signed-in tenant, as stated in the app kit notes in this pack. The gate checks this rule and prepares every query against the schema in that pack
  • Permissions are checked with requirePerm, and permission names used must appear in src/app.json roles, as stated in the app kit notes in this pack. That file is not in this site pack
  • The server checks the role again on every save. Show buttons only when the role includes the task, and keep the server check on save, as stated in every guide in this pack
  • Roles in this pack are administrator, supervisor, advocate, partner, reporter and survivor. A case manager uses the advocate role. Partner staff see only referrals sent to their agency in lists, detail and exports. Reporters see de-identified counts only and do not open case notes, messages or names. Advocates and case managers work in assigned cases, assigned programs and the on-call queue. Survivors reach the program through a single-purpose safe link with no full account unless they choose one
  • Public routes with public true find the workspace from the record they serve by public token and still select tenant_id, never from the request, and return only what that page needs, as stated in the app kit notes in this pack
  • Expiring, expired and revoked consent blocks a referral send, and a pending or suspended agency cannot receive a new referral, as stated in the cases, referrals and consent page and in the partner guides

Not in the record provided and differences to review

These items need a check in locked files outside this pack before a count, alert or filing relies on them. No value is invented for them in this guide.

  • Signed-in module route paths, methods, permission names per route, and sign-in required, forbidden, not found and method not allowed codes for those modules are Not in the record provided in this site pack. That code lives in src/app and src/app.json in the app kit notes in this pack, outside this pack
  • D1 database binding DB, R2 bucket FILES, vault or config secrets by reference, and workspace settings, roles and permissions in src/app.json are outside this pack, as stated in the configuration guide. No default value is stated here
  • Retry counts verified against the shipped health script in this pack: MAX_RETRIES is 1 in public/health.html, used by fetchWithRetry for the app check at /app/, the sign in check at /api/me and the site assets check, with 8000 ms timeout and 600 ms backoff doubling. The service worker check in that script uses startCheck with a single timed fetch and no retry, with 8000 ms timeout and a final path check for its address. Service worker registration in public/site.js uses 8000 ms timeout, 1 retry and 600 ms backoff. The configuration guide Table C listing 1 retry for the health app, sign in and asset checks matches the shipped health script and should be used for monitoring timeouts
  • Readiness wording verified against the shipped health script in this pack: classifyReadyWithBody in public/health.html requires a final path of /api/me, a non HTML reply, and a JSON body with ok as a boolean, with HTTP 200 and ok exactly true for Responding and HTTP 401 and ok exactly false for Sign-in required. A 200 reply without an ok field, a 401 reply without an ok field, an empty final path and a mismatched status and ok value count as Degraded in that script. The earlier statement that the script counts those shapes as Responding or Sign-in required is removed
  • The health script in this pack declares appDone, readyDone and assetsDone before use, as var appDone; var readyDone; var assetsDone; in public/health.html. No undeclared assetsDone assignment and no unused variable named char is present in that script in this pack. The earlier statement to the contrary is removed
  • The 404 file in this pack sanitizes token-like address values for /app paths and redirects, and the same file redirects for /index.html, /guides and .html addresses with the raw address values and fragment without the same sanitization in this pack. Confirm the shipped file before sharing an old link
  • The analytics definitions, analytics funnel and analytics inventory pages state that several funnel steps, including page served and sign-in success from this pack alone, cannot be stated from the logs in this pack and add no new event and no new tracking to fill the gap. Start a public page funnel at the public request record only, as stated on those pages

What to check before live use

Confirm these items before you run a health check or a grant count. Stop at the first item that fails.

  1. Confirm the workspace and role

    Sign in with a MAJIC account and confirm the workspace and program name match the invite. Confirm the buttons for the task appear. If a button is not shown, note the role name and ask a workspace administrator to check the role. The server checks the permission again on save

  2. Run liveness and readiness separately

    Use the unauthenticated /health probe for liveness only. Run the sign-in readiness check only with a signed-in session and only on demand. Do not alert readiness from an unauthenticated probe

  3. Read status results in order

    Read site itself first, then the signed-in app with a 200 reply at /app/ or /app, then the sign-in service with a 200 reply and ok exactly true at /api/me, then site assets with a 200 reply for each asset. Treat sign-in required as not ready and treat forbidden, not found, method not allowed, timeout and server replies as Degraded. No reply counts as Not responding

  4. Keep close-out checks in the case folder

    Work the queue, save the next step in the case folder, and re-check that every open item has a due date, an assignee and a backup name. Do not create a duplicate case or referral to move the work

See SafeConnect with sample records

Request a demo and walk through a case, a referral and a grant report in one session.

Request a demo