{"openapi":"3.0.0","info":{"title":"AI Voice Kiosk Visitor Management System API","description":"API specification for AI Voice Kiosk Visitor Management System with OAuth2 Application Flow security.","version":"1.0.0"},"servers":[{"url":"https://societybackend.cubeone.in/api"}],"security":[{"application":["read","write"]}],"paths":{"/login":{"post":{"summary":"Admin login to obtain JWT token","operationId":"adminLogin","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Successful login returns JWT token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitError"}}}}}}},"/visitor/entry":{"post":{"summary":"Visitor entry API to register visitor name and mobile number","operationId":"visitorEntry","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitorEntryRequest"}}}},"responses":{"200":{"description":"Visitor entry response with visitor_id and registration status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitorEntryResponse"}}}},"400":{"description":"Validation error for input fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitError"}}}}}}},"/visitor/uploadFile":{"post":{"summary":"Upload visitor photo file (multipart/form-data)","operationId":"uploadVisitorPhoto","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]}}}},"responses":{"200":{"description":"Photo upload success with file path","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhotoUploadResponse"}}}},"400":{"description":"Invalid file or missing file","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/visitor/log":{"post":{"summary":"Create visitor log entry","operationId":"createVisitorLog","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitorLogRequest"}}}},"responses":{"200":{"description":"Visitor log created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitorLogResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/visitor/sendFcmNotification":{"post":{"summary":"Send FCM notification asynchronously","operationId":"sendFcmNotification","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FcmNotificationRequest"}}}},"responses":{"200":{"description":"Notification sent successfully (non-blocking)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FcmNotificationResponse"}}}}}}},"/admin/logs":{"get":{"summary":"Get visitor logs filtered by date with pagination (admin only)","operationId":"getVisitorLogs","security":[{"bearerAuth":[]}],"parameters":[{"name":"date","in":"query","description":"Date filter in YYYY-MM-DD format (defaults to today)","required":false,"schema":{"type":"string","format":"date"}},{"name":"page","in":"query","description":"Page number (default 1)","required":false,"schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","description":"Number of records per page (default 50, max 100)","required":false,"schema":{"type":"integer","default":50,"minimum":1,"maximum":100}}],"responses":{"200":{"description":"Visitor logs list with pagination","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminLogsResponse"}}}},"401":{"description":"Unauthorized - invalid or missing JWT token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitError"}}}}}}}},"components":{"securitySchemes":{"application":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"http://example.com/oauth/token","scopes":{"write":"allows modifying resources","read":"allows reading resources"}}}},"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"LoginRequest":{"type":"object","required":["username","password"],"properties":{"username":{"type":"string","maxLength":100},"password":{"type":"string","maxLength":100}}},"LoginResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"token":{"type":"string","description":"JWT token for admin authentication"}}},"VisitorEntryRequest":{"type":"object","required":["mobile_number","name"],"properties":{"mobile_number":{"type":"string","pattern":"^[6-9]\\d{9}$","description":"Indian 10-digit mobile number starting with 6-9"},"name":{"type":"string","minLength":2,"maxLength":100,"description":"Visitor name, minimum 2 characters"}}},"VisitorEntryResponse":{"type":"object","properties":{"status_code":{"type":"integer","example":200},"data":{"type":"object","properties":{"visitor_id":{"type":"integer","example":1234},"already_registered":{"type":"boolean","example":false},"file_path":{"type":"string","nullable":true,"example":null}}}}},"PhotoUploadResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"file_path":{"type":"string","example":"/uploads/image.jpg"}}}}},"VisitorLogRequest":{"type":"object","required":["visitor_id","mobile_number","name","visitor_image","member_details"],"properties":{"visitor_id":{"type":"integer"},"mobile_number":{"type":"string","pattern":"^[6-9]\\d{9}$"},"name":{"type":"string","minLength":2,"maxLength":100},"visitor_image":{"type":"string","description":"File path returned from photo upload API"},"member_details":{"type":"array","minItems":1,"items":{"type":"object","required":["member_ids"],"properties":{"member_ids":{"type":"integer"}}}}}},"VisitorLogResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"visitor_log_id":{"type":"integer","example":98765},"already_logged":{"type":"boolean","example":false}}}}},"FcmNotificationRequest":{"type":"object","required":["name","mobile_number","visitor_id","visitor_log_id"],"properties":{"name":{"type":"string","minLength":2,"maxLength":100},"mobile_number":{"type":"string","pattern":"^[6-9]\\d{9}$"},"visitor_id":{"type":"integer"},"visitor_log_id":{"type":"integer"}}},"FcmNotificationResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Member has been notified"}}},"AdminLogsResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","properties":{"visitor_log_id":{"type":"integer","example":98765},"visitor_id":{"type":"integer","example":1234},"name":{"type":"string","example":"John Doe"},"mobile_number":{"type":"string","example":"987654****"},"visitor_image":{"type":"string","format":"uri","example":"https://kiosk-visitor-photos.s3.ap-south-1.amazonaws.com/visitors/uuid.jpg"},"member_ids":{"type":"array","items":{"type":"integer"},"example":[406]},"date":{"type":"string","format":"date","example":"2026-04-14"},"created_at":{"type":"string","format":"date-time","example":"2026-04-14T10:30:00Z"}}}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"limit":{"type":"integer","example":50},"total":{"type":"integer","example":120},"total_pages":{"type":"integer","example":3}}}}},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Validation error message"}}},"RateLimitError":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"RATE_LIMIT_EXCEEDED"}}}}}}