SmartFall Docs

API Reference

SmartFall provides a comprehensive REST API with 48+ endpoints for managing users, devices, fall events, and patient monitoring.

Base URL

https://smartfall.example.com/api

For local development:

http://localhost:3000/api

Authentication

All endpoints require JWT bearer token authentication (except signup and login):

curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://smartfall.example.com/api/patients

See Authentication for details.

Response Format

All responses use JSON with consistent formatting:

Success Response

{
  "success": true,
  "data": { /* response data */ }
}

Error Response

{
  "success": false,
  "error": "Error message",
  "details": { /* optional error details */ }
}

HTTP Status Codes

CodeMeaningUse Case
200OKSuccessful request
201CreatedResource created
204No ContentSuccessful deletion
400Bad RequestInvalid input data
401UnauthorizedMissing/invalid token
403ForbiddenInsufficient permissions
404Not FoundResource not found
409ConflictDuplicate resource
429Too Many RequestsRate limit exceeded
500Server ErrorInternal server error

API Endpoints Overview

Authentication (3 endpoints)

MethodEndpointDescription
POST/auth/signupUser registration
POST/auth/loginUser login
POST/auth/logoutUser logout

Authentication Endpoints

Device Management (5 endpoints)

MethodEndpointDescription
POST/device/sensor-streamStream sensor data
GET/device/:idGet device details
GET/device/:id/statusGet device status
GET/device/:id/logsGet device logs
DELETE/device/:idRemove device

Device Endpoints

Fall Events (4 endpoints)

MethodEndpointDescription
POST/fallsReport fall event
GET/fallsList falls (user's own)
GET/falls/recentGet recent falls
GET/falls/:idGet fall details

Fall Endpoints

Patient Management (9 endpoints)

MethodEndpointDescription
GET/patientsList patients (caregiver)
POST/patientsCreate patient (caregiver)
GET/patients/:idGet patient details
PUT/patients/:idUpdate patient
DELETE/patients/:idDelete patient
GET/patients/:id/fallsGet patient falls
GET/patients/:id/healthGet patient health data
GET/patients/:id/devicesGet patient devices
GET/patients/meGet current patient profile

Patient Endpoints

Caregiver Management (11 endpoints)

MethodEndpointDescription
GET/caregiversList all caregivers (admin)
POST/caregiversCreate caregiver (admin)
GET/caregivers/:idGet caregiver details
PUT/caregivers/:idUpdate caregiver
DELETE/caregivers/:idDelete caregiver
GET/caregivers/:id/patientsGet assigned patients
POST/caregivers/:id/patientsAssign patient
DELETE/caregivers/:id/patients/:patientIdUnassign patient
GET/caregivers/alertsGet active alerts
POST/caregivers/alerts/:id/acknowledgeAcknowledge alert
GET/caregivers/meGet current caregiver profile

Caregiver Endpoints

Admin Management (12 endpoints)

MethodEndpointDescription
GET/admin/usersList all users
GET/admin/users/:idGet user details
PUT/admin/users/:idUpdate user
DELETE/admin/users/:idDelete user
POST/admin/users/:id/roleChange user role
GET/admin/statsGet system statistics
GET/admin/logsGet system logs
POST/admin/devices/:id/disableDisable device
POST/admin/devices/:id/enableEnable device
GET/admin/fallsGet all falls
POST/admin/falls/:id/investigateFlag fall for investigation
POST/admin/maintenanceTrigger maintenance tasks

Admin Endpoints

User Profile (4 endpoints)

MethodEndpointDescription
GET/profile/meGet current user
PUT/profile/meUpdate profile
POST/profile/passwordChange password
DELETE/profile/meDelete account

Profile Endpoints

Messaging (4 endpoints)

MethodEndpointDescription
GET/messagesList messages
POST/messagesSend message
GET/messages/:idGet message details
POST/messages/:id/readMark as read

Message Endpoints

Health & Status (2 endpoints)

MethodEndpointDescription
GET/healthServer health check
GET/meCurrent user info

Health Endpoints

Pagination

Endpoints returning lists support pagination:

GET /api/patients?page=1&limit=10

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number (1-indexed)
limitinteger10Results per page (max 100)
sortstringcreated_atField to sort by
orderstringdescasc or desc

Response Format

{
  "success": true,
  "data": [/* items */],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 42,
    "totalPages": 5
  }
}

Filtering

Many endpoints support filtering:

GET /api/falls?status=HIGH&severity=2026-03-18

See individual endpoint documentation for available filters.

Rate Limiting

API enforces rate limits per IP address:

Rate Limit: 100 requests per minute

When rate limited, the API returns:

HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1711003860

Error Handling

Validation Error

HTTP/1.1 400 Bad Request
{
  "success": false,
  "error": "Validation failed",
  "details": {
    "email": "Invalid email format",
    "password": "Minimum 8 characters required"
  }
}

Authentication Error

HTTP/1.1 401 Unauthorized
{
  "success": false,
  "error": "Invalid token"
}

Permission Error

HTTP/1.1 403 Forbidden
{
  "success": false,
  "error": "Insufficient permissions"
}

API Sections

Authentication

Signup, login, and logout endpoints

Devices

Device management and sensor stream

Falls

Fall event reporting and retrieval

Patients

Patient management for caregivers

Caregivers

Caregiver management and assignments

Admin

System administration endpoints

Profile

User profile and settings

Messages

Messaging between users

Health

Server health and status endpoints

Testing API

Using curl

# Get current user
curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://smartfall.example.com/api/me

# Create a fall event
curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"confidence": 0.85, "location": "bedroom"}' \
  https://smartfall.example.com/api/falls

Using Postman

  1. Create new collection
  2. Set authorization type to "Bearer Token"
  3. Set token variable
  4. Import requests from documentation

Using JavaScript/Fetch

const response = await fetch(
  'https://smartfall.example.com/api/patients',
  {
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    }
  }
);

const data = await response.json();

SDK Support

Official SDKs available for:

  • JavaScript/TypeScript: npm install smartfall-sdk
  • Python: pip install smartfall-sdk
  • Go: go get github.com/smartfall/sdk-go

API Versioning

Current API version: v1

Future versions will be available at /api/v2, etc.

Changelog

Latest changes to the API are documented in the main project repository.


Need help? See the full endpoint documentation: