The RaspberryPi BLE People Counter backend exposes a versioned REST API built with FastAPI. All data routes are mounted underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AngelAmoSanchez/TFG-RaspberryPi-BLE/llms.txt
Use this file to discover all available pages before exploring further.
/api/v1, and two unversioned utility endpoints (/ and /health) are available at the root of the server. The API is served by a single FastAPI application instance that also manages a PostgreSQL database connection and an optional MQTT subscriber on startup.
Base URL
0.0.0.0:8000, so on a local machine the base URL is:
v1, sourced from the api_version field in src/config.py. All five route prefixes below are mounted relative to this base:
| Prefix | Description |
|---|---|
/detections | Submit and query raw BLE detection records |
/statistics | Aggregated people-count statistics |
/devices | Register and manage Raspberry Pi sensor nodes |
/export | Download detection data as CSV |
/settings | Configure RSSI zone classification thresholds |
Root endpoint
GET / returns basic application metadata. It does not require authentication and is useful for confirming the server is reachable.
Response
Application name. Defaults to
"TFG Bluetooth Detection Backend".API version string, e.g.
"v1".Deployment environment derived from the
ENVIRONMENT environment variable, e.g. "development" or "production".Always
"running" when the server is accepting requests.Health check endpoint
GET /health returns the current health status of the server, including the number of active WebSocket connections. This endpoint is suitable for use with container orchestration liveness probes.
Response
Always
"healthy" while the server is running.ISO 8601 timestamp of the server’s current time in the Europe/Madrid timezone.
Count of currently open WebSocket connections managed by
ws_manager.Authentication
The API does not enforce authentication by default. An optionalAPI_KEY can be set via the API_KEY environment variable (see src/config.py). When configured, clients should pass the key in a request header. The SECRET_KEY environment variable is used internally for session signing and is separate from API_KEY.
In the current codebase, API key validation is not applied at the router level. If your deployment requires it, add a dependency that checks the
X-API-Key header against settings.api_key in src/config.py.http://localhost:3000, http://localhost:5173, http://127.0.0.1:5173, and https://*.vercel.app. The Content-Disposition header is exposed so that CSV downloads work correctly in browsers.
Endpoint pages
- Detection endpoints — submit and query BLE detection records
- Statistics endpoints — aggregated people counts by zone and time window
- Device endpoints — register and manage Raspberry Pi sensor nodes
- Export endpoint — download detections as a CSV file
- Settings endpoints — configure RSSI zone thresholds
- WebSocket feed — real-time detection event stream