Project ROUNDTABLE Docs
API reference

API reference

Route-by-route reference for all 29 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
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 29 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/export/allExport
4/api/export/csvExport
5/api/export/engagements.icsExport
6/api/gov/admin/commands/[id]/parentGovernment
7/api/gov/admin/commands/[id]Government
8/api/gov/admin/commandsGovernment
9/api/gov/admin/usersGovernment
10/api/gov/announcementsGovernment
11/api/gov/calls/[id]Government
12/api/gov/callsGovernment
13/api/gov/engagements/[id]/notesGovernment
14/api/gov/engagements/[id]Government
15/api/gov/engagementsGovernment
16/api/gov/organizations/[id]/dialogueGovernment
17/api/gov/organizations/[id]/statusGovernment
18/api/notifications/readNotifications
19/api/notifications/rerouteNotifications
20/api/notificationsNotifications
21/api/notifications/settingsNotifications
22/api/notifications/unread-countNotifications
23/api/portal/announcementsPortal
24/api/portal/callsPortal
25/api/portal/profilePortal
26/api/portal/registerPortal
27/api/portal/submissions/[id]/filePortal
28/api/portal/submissionsPortal
29/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 29 route files, 15 Prisma models, and 9 Prisma enums.

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