POST /api/login

Athenticate a user by email or phone. Returns a Bearer token.

BODY PARAMETERS (JSON)
{ "email": "user@example.com", "password": "password123", "device_name": "chrome_browser" }
SUCCESS RESPONSE (200)
{ "success": true, "token": "1|AbCdEfG...", "user": { "id": 1, "name": "John Doe", "roles": ["donor"] } }
POST /api/register

Create a new user account as a donor or requester.

{ "name": "Jane Smith", "email": "jane@example.com", "phone": "0123456789", "password": "password123", "blood_group": "A+", "roles": ["donor"] }
POST /api/request

Post a new emergency blood request. Triggers nearby P2P matching.

HEADERS
Authorization: Bearer YOUR_TOKEN
REQUEST BODY
{ "blood_group": "B+", "hospital": "City Central Hospital", "urgency": "critical", "units_needed": 2, "latitude": 23.8103, "longitude": 90.4125, "city": "Dhaka" }
GET /api/updates

Near real-time polling endpoint. Use this every 3-5 seconds.

QUERY PARAMETERS
?last_checked=2024-03-21T12:00:00Z
RESPONSE
{ "success": true, "new_notifications": [...], "new_requests": [...], "new_matches": [...], "server_time": "2024-03-21T12:05:00Z" }