openapi: 3.0.3 info: title: KosmoConnect API description: Draft OpenAPI specification for the KosmoConnect platform. version: 0.1.0 paths: /api/v1/weather/latest: get: summary: Get latest readings from all nodes parameters: - name: node_id in: query schema: type: string required: false description: Filter by specific node ID responses: '200': description: Latest environmental readings content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/EnviroReading' /api/v1/weather/history: get: summary: Get historical readings for a node parameters: - name: node_id in: query required: true schema: type: string - name: start in: query required: true schema: type: string format: date-time - name: end in: query required: true schema: type: string format: date-time - name: interval in: query required: false schema: type: string enum: [raw, 1h, 1d] responses: '200': description: Historical environmental data content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/EnviroReading' /api/v1/messages: post: summary: Send a message to a mesh node security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/OutboundMessage' responses: '202': description: Message accepted and queued '403': description: Subscription does not allow messaging this node '429': description: Rate limit exceeded /api/v1/messages/conversations: get: summary: Get user's message conversations security: - bearerAuth: [] responses: '200': description: List of conversation summaries content: application/json: schema: type: object properties: data: type: array items: type: object properties: node_id: type: string nickname: type: string latest_text: type: string latest_at: type: string format: date-time unread_count: type: integer /api/v1/messages/conversations/{node_id}: get: summary: Get full conversation with a node security: - bearerAuth: [] parameters: - name: node_id in: path required: true schema: type: string responses: '200': description: Message history content: application/json: schema: type: object properties: data: type: array items: type: object properties: id: type: string direction: type: string sender_node_id: type: string target_node_id: type: string text: type: string status: type: string created_at: type: string format: date-time components: schemas: EnviroReading: type: object properties: node_id: type: string timestamp: type: string format: date-time temperature_c: type: number humidity_percent: type: number pressure_pa: type: number wind_speed_ms: type: number wind_direction: type: integer pm25_ugm3: type: number pm10_ugm3: type: number gas_resistance_kohm: type: number OutboundMessage: type: object properties: target_node_id: type: string text: type: string maxLength: 200 required: - target_node_id - text securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT