openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.2.0 description: The Bureau — RSR Media API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: posts description: Newsroom posts - name: investigations description: Investigation case files - name: records description: Records desk - name: submissions description: Reader desk submissions - name: publications description: External publications - name: settings description: Site settings - name: admin description: Admin authentication - name: summary description: Dashboard summary - name: field-operation description: Field operation status and dispatches - name: media description: Media file uploads paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" # --- Admin Auth --- /admin/login: post: operationId: adminLogin tags: [admin] summary: Admin login with secret requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AdminLoginInput" responses: "200": description: Login successful content: application/json: schema: $ref: "#/components/schemas/AdminSession" "401": description: Invalid credentials /admin/logout: post: operationId: adminLogout tags: [admin] summary: Admin logout responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/OkResponse" /admin/me: get: operationId: adminMe tags: [admin] summary: Check admin session responses: "200": description: Session info content: application/json: schema: $ref: "#/components/schemas/AdminSession" "401": description: Not authenticated # --- Summary (wow endpoint) --- /summary: get: operationId: getSummary tags: [summary] summary: Bureau dashboard summary responses: "200": description: Summary counts and latest items content: application/json: schema: $ref: "#/components/schemas/BureauSummary" # --- Posts --- /posts: get: operationId: listPosts tags: [posts] summary: List posts parameters: - in: query name: type schema: type: string enum: [report, announcement, correction, field_note] - in: query name: state schema: type: string enum: [draft, published, archived] - in: query name: published schema: type: string enum: ["true", "false"] - in: query name: featured schema: type: string enum: ["true", "false"] - in: query name: caseNumber schema: type: string - in: query name: limit schema: type: number - in: query name: offset schema: type: number responses: "200": description: List of posts content: application/json: schema: type: array items: $ref: "#/components/schemas/Post" post: operationId: createPost tags: [posts] summary: Create a post (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PostInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Post" /posts/{id}: get: operationId: getPost tags: [posts] summary: Get a post parameters: - in: path name: id required: true schema: type: number responses: "200": description: Post content: application/json: schema: $ref: "#/components/schemas/Post" "404": description: Not found patch: operationId: updatePost tags: [posts] summary: Update a post (admin) parameters: - in: path name: id required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PostUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Post" delete: operationId: deletePost tags: [posts] summary: Delete a post (admin) parameters: - in: path name: id required: true schema: type: number responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" # --- Investigations --- /investigations: get: operationId: listInvestigations tags: [investigations] summary: List investigations parameters: - in: query name: status schema: type: string enum: [active, closed, suspended, pending] - in: query name: division schema: type: string - in: query name: published schema: type: string enum: ["true", "false"] - in: query name: featured schema: type: string enum: ["true", "false"] - in: query name: limit schema: type: number - in: query name: offset schema: type: number responses: "200": description: List of investigations content: application/json: schema: type: array items: $ref: "#/components/schemas/Investigation" post: operationId: createInvestigation tags: [investigations] summary: Create an investigation (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/InvestigationInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Investigation" /investigations/{id}: get: operationId: getInvestigation tags: [investigations] summary: Get an investigation with timeline parameters: - in: path name: id required: true schema: type: number responses: "200": description: Investigation detail content: application/json: schema: $ref: "#/components/schemas/InvestigationDetail" "404": description: Not found patch: operationId: updateInvestigation tags: [investigations] summary: Update an investigation (admin) parameters: - in: path name: id required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/InvestigationUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Investigation" delete: operationId: deleteInvestigation tags: [investigations] summary: Delete an investigation (admin) parameters: - in: path name: id required: true schema: type: number responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" /investigations/{id}/timeline: get: operationId: listTimelineEntries tags: [investigations] summary: List timeline entries for an investigation parameters: - in: path name: id required: true schema: type: number responses: "200": description: Timeline entries content: application/json: schema: type: array items: $ref: "#/components/schemas/TimelineEntry" post: operationId: createTimelineEntry tags: [investigations] summary: Add a timeline entry (admin) parameters: - in: path name: id required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TimelineEntryInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/TimelineEntry" /investigations/{id}/timeline/{entryId}: patch: operationId: updateTimelineEntry tags: [investigations] summary: Update a timeline entry (admin) parameters: - in: path name: id required: true schema: type: number - in: path name: entryId required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TimelineEntryUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/TimelineEntry" delete: operationId: deleteTimelineEntry tags: [investigations] summary: Delete a timeline entry (admin) parameters: - in: path name: id required: true schema: type: number - in: path name: entryId required: true schema: type: number responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" # --- Records --- /records: get: operationId: listRecords tags: [records] summary: List records parameters: - in: query name: status schema: type: string enum: [received, pending, released, denied, partial] - in: query name: caseNumber schema: type: string - in: query name: published schema: type: string enum: ["true", "false"] - in: query name: limit schema: type: number - in: query name: offset schema: type: number responses: "200": description: List of records content: application/json: schema: type: array items: $ref: "#/components/schemas/FileRecord" post: operationId: createRecord tags: [records] summary: Create a record entry (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RecordInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/FileRecord" /records/{id}: get: operationId: getRecord tags: [records] summary: Get a record parameters: - in: path name: id required: true schema: type: number responses: "200": description: Record content: application/json: schema: $ref: "#/components/schemas/FileRecord" "404": description: Not found patch: operationId: updateRecord tags: [records] summary: Update a record (admin) parameters: - in: path name: id required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RecordUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/FileRecord" delete: operationId: deleteRecord tags: [records] summary: Delete a record (admin) parameters: - in: path name: id required: true schema: type: number responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" # --- Reader Submissions --- /submissions: get: operationId: listSubmissions tags: [submissions] summary: List reader submissions (admin) parameters: - in: query name: type schema: type: string enum: [tip, correction, inquiry] - in: query name: reviewStatus schema: type: string enum: [new, reviewing, actioned, archived] - in: query name: reviewed schema: type: string enum: ["true", "false"] - in: query name: limit schema: type: number - in: query name: offset schema: type: number responses: "200": description: List of submissions content: application/json: schema: type: array items: $ref: "#/components/schemas/Submission" post: operationId: createSubmission tags: [submissions] summary: Submit a reader tip or correction (public) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SubmissionInput" responses: "201": description: Submitted content: application/json: schema: $ref: "#/components/schemas/Submission" /submissions/{id}: get: operationId: getSubmission tags: [submissions] summary: Get a submission (admin) parameters: - in: path name: id required: true schema: type: number responses: "200": description: Submission content: application/json: schema: $ref: "#/components/schemas/Submission" patch: operationId: updateSubmission tags: [submissions] summary: Update submission status or add admin note (admin) parameters: - in: path name: id required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SubmissionUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Submission" delete: operationId: deleteSubmission tags: [submissions] summary: Delete a submission (admin) parameters: - in: path name: id required: true schema: type: number responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" /submissions/export: get: operationId: exportSubmissions tags: [submissions] summary: Export all submissions as JSON (admin) responses: "200": description: All submissions content: application/json: schema: type: array items: $ref: "#/components/schemas/Submission" # --- Publications --- /publications: get: operationId: listPublications tags: [publications] summary: List external publications responses: "200": description: List of publications content: application/json: schema: type: array items: $ref: "#/components/schemas/Publication" post: operationId: createPublication tags: [publications] summary: Create a publication entry (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PublicationInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Publication" /publications/{id}: patch: operationId: updatePublication tags: [publications] summary: Update a publication (admin) parameters: - in: path name: id required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PublicationUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/Publication" delete: operationId: deletePublication tags: [publications] summary: Delete a publication (admin) parameters: - in: path name: id required: true schema: type: number responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" # --- Settings --- /settings: get: operationId: getSettings tags: [settings] summary: Get site settings responses: "200": description: Site settings content: application/json: schema: $ref: "#/components/schemas/SiteSettings" patch: operationId: updateSettings tags: [settings] summary: Update site settings (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SiteSettingsUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/SiteSettings" # --- Field Operation --- /field-operation: get: operationId: getFieldOperation tags: [field-operation] summary: Get the current active field operation (public shows limited fields) responses: "200": description: Current field operation or null content: application/json: schema: oneOf: - $ref: "#/components/schemas/FieldOperation" - type: "null" /field-operation/activate: post: operationId: activateFieldOperation tags: [field-operation] summary: Create or activate a field operation (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FieldOperationInput" responses: "200": description: Activated content: application/json: schema: $ref: "#/components/schemas/FieldOperation" /field-operation/stand-down: post: operationId: standDownFieldOperation tags: [field-operation] summary: Post Stand Down dispatch and deactivate current operation (admin) responses: "200": description: Stood down content: application/json: schema: $ref: "#/components/schemas/OkResponse" /field-operation/update: patch: operationId: updateFieldOperation tags: [field-operation] summary: Update the current field operation (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FieldOperationUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/FieldOperation" /field-operation/dispatches: get: operationId: listFieldDispatches tags: [field-operation] summary: List dispatches for the current operation responses: "200": description: Dispatches content: application/json: schema: type: array items: $ref: "#/components/schemas/FieldDispatch" post: operationId: createFieldDispatch tags: [field-operation] summary: Post a field dispatch (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FieldDispatchInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/FieldDispatch" /field-operation/dispatches/{id}: patch: operationId: updateFieldDispatch tags: [field-operation] summary: Edit a dispatch note (admin) parameters: - in: path name: id required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/FieldDispatchUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/FieldDispatch" delete: operationId: deleteFieldDispatch tags: [field-operation] summary: Delete a dispatch (admin) parameters: - in: path name: id required: true schema: type: number responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" # --- Media --- /media: get: operationId: listMedia tags: [media] summary: List media files parameters: - in: query name: isPublic schema: type: string enum: ["true", "false"] - in: query name: limit schema: type: number - in: query name: offset schema: type: number responses: "200": description: List of media files content: application/json: schema: type: array items: $ref: "#/components/schemas/MediaFile" /media/{id}: get: operationId: getMedia tags: [media] summary: Get a media file record parameters: - in: path name: id required: true schema: type: number responses: "200": description: Media file content: application/json: schema: $ref: "#/components/schemas/MediaFile" "404": description: Not found patch: operationId: updateMedia tags: [media] summary: Update media metadata (admin) parameters: - in: path name: id required: true schema: type: number requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/MediaFileUpdate" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/MediaFile" delete: operationId: deleteMedia tags: [media] summary: Delete a media file (admin) parameters: - in: path name: id required: true schema: type: number responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/OkResponse" components: schemas: HealthStatus: type: object required: [status] properties: status: type: string OkResponse: type: object required: [ok] properties: ok: type: boolean AdminLoginInput: type: object required: [secret] properties: secret: type: string AdminSession: type: object required: [authenticated] properties: authenticated: type: boolean BureauSummary: type: object required: [postCount, investigationCount, recordCount, submissionCount, latestPosts, featuredInvestigation, latestRecords, activeFieldOperation] properties: postCount: type: number investigationCount: type: number recordCount: type: number submissionCount: type: number latestPosts: type: array items: $ref: "#/components/schemas/Post" featuredInvestigation: oneOf: - $ref: "#/components/schemas/Investigation" - type: "null" latestRecords: type: array items: $ref: "#/components/schemas/FileRecord" activeFieldOperation: oneOf: - $ref: "#/components/schemas/FieldOperation" - type: "null" Post: type: object required: [id, title, type, state, published, featured, createdAt, updatedAt] properties: id: type: number title: type: string slug: type: ["string", "null"] type: type: string enum: [report, announcement, correction, field_note] deck: type: ["string", "null"] summary: type: ["string", "null"] body: type: ["string", "null"] byline: type: ["string", "null"] caseNumber: type: ["string", "null"] evidenceLabels: type: ["string", "null"] state: type: string enum: [draft, published, archived] published: type: boolean featured: type: boolean publishedAt: type: ["string", "null"] scheduledAt: type: ["string", "null"] correctionEntries: type: ["string", "null"] createdAt: type: string updatedAt: type: string PostInput: type: object required: [title, type] properties: title: type: string minLength: 1 slug: type: string type: type: string enum: [report, announcement, correction, field_note] deck: type: string summary: type: string body: type: string byline: type: string caseNumber: type: string evidenceLabels: type: string state: type: string enum: [draft, published, archived] published: type: boolean featured: type: boolean publishedAt: type: string scheduledAt: type: string correctionEntries: type: string PostUpdate: type: object properties: title: type: string minLength: 1 slug: type: string type: type: string enum: [report, announcement, correction, field_note] deck: type: string summary: type: string body: type: string byline: type: string caseNumber: type: string evidenceLabels: type: string state: type: string enum: [draft, published, archived] published: type: boolean featured: type: boolean publishedAt: type: string scheduledAt: type: string correctionEntries: type: string Investigation: type: object required: [id, caseNumber, title, division, status, published, featured, createdAt, updatedAt] properties: id: type: number caseNumber: type: string title: type: string division: type: string status: type: string enum: [active, closed, suspended, pending] phase: type: ["string", "null"] summary: type: ["string", "null"] overview: type: ["string", "null"] controlledFinding: type: ["string", "null"] openQuestions: type: ["string", "null"] evidenceNotes: type: ["string", "null"] correctionLog: type: ["string", "null"] people: type: ["string", "null"] locations: type: ["string", "null"] documents: type: ["string", "null"] labels: type: ["string", "null"] published: type: boolean featured: type: boolean lastReviewedAt: type: ["string", "null"] createdAt: type: string updatedAt: type: string InvestigationDetail: type: object required: [investigation, timeline] properties: investigation: $ref: "#/components/schemas/Investigation" timeline: type: array items: $ref: "#/components/schemas/TimelineEntry" InvestigationInput: type: object required: [caseNumber, title, division, status] properties: caseNumber: type: string minLength: 1 title: type: string minLength: 1 division: type: string status: type: string enum: [active, closed, suspended, pending] phase: type: string summary: type: string overview: type: string controlledFinding: type: string openQuestions: type: string evidenceNotes: type: string correctionLog: type: string people: type: string locations: type: string documents: type: string labels: type: string published: type: boolean featured: type: boolean lastReviewedAt: type: string InvestigationUpdate: type: object properties: caseNumber: type: string title: type: string division: type: string status: type: string enum: [active, closed, suspended, pending] phase: type: string summary: type: string overview: type: string controlledFinding: type: string openQuestions: type: string evidenceNotes: type: string correctionLog: type: string people: type: string locations: type: string documents: type: string labels: type: string published: type: boolean featured: type: boolean lastReviewedAt: type: string TimelineEntry: type: object required: [id, investigationId, entryDate, label, description, createdAt, updatedAt] properties: id: type: number investigationId: type: number entryDate: type: string label: type: string description: type: string controlledUpdate: type: ["string", "null"] createdAt: type: string updatedAt: type: string TimelineEntryInput: type: object required: [entryDate, label, description] properties: entryDate: type: string label: type: string minLength: 1 description: type: string minLength: 1 controlledUpdate: type: string TimelineEntryUpdate: type: object properties: entryDate: type: string label: type: string description: type: string controlledUpdate: type: string FileRecord: type: object required: [id, title, status, published, createdAt, updatedAt] properties: id: type: number title: type: string fileReference: type: ["string", "null"] sourceAgency: type: ["string", "null"] requestDate: type: ["string", "null"] description: type: ["string", "null"] status: type: string enum: [received, pending, released, denied, partial] downloadUrl: type: ["string", "null"] caseNumber: type: ["string", "null"] correspondenceLog: type: ["string", "null"] published: type: boolean createdAt: type: string updatedAt: type: string RecordInput: type: object required: [title, status] properties: title: type: string minLength: 1 fileReference: type: string sourceAgency: type: string requestDate: type: string description: type: string status: type: string enum: [received, pending, released, denied, partial] downloadUrl: type: string caseNumber: type: string correspondenceLog: type: string published: type: boolean RecordUpdate: type: object properties: title: type: string fileReference: type: string sourceAgency: type: string requestDate: type: string description: type: string status: type: string enum: [received, pending, released, denied, partial] downloadUrl: type: string caseNumber: type: string correspondenceLog: type: string published: type: boolean Submission: type: object required: [id, type, subject, message, reviewed, reviewStatus, createdAt, updatedAt] properties: id: type: number type: type: string enum: [tip, correction, inquiry] nameOrAlias: type: ["string", "null"] contactEmail: type: ["string", "null"] subject: type: string message: type: string sourceProvenance: type: ["string", "null"] reviewed: type: boolean reviewStatus: type: string enum: [new, reviewing, actioned, archived] adminNote: type: ["string", "null"] privateNote: type: ["string", "null"] createdAt: type: string updatedAt: type: string SubmissionInput: type: object required: [type, subject, message] properties: type: type: string enum: [tip, correction, inquiry] nameOrAlias: type: string contactEmail: type: string subject: type: string minLength: 1 message: type: string minLength: 1 sourceProvenance: type: string SubmissionUpdate: type: object properties: reviewed: type: boolean reviewStatus: type: string enum: [new, reviewing, actioned, archived] adminNote: type: string privateNote: type: string Publication: type: object required: [id, name, sortOrder, available, createdAt, updatedAt] properties: id: type: number name: type: string description: type: ["string", "null"] url: type: ["string", "null"] available: type: boolean sortOrder: type: number createdAt: type: string updatedAt: type: string PublicationInput: type: object required: [name] properties: name: type: string minLength: 1 description: type: string url: type: string available: type: boolean sortOrder: type: number PublicationUpdate: type: object properties: name: type: string description: type: string url: type: string available: type: boolean sortOrder: type: number SiteSettings: type: object required: [id, fieldStatus, updatedAt] properties: id: type: number crimeWireUrl: type: ["string", "null"] intelligenceNetworkUrl: type: ["string", "null"] fieldStatus: type: string enum: [desk_operations, field_investigation, live_coverage, records_review, developing_file, stand_down] fieldStatusMessage: type: ["string", "null"] homepageLeadPostId: type: ["number", "null"] socialLinks: type: ["string", "null"] footerText: type: ["string", "null"] updatedAt: type: string SiteSettingsUpdate: type: object properties: crimeWireUrl: type: string intelligenceNetworkUrl: type: string fieldStatus: type: string enum: [desk_operations, field_investigation, live_coverage, records_review, developing_file, stand_down] fieldStatusMessage: type: string homepageLeadPostId: type: number socialLinks: type: string footerText: type: string FieldOperation: type: object required: [id, status, isActive, createdAt, updatedAt] properties: id: type: number status: type: string enum: [desk_operations, field_investigation, live_coverage, records_review, developing_file, stand_down] caseNumber: type: ["string", "null"] generalLocation: type: ["string", "null"] publicNote: type: ["string", "null"] externalLink: type: ["string", "null"] startedAt: type: ["string", "null"] delayUntil: type: ["string", "null"] expiresAt: type: ["string", "null"] isActive: type: boolean lastUpdateAt: type: ["string", "null"] createdAt: type: string updatedAt: type: string FieldOperationInput: type: object required: [status] properties: status: type: string enum: [desk_operations, field_investigation, live_coverage, records_review, developing_file, stand_down] caseNumber: type: string generalLocation: type: string publicNote: type: string externalLink: type: string startedAt: type: string delayUntil: type: string expiresAt: type: string FieldOperationUpdate: type: object properties: status: type: string enum: [desk_operations, field_investigation, live_coverage, records_review, developing_file, stand_down] caseNumber: type: string generalLocation: type: string publicNote: type: string externalLink: type: string delayUntil: type: string expiresAt: type: string FieldDispatch: type: object required: [id, operationId, label, dispatchedAt, createdAt] properties: id: type: number operationId: type: number label: type: string enum: [Arrival, Observation, "Interview Completed", "Records Obtained", "Scene Cleared", "Investigation Continuing", "Stand Down"] note: type: ["string", "null"] dispatchedAt: type: string createdAt: type: string FieldDispatchInput: type: object required: [label] properties: label: type: string enum: [Arrival, Observation, "Interview Completed", "Records Obtained", "Scene Cleared", "Investigation Continuing", "Stand Down"] note: type: string dispatchedAt: type: string FieldDispatchUpdate: type: object properties: note: type: string MediaFile: type: object required: [id, filename, storageKey, url, isPublic, createdAt, updatedAt] properties: id: type: number filename: type: string storageKey: type: string url: type: string caption: type: ["string", "null"] mediaDate: type: ["string", "null"] provenance: type: ["string", "null"] isPublic: type: boolean mimeType: type: ["string", "null"] sizeBytes: type: ["number", "null"] altText: type: ["string", "null"] createdAt: type: string updatedAt: type: string MediaFileUpdate: type: object properties: caption: type: string mediaDate: type: string provenance: type: string isPublic: type: boolean altText: type: string