{"info":{"_postman_id":"803cc603-b0fe-4e91-a102-4b09680c11a9","name":"HabitatLedger API","description":"<html><head></head><body><p><strong>HabitatLedger API</strong> is a REST API for tracking tenant housing issues — including construction defects, maintenance negligence, and structural hazards.</p>\n<p><strong>Base URL:</strong> <code>https://habitatledger-api.onrender.com/api</code></p>\n<p><strong>Endpoints overview:</strong></p>\n<ul>\n<li><code>GET /issues</code> — List all issues (filterable by status, category, keyword)</li>\n<li><code>GET /issues/stats</code> — Aggregate stats for dashboard (by status, category, severity)</li>\n<li><code>GET /issues/:id</code> — Full details of a single issue including timeline and media</li>\n<li><code>POST /issues</code> — Create a new issue</li>\n<li><code>PATCH /issues/:id/status</code> — Update issue lifecycle status</li>\n<li><code>PATCH /issues/:id/close</code> — Close an issue with resolution proof</li>\n<li><code>POST /upload</code> — Upload evidence files (images, videos, PDFs)</li>\n</ul>\n<p><strong>Data formats:</strong> JSON for all issue endpoints. <code>multipart/form-data</code> for file uploads.</p>\n<p><strong>Status values:</strong> <code>open</code> → <code>in_progress</code> → <code>closed</code></p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"50839360","collectionId":"803cc603-b0fe-4e91-a102-4b09680c11a9","publishedId":"2sBXqKofTh","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2026-05-02T18:27:22.000Z"},"item":[{"name":"Issues","item":[{"name":"Get All Issues","id":"b9bcaaa3-ed10-4de9-908f-bf3aabfacfaa","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://habitatledger-api.onrender.com/api/issues","description":"<p>Retrieves a list of all housing issues logged in the system. Supports filtering and search to narrow down results by status, category, or keyword.</p>\n<p><strong>Query Parameters (optional):</strong></p>\n<ul>\n<li><code>status</code> – Filter by issue status (<code>open</code>, <code>in_progress</code>, <code>closed</code>)</li>\n<li><code>category</code> – Filter by issue category (e.g., <code>water</code>, <code>electrical</code>, <code>structural</code>)</li>\n<li><code>search</code> – Keyword search across issue title and description</li>\n</ul>\n<p><strong>Response:</strong> Returns an array of issue objects, each containing id, title, description, category, severity, status, timestamps, and associated media.</p>\n","urlObject":{"path":["api","issues"],"host":["https://habitatledger-api.onrender.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"b9bcaaa3-ed10-4de9-908f-bf3aabfacfaa"},{"name":"Get Issue Stats","id":"0731a298-d2c2-45fd-9304-a26e3d2700ae","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://habitatledger-api.onrender.com/api/issues/stats","description":"<p>Returns aggregate statistics and insights about all logged housing issues. Useful for populating dashboard charts and summary cards.</p>\n<p><strong>Response includes:</strong></p>\n<ul>\n<li>Total issue count</li>\n<li>Breakdown by status (<code>open</code>, <code>in_progress</code>, <code>closed</code>)</li>\n<li>Breakdown by category</li>\n<li>Breakdown by severity level</li>\n</ul>\n","urlObject":{"path":["api","issues","stats"],"host":["https://habitatledger-api.onrender.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"0731a298-d2c2-45fd-9304-a26e3d2700ae"},{"name":"Get Single Issue","id":"76bbf8b1-5382-4b0d-85d5-e9a04cf427e0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://habitatledger-api.onrender.com/api/issues/:id","description":"<p>Retrieves the full details of a single housing issue by its unique ID, including its complete event timeline and all attached media files.</p>\n<p><strong>Path Parameters:</strong></p>\n<ul>\n<li><code>id</code> – The unique MongoDB ObjectId of the issue</li>\n</ul>\n<p><strong>Response:</strong> Returns the full issue object including title, description, category, severity, status, timeline history, media attachments, and closure notes (if closed).</p>\n","urlObject":{"path":["api","issues",":id"],"host":["https://habitatledger-api.onrender.com"],"query":[],"variable":[{"id":"97a706e9-3101-4349-b60c-710208bcb70b","type":"any","value":"replace_with_id","key":"id"}]}},"response":[],"_postman_id":"76bbf8b1-5382-4b0d-85d5-e9a04cf427e0"},{"name":"Create Issue","id":"d3a27363-037c-4737-a466-295363bf7223","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"title\": \"Leaking Pipe\",\n  \"description\": \"Water dripping from the kitchen sink.\",\n  \"category\": \"water\",\n  \"severity\": \"Medium\"\n}"},"url":"https://habitatledger-api.onrender.com/api/issues","description":"<p>Creates a new housing issue entry in the ledger. Use this endpoint to log a new complaint or defect with all relevant details.</p>\n<p><strong>Request Body (JSON):</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"title\": \"Leaking pipe under kitchen sink\",\n  \"description\": \"Water has been dripping consistently for 3 days causing cabinet damage.\",\n  \"category\": \"plumbing\",\n  \"severity\": \"high\",\n  \"location\": \"Kitchen\"\n}\n</code></pre>\n<p><strong>Fields:</strong></p>\n<ul>\n<li><code>title</code> <em>(required)</em> – Short summary of the issue</li>\n<li><code>description</code> <em>(required)</em> – Detailed description of the problem</li>\n<li><code>category</code> <em>(required)</em> – Issue category (e.g., <code>plumbing</code>, <code>electrical</code>, <code>structural</code>, <code>pest</code>, <code>hvac</code>)</li>\n<li><code>severity</code> <em>(required)</em> – Severity level (<code>low</code>, <code>medium</code>, <code>high</code>, <code>critical</code>)</li>\n<li><code>location</code> <em>(optional)</em> – Area of the unit affected</li>\n</ul>\n<p><strong>Response:</strong> Returns the newly created issue object with its assigned <code>_id</code> and initial status of <code>open</code>.</p>\n","urlObject":{"path":["api","issues"],"host":["https://habitatledger-api.onrender.com"],"query":[],"variable":[]}},"response":[],"_postman_id":"d3a27363-037c-4737-a466-295363bf7223"},{"name":"Update Issue Status","id":"0cf1a6ef-8eda-4a4b-89e7-8c35ad364f50","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"status\": \"In Progress\"\n}"},"url":"https://habitatledger-api.onrender.com/api/issues/:id/status","description":"<p>Updates the status of an existing issue to reflect its current lifecycle stage. Each status change is recorded as a timestamped event in the issue's timeline.</p>\n<p><strong>Path Parameters:</strong></p>\n<ul>\n<li><code>id</code> – The unique MongoDB ObjectId of the issue</li>\n</ul>\n<p><strong>Request Body (JSON):</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"status\": \"in_progress\"\n}\n</code></pre>\n<p><strong>Valid status values:</strong></p>\n<ul>\n<li><code>open</code> – Issue has been reported but not yet acted upon</li>\n<li><code>in_progress</code> – Issue is actively being addressed</li>\n<li><code>closed</code> – Issue has been resolved (use the Close Issue endpoint for proper closure with proof)</li>\n</ul>\n<p><strong>Response:</strong> Returns the updated issue object with the new status and an appended timeline entry.</p>\n","urlObject":{"path":["api","issues",":id","status"],"host":["https://habitatledger-api.onrender.com"],"query":[],"variable":[{"id":"a2dd7593-43f3-490a-a668-b11543600408","type":"any","value":"replace_with_id","key":"id"}]}},"response":[],"_postman_id":"0cf1a6ef-8eda-4a4b-89e7-8c35ad364f50"},{"name":"Close Issue","id":"3573ec38-432b-4b95-9c5d-c609f3df7940","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"resolutionNote\": \"Fixed the pipe with sealant.\"\n}"},"url":"https://habitatledger-api.onrender.com/api/issues/:id/close","description":"<p>Marks an issue as officially closed. Requires the submitter to provide closing notes and proof of resolution (uploaded file URLs) before the issue can be closed. This enforces accountability and creates an auditable record.</p>\n<p><strong>Path Parameters:</strong></p>\n<ul>\n<li><code>id</code> – The unique MongoDB ObjectId of the issue</li>\n</ul>\n<p><strong>Request Body (JSON):</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"closingNotes\": \"Landlord replaced the pipe on May 1st. Issue fully resolved.\",\n  \"resolutionProof\": [\"uploads/proof-image-1.jpg\"]\n}\n</code></pre>\n<p><strong>Fields:</strong></p>\n<ul>\n<li><code>closingNotes</code> <em>(required)</em> – Description of how the issue was resolved</li>\n<li><code>resolutionProof</code> <em>(required)</em> – Array of file paths/URLs serving as proof of resolution</li>\n</ul>\n<p><strong>Response:</strong> Returns the updated issue with status set to <code>closed</code>, closing notes, resolution proof, and a final timeline entry.</p>\n","urlObject":{"path":["api","issues",":id","close"],"host":["https://habitatledger-api.onrender.com"],"query":[],"variable":[{"id":"337180cb-cd76-45a9-8c1a-15bfc03b3ff0","type":"any","value":"replace_with_id","key":"id"}]}},"response":[],"_postman_id":"3573ec38-432b-4b95-9c5d-c609f3df7940"}],"id":"2274b86b-1ec3-47da-92cc-48e7efd32147","_postman_id":"2274b86b-1ec3-47da-92cc-48e7efd32147","description":""},{"name":"Upload","item":[{"name":"Upload Files","id":"6916b46d-a565-408e-8cff-1cf439edb84c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"files","type":"file","value":""}]},"url":"https://habitatledger-api.onrender.com/api/upload?category=water","description":"<p>Uploads one or more media files (images, videos, or documents) to the server to be attached as evidence to a housing issue. Files are stored locally in the <code>server/uploads/</code> directory, organized by category.</p>\n<p><strong>Query Parameters:</strong></p>\n<ul>\n<li><code>category</code> – The issue category used to organize uploaded files (e.g., <code>water</code>, <code>electrical</code>, <code>structural</code>)</li>\n</ul>\n<p><strong>Request Body:</strong> <code>multipart/form-data</code></p>\n<ul>\n<li><code>files</code> – One or more files to upload (supported types: images, videos, PDFs, documents)</li>\n</ul>\n<p><strong>Response:</strong> Returns an array of uploaded file metadata including stored file paths, which can then be referenced when creating or closing an issue.</p>\n<blockquote>\n<p><strong>Note:</strong> This endpoint uses Multer middleware for file handling. Ensure the request is sent with <code>Content-Type: multipart/form-data</code>.</p>\n</blockquote>\n","urlObject":{"path":["api","upload"],"host":["https://habitatledger-api.onrender.com"],"query":[{"key":"category","value":"water"}],"variable":[]}},"response":[],"_postman_id":"6916b46d-a565-408e-8cff-1cf439edb84c"}],"id":"a070dfb9-dd1d-469f-adc5-9b0783d852b4","_postman_id":"a070dfb9-dd1d-469f-adc5-9b0783d852b4","description":""}],"variable":[{"key":"base_url","value":"https://habitatledger-api.onrender.com"}]}