22 KiB
API Route Map & Maintainer Guide
Status
First-generation maintainer guide.
This document follows the completed:
- Domain Architecture Programme
- Authorization Architecture Assessment
- Portal Integration Contract & API Platform Assessment
It is maintainability-focused.
It is not a full route inventory.
Purpose
This route map is intended to help a maintainer answer four practical questions before changing API behaviour:
Where should I start?
Which APIs are involved?
Which helpers are involved?
What integrations and risks am I touching?
The key working assumption from the completed assessment is:
Routes are primarily owned by journeys/features, not folders.
Journey Catalogue
1. Public Search
Purpose
Supports public case search, filtering, pagination, and result shaping across standard and advanced search journeys.
Primary UI Entry Points
pages/searchresults.jspages/advancedsearchresults.jscomponents/search/searchresults.jscomponents/search/addresssearchresults.jscomponents/search/dnssearchresults.js
Service Layer
actions/services/searchDirectService.jsgetBasicSearchPagedgetAdvancedSearchPaged- related basic/advanced search helpers
API Routes
pages/api/endpoint/getbasicsearch_api.jspages/api/endpoint/getbasicsearchpaged_api.jspages/api/endpoint/getadvancedsearch_api.jspages/api/endpoint/getadvancedsearchpaged_api.js- adjacent variants:
getbasicsearch_by_address_api.jsgetbasicsearch_by_lparref_api.js- DNS/public search variants
Integrations
- CRM Relay
- Local-only
Ownership Type
- feature-owned
Change Risk
- high
Reason:
- public-facing
- contract-critical results and filters
- paged/unpaged variants
- transform-heavy output shaping
First-Look Checklist
Before changing public search:
- Inspect the relevant
getbasicsearch*/getadvancedsearch*route family - Inspect
searchDirectServicecallers - Confirm paging, sorting, and transform expectations
- Check whether related document/detail routes are also affected
2. Case Details
Purpose
Supports public and portal case detail retrieval, linked-case lookups, messages, and related case-view data.
Primary UI Entry Points
pages/case/[ticketnumber].jspages/case/id/[incident].jscomponents/case/summary.jscomponents/case.js
Service Layer
actions/services/caseDirectService.jsgetCasegetCaseByIDgetCaseMessagegetIncidentbyID
API Routes
pages/api/endpoint/getcase_api.jspages/api/endpoint/getcasebyid_api.jspages/api/endpoint/getincidentbyid_api.jspages/api/endpoint/getcasemessage_api.jspages/api/endpoint/getlinkedcases_api.js
Integrations
- CRM Relay
Ownership Type
- feature-owned
Change Risk
- high
Reason:
- case detail contracts are widely consumed
- related routes often share assumptions about identifiers and transformed fields
First-Look Checklist
Before changing case details:
- Inspect the relevant case detail route family
- Inspect
caseDirectServicecallers - Check linked-case/message side routes
- Confirm UI expectations in case summary/detail components
3. Documents
Purpose
Supports published document metadata retrieval and published document download.
Primary UI Entry Points
components/search/searchresults.js- case/search document links surfaced in search and case journeys
Service Layer
actions/services/searchDirectService.jsactions/services/caseDirectService.jsfor adjacent case-document lookups
API Routes
pages/api/endpoint/getsearchdocumentdetails_api.jspages/api/endpoint/getsearchdocumentdetailspaged_api.jspages/api/endpoint/getsearchdocumenthistory_api.jspages/api/endpoint/getsearchdocumenthistorypaged_api.jspages/api/endpoint/getsearchdocumentTypes_api.jspages/api/documents/download/[id].js
Integrations
- CRM Relay
- Local-only
Ownership Type
- feature-owned with an integration-owned download proxy boundary
Change Risk
- high
Reason:
- direct user-facing download behaviour
- metadata, hash-link generation, and binary delivery split across multiple areas
First-Look Checklist
Before changing documents:
- Inspect metadata/detail/history routes
- Inspect
documents/download/[id].js - Confirm hash-link generation expectations
- Check search/case UI consumers that surface document links
4. My Portal Dashboard
Purpose
Supports authenticated portal lists and dashboard cards for cases, representations, and awaiting-submission work.
Primary UI Entry Points
pages/myportal/index.jscomponents/myportal/topthree.jscomponents/myportal/viewall.jscomponents/myportal.js
Service Layer
actions/services/portalDirectService.jsactions/services/documentDirectService.jsfor draft/blob-backed dashboard items
API Routes
pages/api/endpoint/getmycases_api.jspages/api/endpoint/getmyrepresentations_api.jspages/api/endpoint/getawaitingsubmission_api.js- adjacent blob/proxy routes for draft-backed data
Integrations
- CRM Relay
- Azure Storage
Ownership Type
- feature-owned
Change Risk
- high
Reason:
- authenticated portal-critical journey
- mixes CRM-owned and draft/blob-backed data
First-Look Checklist
Before changing my portal dashboard:
- Inspect primary dashboard list routes
- Inspect
portalDirectServiceanddocumentDirectService - Check dashboard components (
topthree,viewall) - Check portal state modules and current-view assumptions
5. Watched Cases
Purpose
Supports create/read/delete behaviour for watched cases across search, case, and myportal journeys.
Primary UI Entry Points
components/search/searchresults.jscomponents/case/summary.jscomponents/myportal/topthree.jscomponents/myportal/viewall.js
Service Layer
actions/services/portalDirectService.jsgetWatchedCasesgetWatchedCasesProxycreateWatchedCasesdeleteWatchedCases
API Routes
pages/api/endpoint/getwatchedcases_api.jspages/api/endpoint/getwatchedcasesproxy_api.jspages/api/endpoint/createwatchedcases_api.jspages/api/endpoint/deletewatchedcases_api.jspages/api/endpoint/deletewatchedcasesproxy_api.js
Integrations
- CRM Relay
- Local-only
Ownership Type
- feature-owned with orchestration on create/upsert
Change Risk
- high
Reason:
- multiple entry points
- state refresh after mutation
- mixed proxy/non-proxy and upsert behaviour
First-Look Checklist
Before changing watched cases:
- Inspect watched case route family
- Inspect
portalDirectService - Inspect
store/watchedCases/*andstore/currentView/* - Inspect CRM relationship and duplicate-check assumptions
6. Representations
Purpose
Supports representation retrieval, editing, and related case/portal representation views.
Primary UI Entry Points
pages/myportal/representation.jscomponents/representation.jscomponents/case/representation/*
Service Layer
actions/services/portalDirectService.jsactions/services/documentDirectService.js
API Routes
pages/api/endpoint/getrepresentations_api.jspages/api/endpoint/getrepresentationsproxy_api.jspages/api/endpoint/getmyrepresentations_api.jspages/api/endpoint/getmyrepresentationsproxy_api.js- adjacent representation draft/blob routes in
pages/api/file
Integrations
- CRM Relay
- Azure Storage
Ownership Type
- feature-owned
Change Risk
- high
Reason:
- representation journeys span CRM records and blob-backed draft/edit data
First-Look Checklist
Before changing representations:
- Inspect representation read routes
- Inspect blob-backed draft/edit support routes
- Inspect portal/document service callers
- Inspect currentView and related representation state
7. Draft Appeals
Purpose
Supports draft appeal progress, draft files, and storage-backed resume state before submission.
Primary UI Entry Points
pages/newappeal/[appealtypes].jspages/myportal/[appealtypes].jslib/newappeal/loadNewAppealPage.jslib/myportal/loadMyPortalAppealPage.js
Service Layer
actions/services/documentDirectService.jsactions/azurestorage.js
API Routes
pages/api/file/getprogressobjblob.jspages/api/file/getbloblist.jspages/api/file/upload.jspages/api/file/uploadsinglefile.jspages/api/file/deleteblobcase.jspages/api/file/setupcontainer.js
Integrations
- Azure Storage
- Local-only
Ownership Type
- integration-owned supporting a feature journey
Change Risk
- high
Reason:
- storage-backed draft integrity
- upload/delete/progress flows are user-critical before submission
First-Look Checklist
Before changing draft appeals:
- Inspect progress/blob list/upload/delete routes
- Inspect
documentDirectService - Inspect
actions/azurestorage.js - Inspect new appeal loaders and draft state assumptions
8. Draft Representations
Purpose
Supports representation draft JSON/files before final representation submission.
Primary UI Entry Points
pages/myportal/representation.jscomponents/case/representation/*lib/representation/pageLoaders.js
Service Layer
actions/services/documentDirectService.jsactions/azurestorage.js
API Routes
pages/api/file/getrepsblob.jspages/api/file/getrepsblobproxy.jspages/api/file/editRepJson.jspages/api/file/upload.jspages/api/file/deleteblobrep.js
Integrations
- Azure Storage
Ownership Type
- integration-owned supporting a feature journey
Change Risk
- high
Reason:
- draft representation data and uploads are part of a sensitive user submission path
First-Look Checklist
Before changing draft representations:
- Inspect rep blob routes and edit JSON route
- Inspect
documentDirectService - Inspect storage helper behaviour in
actions/azurestorage.js - Check representation page loader and currentView dependencies
9. Appeal Submission / Finalisation
Purpose
Transitions draft appeal state into submitted/finalised processing.
Primary UI Entry Points
pages/myportal/[appealtypes].jslib/myportal/loadMyPortalAppealPage.js- new appeal completion and check-answer flows
Service Layer
actions/services/documentDirectService.jsactions/services/accountDirectService.jsactions/services/caseDirectService.jsactions/azurestorage.js
API Routes
pages/api/file/createappealcompletemessage_api.jspages/api/file/createappealcompletemessageproxy_api.jspages/api/endpoint/createcase_api.jspages/api/endpoint/patchcase_api.jspages/api/endpoint/updatecase_api.js
Integrations
- CRM Relay
- Azure Storage
- Azure Queue
- Local-only
Ownership Type
- orchestration-owned
Change Risk
- very high
Reason:
- crosses storage, queue/finalisation, and CRM write boundaries
- contract-critical workflow transition
First-Look Checklist
Before changing appeal submission/finalisation:
- Inspect completion/finalisation routes
- Inspect
createcase_api,patchcase_api,updatecase_api - Inspect
documentDirectServiceandazurestoragehelpers - Inspect draft loaders and state handoff assumptions
10. Representation Submission / Finalisation
Purpose
Transitions drafted or newly entered representation content into submitted representation processing.
Primary UI Entry Points
pages/myportal/representation.jscomponents/case/representation/representationComplete.js
Service Layer
actions/services/portalDirectService.jsactions/services/documentDirectService.jsactions/services/notifyDirectService.jsactions/azurestorage.js
API Routes
pages/api/file/createrepcompletemessage_api.jspages/api/file/createrepinvolvement_api.jspages/api/endpoint/deletemyrepresentations_api.js- adjacent representation read/write support routes in
endpointandfile
Integrations
- CRM Relay
- Azure Storage
- Azure Queue
- GOV.UK Notify
Ownership Type
- orchestration-owned
Change Risk
- very high
Reason:
- multi-integration workflow
- user submission and notification side effects
First-Look Checklist
Before changing representation submission/finalisation:
- Inspect completion and involvement routes
- Inspect representation completion component and callers
- Inspect portal/document/notify service helpers
- Confirm storage, CRM, and notification sequencing assumptions
11. Account Registration
Purpose
Creates CRM-backed portal account/contact records for authenticated users who do not yet have portal account state.
Primary UI Entry Points
pages/account/register.jscomponents/account/registerform.jscomponents/account/registerCheck.jscomponents/account/registerComplete.js
Service Layer
actions/services/accountDirectService.jscreateAccountgetPortalLogin
API Routes
pages/api/endpoint/createaccount_api.jspages/api/endpoint/getemailaccountcheck_api.jspages/api/endpoint/getportallogin_api.js
Integrations
- CRM Relay
- NextAuth
Ownership Type
- feature-owned
Change Risk
- high
Reason:
- identity bootstrap and portal account creation are foundational
First-Look Checklist
Before changing account registration:
- Inspect create-account and login/account-check routes
- Inspect
accountDirectService - Inspect registration pages/components
- Confirm session-to-contact bootstrap assumptions
12. Personal Details / Account Management
Purpose
Supports personal details retrieval and update for authenticated portal users.
Primary UI Entry Points
pages/account/personaldetails.jscomponents/account/personaldetails.jscomponents/myportal/youraccount.js
Service Layer
actions/services/accountDirectService.jsgetPersonalAccountupdateAccount
API Routes
pages/api/endpoint/getpersonalaccount_api.jspages/api/endpoint/updateaccount_api.js- adjacent support routes:
getpreferredlanguage_api.jsupdatepassword_api.js
Integrations
- CRM Relay
- NextAuth
- Local-only
Ownership Type
- feature-owned
Change Risk
- high
Reason:
- user-critical account data
- identity/bootstrap coupling
First-Look Checklist
Before changing personal details/account management:
- Inspect account read/update routes
- Inspect
accountDirectService - Inspect account pages/components
- Inspect accountDetails state and session/bootstrap dependencies
13. Authentication / Sign-In
Purpose
Handles sign-in, verify-request, callback, redirect, and locale-aware auth/session behaviour.
Primary UI Entry Points
pages/index.js- auth pages and callback entry paths
Service Layer
lib/auth/*actions/services/accountDirectService.jsfor portal login resolution
API Routes
pages/api/auth/[...nextauth].jspages/api/auth/resolve-locale.js- adjacent support routes:
pages/api/endpoint/getportallogin_api.jspages/api/endpoint/getpreferredlanguage_api.js
Integrations
- NextAuth
- GOV.UK Notify
- CRM Relay
Ownership Type
- support-owned with platform-critical behavior
Change Risk
- very high
Reason:
- session and redirect behaviour are highly sensitive
- cross-cutting impact across the platform
First-Look Checklist
Before changing authentication/sign-in:
- Inspect
[...nextauth].js - Inspect locale resolution behavior
- Inspect portal login/preferred-language supporting routes
- Confirm callback, redirect, and EN/CY assumptions
14. Notifications / Email
Purpose
Handles direct Notify sends and broader notification workflows that gather CRM/document/event data before sending.
Primary UI Entry Points
- journey completion flows
- auth verify-request/sign-in flows
- background or triggered notification flows
Service Layer
actions/services/notifyDirectService.jsactions/services/portalDirectService.js
API Routes
pages/api/email/notify.jspages/api/email/getall.jspages/api/email/getdocuments.jspages/api/email/getevents.jspages/api/email/getmailinglist.jspages/api/email/getcaseref.js
Integrations
- GOV.UK Notify
- CRM Relay
- Local-only
Ownership Type
- orchestration-owned
Change Risk
- high
Reason:
- user communications
- template and timing side effects
- some routes aggregate data before sending
First-Look Checklist
Before changing notifications/email:
- Inspect whether the route is a thin send route or an aggregation route
- Inspect Notify helper usage
- Inspect document/event/list side data dependencies
- Confirm EN/CY template assumptions
15. Admin / Reporting
Purpose
Provides internal/admin reporting and grouped status/document views.
Primary UI Entry Points
- admin pages/components
- internal reporting views
Service Layer
actions/services/adminDirectService.js
API Routes
pages/api/admin/getnewappeals_api.jspages/api/admin/getlatestdocuments_api.jspages/api/admin/getStatusCountsByAppealAndLPA_api.js- adjacent status/reporting routes in
admin
Integrations
- CRM Relay
Ownership Type
- support-owned
Change Risk
- medium
Reason:
- smaller, more coherent area
- still CRM-transform heavy and potentially used operationally
First-Look Checklist
Before changing admin/reporting:
- Inspect the relevant admin route family
- Inspect
adminDirectService - Confirm reporting/grouping transform assumptions
- Check whether public or portal-facing contracts are indirectly reused
Shared Platform Section
Shared API Building Blocks
relayGet(...)
- Responsibility: standardized CRM relay GET forwarding
- Commonly used in:
pages/api/endpoint/**, especially read families - Preferred for future work? yes, for new CRM read routes where the shared relay-read model fits
relayGetData(...)
- Responsibility: supplementary relay-backed data fetches inside transforms/orchestration
- Commonly used in: advanced search enrichment, lookup hybrids, upsert pre-checks
- Preferred for future work? yes, where a route needs sub-queries without directly writing to
res
respondSuccess(...)
- Responsibility: shared success JSON response envelope
- Commonly used in: endpoint, file, email, admin, and middleware-aware routes
- Preferred for future work? yes
respondError(...)
- Responsibility: shared error JSON response envelope
- Commonly used in: endpoint, file, email, admin, and middleware-aware routes
- Preferred for future work? yes
Relay policy helpers / presets
- Responsibility: shared timeout/retry profiles for relay reads
- Commonly used in: modern helper-oriented relay routes
- Preferred for future work? yes, where an existing policy profile is appropriate
Hash helpers
- Responsibility: path signing and request-integrity validation
- Commonly used in: relay-bound routes and storage/blob routes
- Preferred for future work? yes, where the existing signed-route model must be preserved
Signed request helpers
- Responsibility: shared signed GET/POST/DELETE request execution
- Commonly used in: service/client layer helpers for signed route access
- Preferred for future work? yes, where signed request composition already exists
Azure storage helpers
- Responsibility: blob/container/queue operations and related metadata handling
- Commonly used in:
pages/api/file/**, draft/finalisation helpers, storage-backed journeys - Preferred for future work? yes for storage-facing behavior
Notify helpers
- Responsibility: GOV.UK Notify send behavior and related helper flows
- Commonly used in:
pages/api/email/**, auth email flow, service layer - Preferred for future work? yes, but keep send routes thin unless orchestration is required
Auth/session helpers
- Responsibility: session establishment, locale resolution, auth-related supporting context
- Commonly used in:
pages/api/auth/**, SSR loaders, auth support flows - Preferred for future work? yes within the established NextAuth/session boundary
Maintainer Guidance
When Adding a New API
Recommended decision sequence:
1. Which journey owns this?
2. Which integration does it touch?
3. Does an existing route family already exist?
4. Can existing helpers be reused?
5. Is the route contract-critical?
Guidance notes:
- start from journey ownership before folder ownership
- prefer existing families and helpers where they already fit
- do not copy older direct-wrapper patterns by default when newer shared patterns exist
- do not refactor stable legacy routes without explicit approval and characterization
Risks / Cautions
- This is a first-generation maintainer guide, not a full inventory.
- It is intentionally journey-first and route-family-first, not exhaustive route-by-route documentation.
- Folder names still do not reliably indicate current ownership.
- High-risk changes still need direct file inspection before editing, especially in
endpoint,file,auth, and finalisation flows.
Validation performed
Manual consolidation only.
Performed:
- re-read required assessment and architecture context
- reused the stable findings from the completed API platform assessment
- converted folder-oriented conclusions into a journey-owned maintainer route map
Not performed:
- no new runtime analysis
- no scripts
- no automated inventory generation
- no code changes
Recommendation
This route map is sufficient as a first-generation maintainer guide.
An additional documentation slice is justified only if the team wants one of the following future planning outputs:
- a more detailed API Route Map / Maintainer Guide v2 with deeper per-journey edge cases
- an API Rationalisation Planning document focused on future consolidation candidates
No implementation work is recommended from this guide alone.