An official website of the United States GovernmentUnclassified
Seal of the Department of the NavyDepartment of the NavyProject ROUNDTABLE Docs
API reference

API reference

Route-by-route reference for all 30 Next.js API handlers

The API is the server boundary of ROUNDTABLE. A browser page and an external internal tool should receive the same authentication, validation, database, and audit behavior because both call the same route handler. Every response is JSON unless the endpoint is a file export or file download.

Conventions

ConventionMeaning
{ data: ... }Successful JSON response.
{ error: "..." }Generic client-safe error.
401No acceptable session.
403Session exists but role or scope is insufficient.
404Record or file not found.
409Duplicate or conflicting state.
400Zod or request validation failed.
500Unexpected server/storage failure; details remain in server logs.

JSON examples use seeded names such as Pelagic Dynamics and NAVSEA. IDs are placeholders because Prisma generates cuid identifiers per database.

Complete route inventory

AreaRoute handlers
Analyticspageview collection
Auth/api/auth/[...nextauth]
Account/api/account/password
Portalannouncements, calls, profile, register, submissions, submission file
Governmentadmin commands (list/create), command item, parent reassignment, admin users, announcements, calls, engagements, engagement notes, organization dialogue/status
Notificationslist, read, reroute, settings, unread count
Searchglobal search
Exportall JSON, entity CSV, engagements iCalendar

The area pages below document all 30 route.ts files, including methods, authentication, validated fields, examples, response shapes, and failure cases.

One-row-per-handler coverage

#Handler pathDocumented area
1/api/auth/[...nextauth]Auth
2/api/account/passwordAccount
3/api/analytics/pageviewAnalytics
4/api/export/allExport
5/api/export/csvExport
6/api/export/engagements.icsExport
7/api/gov/admin/commandsGovernment
8/api/gov/admin/commands/[id]Government
9/api/gov/admin/commands/[id]/parentGovernment
10/api/gov/admin/usersGovernment
11/api/gov/announcementsGovernment
12/api/gov/callsGovernment
13/api/gov/calls/[id]Government
14/api/gov/engagementsGovernment
15/api/gov/engagements/[id]Government
16/api/gov/engagements/[id]/notesGovernment
17/api/gov/organizations/[id]/dialogueGovernment
18/api/gov/organizations/[id]/statusGovernment
19/api/notificationsNotifications
20/api/notifications/readNotifications
21/api/notifications/rerouteNotifications
22/api/notifications/settingsNotifications
23/api/notifications/unread-countNotifications
24/api/portal/announcementsPortal
25/api/portal/callsPortal
26/api/portal/profilePortal
27/api/portal/registerPortal
28/api/portal/submissionsPortal
29/api/portal/submissions/[id]/filePortal
30/api/searchSearch

The number above counts route files, not HTTP methods. For example, the command item handler has GET, PATCH, and DELETE but remains one route.ts handler path in the repository inventory.

Calling from another service

An internal caller should preserve the same cookies or approved session mechanism used by the browser, send the route's documented content type, and treat status codes as the primary contract. Do not send a client-controlled role or organization ID as proof of authority. Use server-side credentials and a reviewed integration boundary if a future service-to-service caller is added.

Status-code interpretation

StatusFirst question
200Did the response shape match the requested method and did the user have the intended scope?
201Was the record created, and did any asynchronous or best-effort side effect also run?
400Which field, query, multipart part, enum, date, or file signature failed validation?
401Is there a session cookie, and is it addressed to the current origin?
403Is the account the wrong audience, role, command scope, or export tier?
404Is the ID valid and does the current scope permit the route to reveal its existence?
409Is there a uniqueness, hierarchy-cycle, or serialization conflict?
500Check server logs and backing services; do not expose internal exception text to clients.

The endpoint pages pair these codes with route-specific examples. This table is a debugging orientation, not permission to assume that every handler returns every code.

When documenting a new handler, add its route-file path to the inventory and add at least one request/response example to the relevant area page. Keep method overloads together when one route.ts implements several methods.

For source-code drift checks, compare this inventory with find src/app/api -name route.ts after adding or removing handlers.

The current inventory has 30 route files, 15 Prisma models, and 9 Prisma enums. Re-derive rather than trusting these numbers when they matter: find src/app/api -name route.ts | wc -l, grep -c '^model ' prisma/schema.prisma, and grep -c '^enum ' prisma/schema.prisma in the application repository.

Review this page whenever a route is added, removed, or split so the beginner-facing map remains complete.