openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: SafeStop AI API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: checkins description: Transit stop check-in operations - name: reports description: Safety report operations - name: stats description: Safety statistics paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /checkins: get: operationId: listCheckins tags: [checkins] summary: List active check-ins description: Returns all currently active check-ins responses: "200": description: List of active check-ins content: application/json: schema: type: array items: $ref: "#/components/schemas/Checkin" post: operationId: createCheckin tags: [checkins] summary: Check in to a transit stop description: Check in to a transit stop location requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CheckinInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/CheckinResult" /checkins/{id}: delete: operationId: deleteCheckin tags: [checkins] summary: Check out from a transit stop parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Checked out successfully "404": description: Check-in not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /checkins/nearby: get: operationId: getNearbyCheckins tags: [checkins] summary: Get active check-ins near a location parameters: - name: lat in: query required: true schema: type: number - name: lng in: query required: true schema: type: number - name: radiusMeters in: query required: false schema: type: number responses: "200": description: Nearby active check-ins content: application/json: schema: $ref: "#/components/schemas/NearbyCheckinsResult" /reports: get: operationId: listReports tags: [reports] summary: List all safety reports description: Returns all safety reports for the map responses: "200": description: List of safety reports content: application/json: schema: type: array items: $ref: "#/components/schemas/SafetyReport" post: operationId: createReport tags: [reports] summary: Submit an anonymous safety report requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ReportInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/SafetyReport" /reports/recent: get: operationId: getRecentReports tags: [reports] summary: Get recent safety reports feed responses: "200": description: Recent safety reports content: application/json: schema: type: array items: $ref: "#/components/schemas/SafetyReport" /markers: get: operationId: getMapMarkers tags: [reports] summary: Get aggregated map markers for the safety heatmap description: Returns deduplicated location markers with aggregated safety scores responses: "200": description: Map markers with aggregated data content: application/json: schema: type: array items: $ref: "#/components/schemas/MapMarker" /stats: get: operationId: getStats tags: [stats] summary: Get overall safety statistics responses: "200": description: Overall safety stats content: application/json: schema: $ref: "#/components/schemas/SafetyStats" components: schemas: HealthStatus: type: object properties: status: type: string required: - status Checkin: type: object required: [id, latitude, longitude, locationName, status, createdAt] properties: id: type: integer latitude: type: number longitude: type: number locationName: type: string status: type: string createdAt: type: string CheckinInput: type: object required: [latitude, longitude, locationName] properties: latitude: type: number longitude: type: number locationName: type: string CheckinResult: type: object required: [checkin, coPresenceAlert, coPresenceCount] properties: checkin: $ref: "#/components/schemas/Checkin" coPresenceAlert: type: boolean coPresenceCount: type: integer NearbyCheckinsResult: type: object required: [checkins, coPresenceAlert, count] properties: checkins: type: array items: $ref: "#/components/schemas/Checkin" coPresenceAlert: type: boolean count: type: integer SafetyReport: type: object required: [id, latitude, longitude, locationName, safetyRating, lightingRating, crowdDensity, createdAt] properties: id: type: integer latitude: type: number longitude: type: number locationName: type: string safetyRating: type: integer lightingRating: type: integer crowdDensity: type: string reviewText: type: ["string", "null"] createdAt: type: string ReportInput: type: object required: [latitude, longitude, locationName, safetyRating, lightingRating, crowdDensity] properties: latitude: type: number longitude: type: number locationName: type: string safetyRating: type: integer lightingRating: type: integer crowdDensity: type: string reviewText: type: string MapMarker: type: object required: [latitude, longitude, locationName, avgSafetyRating, safetyCategory, reportCount, reports] properties: latitude: type: number longitude: type: number locationName: type: string avgSafetyRating: type: number safetyCategory: type: string reportCount: type: integer reports: type: array items: $ref: "#/components/schemas/SafetyReport" SafetyStats: type: object required: [totalActiveCheckins, totalReports, safeLocations, moderateLocations, unsafeLocations, recentActivity] properties: totalActiveCheckins: type: integer totalReports: type: integer safeLocations: type: integer moderateLocations: type: integer unsafeLocations: type: integer recentActivity: type: integer ErrorResponse: type: object required: [error] properties: error: type: string