Public API
Reference Documentation
Open REST API for integrating blood donor search, request management, donation tracking, and real-time availability into external applications, hospital systems, or mobile apps.
Base URL
Content-Type
application/json
Authentication
Session token from login — passed in POST body
Pattern
https://blood.islamos.org/api.php?action=ACTION
https://blood.islamos.org/api.php?action=ACTION_NAME. GET params go in the query string; POST/PUT bodies are JSON. CORS is open to all origins — no preflight issues.
All donations now go through a two-step admin approval before donor stats are updated. This prevents fraud and ensures data integrity.
1. Donor logs / confirms donation → approval_status = "pending" (stats NOT updated yet) 2. Admin reviews pending list → GET ?action=pending_donations 3a. Admin approves → POST ?action=approve_donation (donor total_donations++, last_donation_date set, is_available=0) 3b. Admin rejects (with note) → POST ?action=reject_donation (no stat change, donor notified by email + in-app notification)
confirm_donation and log_donation endpoints both return "submitted for admin approval" — donors are notified by email once approved or rejected.
| HTTP Code | Meaning | Example Body |
|---|---|---|
| 400 | Bad Request — missing param or invalid login method | {"error":"uid required"} |
| 401 | Unauthorized — bad credentials or session token | {"error":"Invalid credentials"} |
| 404 | Resource not found | {"error":"Donor not found"} |
| 409 | Conflict — duplicate phone/email, or already approved/rejected | {"error":"Already approved"} |
| 422 | Unprocessable — required field absent in body | {"error":"'name' is required"} |
| 500 | Server / DB error | {"error":"..."} |
Use exactly these strings in all blood_group fields:
"A+" | "A-" | "B+" | "B-" | "AB+" | "AB-" | "O+" | "O-"
| Parameter | Type | Description |
|---|---|---|
| blood_groupopt | string | Filter by blood group enum |
| availableopt | 0 | 1 | Filter by availability flag |
| qopt | string | Search name, category, district, department, institution, address |
| limitopt | int (1–100) | Page size. Default: 20 |
| offsetopt | int | Pagination offset. Default: 0 |
No request body — GET only.
{
"donors": [{
"id": 12, "unique_id": "Xb3Mn7291", "name": "Md. Rafiqul Islam",
"blood_group": "B+", "is_available": 1, "total_donations": 7,
"eligibility_status": "eligible", "recovery_pct": 100,
"days_until_eligible": 0, "phone_masked": "01712••••••12",
"is_verified": 1
}],
"count": 1, "total": 248, "offset": 0, "limit": 20, "has_more": true
}curl "https://blood.islamos.org/api.php?action=donors&blood_group=B%2B&available=1&q=Khulna&limit=10"
| Parameter | Type | Description |
|---|---|---|
| idreq | int | Donor's numeric database ID |
No request body.
{
"id": 12, "unique_id": "Xb3Mn7291", "name": "Md. Rafiqul Islam",
"blood_group": "B+", "is_verified": 1,
"history": [{ "donated_at": "2024-11-03", "location": "iBDN" }]
}curl "https://blood.islamos.org/api.php?action=donor&id=12"
| Parameter | Type | Description |
|---|---|---|
| uidreq | string | Public unique ID e.g. Xb3Mn7291 |
No request body.
curl "https://blood.islamos.org/api.php?action=donor_profile&uid=Xb3Mn7291"
No query parameters.
| Field | Type | Description |
|---|---|---|
| namereq | string | Full name |
| blood_groupreq | string | See Blood Group Enum |
| phonereq | string | Unique BD mobile number — login username |
| passwordreq | string | Plaintext (bcrypt-hashed server-side) |
| home_districtreq | string | Home district name |
| emailopt | string | Unique email — also usable as login username |
| genderopt | string | male | female | other |
| dobopt | date | YYYY-MM-DD |
| categoryopt | string | student | employee | general |
| institution_nameopt | string | University / hospital / company |
| departmentopt | string | Department or ward |
| designationopt | string | Job title / designation |
| professionopt | string | Profession field |
| present_addressopt | string | Current address |
| last_donation_dateopt | date | Used to auto-compute next eligibility date |
| total_donationsopt | int | Historical donation count (default: 0) |
{ "message": "Registered successfully", "id": 99, "unique_id": "Xb3Mn7291" }curl -X POST "https://blood.islamos.org/api.php?action=register" \ -H "Content-Type: application/json" \ -d '{ "name": "Numan Ibne Bashir", "blood_group": "O+", "phone": "+8801712345678", "email": "numan@example.com", "password": "SecurePass!1", "home_district": "Dhaka" }'
No query parameters.
| Field | Type | Description |
|---|---|---|
| passwordreq | string | Account password |
| phoneopt* | string | Registered phone number |
| emailopt* | string | Registered email address |
phone or email — at least one is required. If both are sent, email takes precedence.{
"message": "Login successful",
"token": "64-char-hex-session-token",
"donor": { /* full donor object, password_hash and phone stripped */ }
}curl -X POST "https://blood.islamos.org/api.php?action=login" \ -H "Content-Type: application/json" \ -d '{"email":"fatema@example.com","password":"SecurePass!1"}'
No query parameters.
| Field | Type | Description |
|---|---|---|
| donor_idreq | int | Donor's numeric ID |
| is_availablereq | 0 | 1 | New availability status |
donor_id directly instead of a session token. Validate identity in your integration layer before calling.{ "message": "Status updated" }curl -X PUT "https://blood.islamos.org/api.php?action=update_status" \ -H "Content-Type: application/json" \ -d '{"donor_id":12,"is_available":1}'
No query parameters.
| Field | Type | Description |
|---|---|---|
| donor_idreq | int | Target donor's numeric ID |
| requester_namereq | string | Name of the person requesting blood |
| requester_phonereq | string | Requester's contact number |
| messagereq | string | Reason / urgency details |
| requester_emailopt | string | Email for confirmation copy |
| bags_neededopt | int | Number of blood bags required |
| needed_atopt | datetime | When blood is needed YYYY-MM-DD HH:MM:SS |
| locationopt | string | Hospital / ward name |
{
"message": "Request sent. The donor will contact you if available.",
"request_id": 45,
"track_token": "3f8a2b1c...",
"track_url": "https://blood.islamos.org/track/3f8a2b1c...",
"email_results": {
"donor_notified": true, "requester_confirmed": true, "admin_notified": true
}
}curl -X POST "https://blood.islamos.org/api.php?action=contact_request" \ -H "Content-Type: application/json" \ -d '{ "donor_id": 12, "requester_name": "Dr. Hasan", "requester_phone": "01811223344", "message": "Emergency post-surgical patient needs 2 bags", "bags_needed": 2, "location": "Location of Donation" }'
| Parameter | Type | Description |
|---|---|---|
| bgopt | string | Filter by blood group (e.g. A+) |
No request body.
{
"requests": [{
"id": 7, "blood_group": "O-", "hospital": "Mayo Clinic",
"urgency": "critical", "bags_needed": 3,
"time_left": "4 hr left",
"requester_phone": "017123****78"
}],
"total": 5
}curl "https://blood.islamos.org/api.php?action=public_requests&bg=O-"
No query parameters.
| Field | Type | Description |
|---|---|---|
| request_idreq | int | ID of the public request |
{ "message": "Marked as fulfilled" }curl -X POST "https://blood.islamos.org/api.php?action=fulfill_public" \ -H "Content-Type: application/json" \ -d '{"request_id":7}'
| Parameter | Type | Description |
|---|---|---|
| tokenreq | string | 32-char hex tracking token |
No request body.
{
"id": 45, "status": "accepted",
"status_label": "Accepted by Donor", "status_icon": "✅",
"status_color": "#16A34A",
"status_desc": "The donor has accepted. They will contact you shortly.",
"donor_name": "Md. Rafiqul Islam",
"donor_uid": "Xb3Mn7291",
"donor_blood_group": "B+",
"donor_district": "Khulna",
"donor_present_address": "Khulna Medical College Road",
"donor_phone_masked": "01712••••••12",
"donor_email_masked": "raf••••••ul@gmail.com"
}Status values: pending · accepted · declined · donated
donor_phone_masked and donor_email_masked.curl "https://blood.islamos.org/api.php?action=track_request&token=3f8a2b1c..."
pending donation record.No query parameters.
| Field | Type | Description |
|---|---|---|
| request_idreq | int | Contact request ID |
| statusreq | string | accepted | declined | donated |
accepted inserts a pending donation record and notifies the admin for approval. Donor stats are NOT updated yet.{ "message": "Status updated" }curl -X POST "https://blood.islamos.org/api.php?action=update_request_status" \ -H "Content-Type: application/json" \ -d '{"request_id":45,"status":"accepted"}'
pending — admin must approve before stats update.No query parameters.
| Field | Type | Description |
|---|---|---|
| donor_idreq | int | Donor's numeric ID |
| donated_atreq | date | Donation date YYYY-MM-DD |
| locationreq | string | Where the donation took place |
| recipient_infoopt | string | Optional recipient details |
donor_id directly (not a session token). Donation goes to pending state awaiting admin approval.{ "message": "Donation submitted for admin approval. Your record will be updated once approved." }curl -X POST "https://blood.islamos.org/api.php?action=log_donation" \ -H "Content-Type: application/json" \ -d '{"donor_id":12,"donated_at":"2025-06-01","location":"Location"}'
pending for admin approval.No query parameters.
| Field | Type | Description |
|---|---|---|
| request_idreq | int | The contact request ID to confirm |
| donated_atopt | date | Date of donation (defaults to today) |
| locationopt | string | Defaults to "Location of Donation" |
{ "message": "Donation submitted for admin approval. Your record will be updated once approved." }curl -X POST "https://blood.islamos.org/api.php?action=confirm_donation" \ -H "Content-Type: application/json" \ -d '{"request_id":45,"location":"Location of Donation"}'
No parameters required.
No request body.
{
"donations": [{
"id": 88,
"donor_id": 12, "donor_name": "Md. Rafiqul Islam",
"donor_uid": "Xb3Mn7291", "blood_group": "B+",
"donated_at": "2025-06-01", "location": "iBDN",
"approval_status": "pending",
"submitted_by": "donor",
"donor_verified": 1
}],
"count": 3
}curl "https://blood.islamos.org/api.php?action=pending_donations"
total_donations++, last_donation_date set, is_available=0, next_available_date = +120 days.No query parameters.
| Field | Type | Description |
|---|---|---|
| donation_idreq | int | Donation record ID to approve |
| admin_idopt | int | Admin user ID for audit trail |
| noteopt | string | Optional note shown to donor in approval email |
{ "message": "Donation approved and donor stats updated." }curl -X POST "https://blood.islamos.org/api.php?action=approve_donation" \ -H "Content-Type: application/json" \ -d '{"donation_id":88,"admin_id":1,"note":"Verified via hospital record"}'
No query parameters.
| Field | Type | Description |
|---|---|---|
| donation_idreq | int | Donation record ID to reject |
| notereq | string | Reason for rejection — shown to donor |
| admin_idopt | int | Admin user ID for audit trail |
recipient_info), that request status is reverted to accepted so the donor can re-confirm.{ "message": "Donation rejected. Donor notified." }curl -X POST "https://blood.islamos.org/api.php?action=reject_donation" \ -H "Content-Type: application/json" \ -d '{"donation_id":88,"note":"Could not verify — no hospital record found","admin_id":1}'
No parameters required.
No request body.
{
"total_donors": 312, "available_donors": 198,
"total_donations": 1074, "total_requests": 456,
"by_blood_group": [{ "blood_group": "B+", "c": 89 }],
"top_donors": [{
"id": 12, "unique_id": "Xb3Mn7291", "name": "Md. Rafiqul",
"blood_group": "B+", "total_donations": 23, "is_verified": 1
}],
"prize": {
"cycle_number": 2,
"cycle_end": "2026-12-31",
"years_left": 0, "months_left": 6, "days_left": 24,
"ended": false,
"last_winners": []
}
}prize object contains the current prize cycle countdown and previous cycle winners from the built-in Prize Engine.curl "https://blood.islamos.org/api.php?action=stats"
No query parameters.
| Field | Type | Description |
|---|---|---|
| tokenreq | string | Session token from login |
| contact_requestsopt | bool | Notify when someone requests blood |
| emergency_alertsopt | bool | Critical-urgency broadcast alerts |
| donation_remindersopt | bool | Periodic reminders to update availability |
| reactivationopt | bool | Notify when donor becomes eligible again |
| newsletteropt | bool | Monthly newsletter |
| admin_broadcastopt | bool | Admin-sent announcements |
{ "message": "Preferences updated", "preferences": { /* updated prefs */ } }curl -X POST "https://blood.islamos.org/api.php?action=update_email_prefs" \ -H "Content-Type: application/json" \ -d '{"token":"abc123...","emergency_alerts":true,"newsletter":false}'
| Parameter | Type | Description |
|---|---|---|
| tokenreq | string | Unsubscribe token from email footer link |
| prefopt | string | Specific preference key. Omit to unsubscribe from all. |
No request body.
{ "message": "Unsubscribed successfully", "preferences": { /* updated */ } }curl "https://blood.islamos.org/api.php?action=unsubscribe&token=TOKEN&pref=newsletter"
Intentional Blood Donation Network (iBDN) · API v1.0 · CORS open · https://blood.islamos.org