v1/docs/api-endpoints-summary.md
The WiFi-DensePose API provides RESTful endpoints and WebSocket connections for real-time human pose estimation using WiFi CSI (Channel State Information) data. The API is built with FastAPI and supports both synchronous REST operations and real-time streaming via WebSockets.
http://localhost:8000/api/v1http://localhost:8000/docsAuthentication is configurable via environment variables:
ENABLE_AUTHENTICATION=true, protected endpoints require JWT tokensBearer <token>?token=<token>access_tokenRate limiting is configurable and when enabled (ENABLE_RATE_LIMITING=true):
/health/healthSystem health check with component status and metrics.
Response Example:
{
"status": "healthy",
"timestamp": "2025-06-09T16:00:00Z",
"uptime_seconds": 3600.0,
"components": {
"hardware": {...},
"pose": {...},
"stream": {...}
},
"system_metrics": {
"cpu": {"percent": 24.1, "count": 2},
"memory": {"total_gb": 7.75, "available_gb": 3.73},
"disk": {"total_gb": 31.33, "free_gb": 7.09}
}
}
/health/readyReadiness check for load balancers.
/health/liveSimple liveness check.
/health/metrics 🔒Detailed system metrics (requires auth).
/api/v1/pose/currentGet current pose estimation from WiFi signals.
Query Parameters:
zone_ids: List of zone IDs to analyzeconfidence_threshold: Minimum confidence (0.0-1.0)max_persons: Maximum persons to detectinclude_keypoints: Include keypoint data (default: true)include_segmentation: Include DensePose segmentation (default: false)Response Example:
{
"timestamp": "2025-06-09T16:00:00Z",
"frame_id": "frame_123456",
"persons": [
{
"person_id": "0",
"confidence": 0.95,
"bounding_box": {"x": 0.1, "y": 0.2, "width": 0.3, "height": 0.6},
"keypoints": [...],
"zone_id": "zone_1",
"activity": "standing"
}
],
"zone_summary": {"zone_1": 1, "zone_2": 0},
"processing_time_ms": 45.2
}
/api/v1/pose/analyze 🔒Analyze pose data with custom parameters (requires auth).
/api/v1/pose/zones/{zone_id}/occupancyGet occupancy for a specific zone.
/api/v1/pose/zones/summaryGet occupancy summary for all zones.
/api/v1/pose/activitiesGet recently detected activities.
Query Parameters:
zone_id: Filter by zonelimit: Maximum results (1-100)/api/v1/pose/historical 🔒Query historical pose data (requires auth).
Request Body:
{
"start_time": "2025-06-09T15:00:00Z",
"end_time": "2025-06-09T16:00:00Z",
"zone_ids": ["zone_1"],
"aggregation_interval": 300,
"include_raw_data": false
}
/api/v1/pose/statsGet pose estimation statistics.
Query Parameters:
hours: Hours of data to analyze (1-168)/api/v1/pose/calibrate 🔒Start system calibration (requires auth).
/api/v1/pose/calibration/status 🔒Get calibration status (requires auth).
/api/v1/stream/statusGet streaming service status.
/api/v1/stream/start 🔒Start streaming service (requires auth).
/api/v1/stream/stop 🔒Stop streaming service (requires auth).
/api/v1/stream/clients 🔒List connected WebSocket clients (requires auth).
/api/v1/stream/clients/{client_id} 🔒Disconnect specific client (requires auth).
/api/v1/stream/broadcast 🔒Broadcast message to clients (requires auth).
/api/v1/stream/poseReal-time pose data streaming.
Query Parameters:
zone_ids: Comma-separated zone IDsmin_confidence: Minimum confidence (0.0-1.0)max_fps: Maximum frames per second (1-60)token: Auth token (if authentication enabled)Message Types:
connection_established: Initial connection confirmationpose_update: Pose data updateserror: Error messagesping/pong: Keep-alive/api/v1/stream/eventsReal-time event streaming.
Query Parameters:
event_types: Comma-separated event typeszone_ids: Comma-separated zone IDstoken: Auth token (if authentication enabled)/Root endpoint with API information.
/api/v1/infoDetailed API configuration.
/api/v1/statusCurrent API and service status.
/api/v1/metricsAPI performance metrics (if enabled).
These endpoints are only available when ENABLE_TEST_ENDPOINTS=true:
/api/v1/dev/configGet current configuration (development only).
/api/v1/dev/resetReset services (development only).
All errors follow a consistent format:
{
"error": {
"code": 400,
"message": "Error description",
"type": "error_type"
}
}
Error types:
http_error: HTTP-related errorsvalidation_error: Request validation errorsauthentication_error: Authentication failuresrate_limit_exceeded: Rate limit violationsinternal_error: Server errorsws://host/api/v1/stream/pose?paramsAll WebSocket messages use JSON format:
{
"type": "message_type",
"timestamp": "ISO-8601 timestamp",
"data": {...}
}
{"type": "ping"}: Keep-alive ping{"type": "update_config", "config": {...}}: Update stream config{"type": "get_status"}: Request status{"type": "disconnect"}: Clean disconnect{"type": "connection_established", ...}: Connection confirmed{"type": "pose_update", ...}: Pose data update{"type": "event", ...}: Event notification{"type": "pong"}: Ping response{"type": "error", "message": "..."}: Error messageCORS is enabled with configurable origins:
*)The API includes security headers:
X-Content-Type-Options: nosniffX-Frame-Options: DENYX-XSS-Protection: 1; mode=blockReferrer-Policy: strict-origin-when-cross-originContent-Security-Policy: ...max_fps to reduce bandwidthaggregation_intervalUse the provided test scripts:
scripts/test_api_endpoints.py: Comprehensive endpoint testingscripts/test_websocket_streaming.py: WebSocket functionality testingFor production:
ENVIRONMENT=productionThe API uses URL versioning:
v1/api/v1Future versions will be available at /api/v2, etc.