Overview
MediLoca is a healthcare location intelligence API that enables applications to discover nearby medical facilities, measure healthcare accessibility, retrieve emergency routing, locate specialist services, and evaluate community health risk — all using Maiaddy's Loccode as the primary location identifier.
Every request is built around a loccode — a unique identifier from the Maiaddy platform that pinpoints a specific geographic area at postcode-level precision. Send a loccode, and the API returns data for that exact location: nearby facilities, access scores, emergency routes, specialist recommendations, or community health risk.
The six endpoints
NOTE
All intelligence endpoints use HTTP GET with query parameters. Include Authorization: Bearer YOUR_API_KEY on every request.
The Loccode
Every endpoint requires a loccode. Understanding how to use it correctly will save you from the most common errors.
What is a loccode?
A loccode is a structured alphanumeric code that maps to a specific postcode-level area in Nigeria. It is generated and validated by the Maiaddy location intelligence platform, which links GPS-confirmed coordinates to a unique code for that location.
Think of it like a postcode, except it maps to a real, GPS-confirmed area rather than a general postal district. Each loccode resolves to a specific state, LGA, and set of coordinates.
Sample Loccodes to Get You Started:
- LA10E 2AC
- LA15A 2JU
Loccodes are case-insensitive
The following values resolve to the same location:
LA10E 2AC
la10e 2ac
La10e 2acMediLoca normalises Loccodes automatically. However, documentation should still present them in uppercase.
The Loccode must be exact
A loccode must be submitted exactly as it was issued, with correct characters and correct spacing. The API does not correct or guess. Any mistake will cause the request to fail.
- 400 Bad Request: The loccode query parameter is missing from the request.
- 404 Not Found: A loccode was submitted but is malformed or not registered in the database.
IMPORTANT
If you are unsure of the exact format for a Loccode, retrieve it from the Maiaddy app. Do not guess or construct one manually.
The Loccode echoed back in a response may look slightly different from what you sent; for example KD10A 4SE may return as KD10A-4SE. This is only a display difference in the response output. It does not mean the API accepts both formats as input.
Authentication & Requests
API key
An API key is required for every request. Include it in the authorisation header:
Authorization: Bearer YOUR_API_KEYCreate an API Key here.
WARNING
Never put your API key in client-side code or any publicly visible location (including GitHub). Always call the Mediloca API from your server. Store your key in an environment variable; never hardcode it.
Request format
Every request to the Mediloca API must include the following headers.
Bearer YOUR_API_KEYIntelligence endpoints pass parameters as query strings on the URL. Parameter names and string values are case-sensitive unless otherwise stated.
Response format
A successful request returns HTTP 200 OK with a JSON body. The response always echoes back the loccode that was sent. If something goes wrong, the API returns a non-200 status code with an error body. See Error reference for cross-endpoint HTTP semantics. Per-route error tables are under Get Facilities errors, Healthcare Access errors, Emergency Route errors, Specialist Recommendation errors, Health Risk errors, and Health Heatmap errors.
Endpoints
Get Facilities by Loccode
Returns healthcare facilities near a location. Results can be filtered by radius, facility level, and result limit. Each facility record includes accreditations, specialties, supported insurance plans, emergency availability, a relevance ranking score, and travel estimates.
https://api.maiaddy.com/mediloca/api/v1/facilities?loccode=LA10E 2AC&radius_km=5&facility_level=Secondary&limit=2Headers
Bearer YOUR_API_KEYQuery — Request parameters
loccodestringYesPatient or search origin Loccode. Must be exactly as issued. Example: LA10E 2ACradius_kmnumberNoSearch radius in kilometres. Example: 10.0facility_levelstringYesFilter by care level: Primary, Secondary, or Tertiary. Example: SecondarylimitintegerNoMaximum number of ranked facilities to return. Example: 5Example query params
loccode=LA10E 2AC&radius_km=5&facility_level=Secondary&limit=2Full curl command
curl -X GET \ "https://api.maiaddy.com/mediloca/api/v1/facilities?loccode=LA10E%202AC&radius_km=5&facility_level=Secondary&limit=2" \ -H "Authorization: Bearer YOUR_API_KEY"
Response — 200 OK
{
"success": true,
"message": "Facility search completed successfully",
"timestamp": 1779786535292,
"data": {
"loccode": "LA10e 2ac",
"location": {
"lat": 6.6604933,
"lon": 3.3214708,
"state": "Lagos",
"lga": "Ifako_Ijaye"
},
"filters": { "facility_level": "Secondary" },
"count": 2,
"radius_km": 5.0,
"scoring": "Score = 0.35×distance + 0.25×travel_time + 0.20×accreditation + 0.10×capacity + 0.05×satisfaction + 0.05×wait",
"generated_at": "2026-05-26T09:08:55Z",
"facilities": [
{
"rank": 1,
"name": "Ayodele Medical Center",
"category": "Primary Health Center",
"ownership": "Private",
"state": "Lagos",
"lga": "Ifako/Ijaye",
"ward": "Tabon Tabon",
"address": "Ayodele Medical Center, Tabon Tabon, Ifako/Ijaye, Lagos, Nigeria",
"nhfr_code": "24/10/1/2/2/0007",
"facility_level": "Secondary",
"functional_status": "Functional",
"accreditations": [{ "body": "NHFR", "status": "active" }, { "body": "MDCN", "status": "active" }],
"specialties": ["Primary Care", "Immunisation", "Antenatal"],
"distance_km": 0.47,
"travel_time_minutes": 2.0,
"emergency_services": true,
"accepts_insurance_plans": ["Hygeia HMO", "AXA Mansard Health", "Reliance HMO", "Total Health Trust"],
"beds_capacity": null,
"wait_time_estimate_minutes": null,
"ranking_score": 0.8137,
"score_breakdown": {
"distance_weight": 0.35,
"travel_time_weight": 0.25,
"accreditation_weight": 0.20,
"capacity_weight": 0.10,
"satisfaction_weight": 0.05,
"wait_time_weight": 0.05
}
},
{
"rank": 2,
"name": "Ifako Ijaiye General Hospital",
"category": "General Hospital",
"ownership": "Public",
"state": "Lagos",
"lga": "Ifako/Ijaye",
"ward": "Ifako Coker",
"address": "Ifako Ijaiye General Hospital, Ifako Coker, Ifako/Ijaye, Lagos, Nigeria",
"nhfr_code": "24/10/1/2/1/0001",
"facility_level": "Secondary",
"functional_status": "Functional",
"accreditations": [{ "body": "NHFR", "status": "active" }, { "body": "MDCN", "status": "active" }, { "body": "NHIA", "status": "active" }],
"specialties": ["General Medicine", "Surgery", "Paediatrics", "Obstetrics", "Emergency"],
"distance_km": 1.95,
"travel_time_minutes": 6.0,
"emergency_services": true,
"accepts_insurance_plans": ["NHIS", "NSITF", "Hygeia HMO", "AXA Mansard Health", "Reliance HMO"],
"beds_capacity": null,
"wait_time_estimate_minutes": null,
"ranking_score": 0.7503,
"score_breakdown": {
"distance_weight": 0.35,
"travel_time_weight": 0.25,
"accreditation_weight": 0.20,
"capacity_weight": 0.10,
"satisfaction_weight": 0.05,
"wait_time_weight": 0.05
}
}
]
}
}Response fields
loccodestringLoccode echoed from the request.locationobjectResolved coordinates and administrative labels (lat, lon, state, lga).radius_kmnumberSearch radius applied.filtersobjectActive filters such as facility_level.countintegerNumber of facilities returned.facilitiesarrayRanked facilities with distance_km, travel_time_minutes, accreditations, insurance plans, specialties, and ranking_score.facilities[].ranking_scorenumberComposite score used for ordering (higher is better).facilities[].score_breakdownobjectWeights applied for distance, travel time, accreditation, capacity, and wait time.Errors
Get Healthcare Access
Returns a comprehensive measure of healthcare accessibility for a location. Use this endpoint to score facility availability, detect coverage gaps, identify the nearest care options by category, and support planning decisions for HMOs, NGOs, and government agencies.
https://api.maiaddy.com/mediloca/api/v1/access?loccode=LA10E 2ACHeaders
Bearer YOUR_API_KEYQuery — Request parameters
loccodestringYesLoccode for the region to score. Example: LA10E 2ACExample query params
loccode=LA10E 2ACFull curl command
curl -X GET \ "https://api.maiaddy.com/mediloca/api/v1/access?loccode=LA10E%202AC" \ -H "Authorization: Bearer YOUR_API_KEY"
Response — 200 OK
{
"loccode": "LA10E 2AC",
"location": {
"lat": 6.6604933,
"lon": 3.3214708,
"state": "Lagos",
"lga": "Ifako_Ijaye"
},
"access_score": 87.4,
"coverage_band": "Excellent",
"score_breakdown": {
"facility_density_5km": 30.0,
"hospital_proximity": 24.4,
"primary_care_proximity": 18.1,
"emergency_proximity": 14.8,
"nhia_coverage_rate": 0.1
},
"facility_counts": {
"within_5km": 99,
"within_10km": 238,
"functional_within_10km": 130,
"nhia_accredited_within_10km": 2
},
"nearest_by_type": {
"primary_care": {
"name": "Ayodele Medical Center",
"category": "Primary Health Center",
"distance_km": 0.47,
"functional_status": "Functional"
},
"secondary_care": {
"name": "Ayodele Medical Center",
"category": "Primary Health Center",
"distance_km": 0.47,
"functional_status": "Functional"
},
"tertiary_care": {
"name": "Sekafem Specialist Hospital",
"category": "Specialist Hospital",
"distance_km": 5.7,
"functional_status": "Functional"
},
"emergency": {
"name": "Sekafem Specialist Hospital",
"category": "Specialist Hospital",
"distance_km": 5.7,
"functional_status": "Functional"
},
"maternity": {
"name": "Obanto Maternity and Child Welfare Clinic",
"category": "Maternity Home",
"distance_km": 1.44,
"functional_status": "Functional"
}
},
"coverage_gaps": [
{ "specialty": "emergency", "gap_severity": "moderate", "nearest_km": 5.7 },
{ "specialty": "paediatrics", "gap_severity": "moderate", "nearest_km": 5.7 },
{ "specialty": "surgery", "gap_severity": "moderate", "nearest_km": 5.7 }
],
"nhia_accreditation_rate_10km": 0.008,
"interpretation": "≥4 functional facilities within 5km, hospital within 5km, NHIA coverage >75%",
"use_cases": [
"NHIA: Verify patient has accredited facility before enrollment approval",
"NGOs: Identify and prioritize healthcare deserts for outreach",
"HMOs: Show members their in-network access score before purchase",
"Government: Data-driven planning for new facility placement"
],
"generated_at": "2026-05-26T09:12:18Z"
}Response fields
loccodestringLoccode queried.locationobjectResolved lat, lon, state, and lga.access_scorenumberRegional healthcare access score from 0 to 100.coverage_bandstringSummary access band. Values: Poor, Adequate, Strong, Excellent.score_breakdownobjectContributions from density, hospital proximity, primary care, emergency, and NHIA coverage.facility_countsobjectCounts within 5 km and 10 km, including functional and NHIA-accredited facilities.nearest_by_typeobjectNearest primary, secondary, tertiary, emergency, and maternity facilities.coverage_gapsarrayIdentified gaps in coverage for outreach or planning.interpretationstringPlain-language summary of access.use_casesarray of stringsSuggested applications for NHIA, NGOs, HMOs, and government.Errors
Get Emergency Route
Returns emergency routing recommendations for a location. The response identifies the nearest emergency-capable facilities, provides travel estimates, navigation links, and a list of Nigerian emergency contact numbers.
https://api.maiaddy.com/mediloca/api/v1/emergency-route?loccode=LA15A 2JUHeaders
Bearer YOUR_API_KEYQuery — Request parameters
loccodestringYesThe Loccode for the emergency origin point. Example: LA15A 2JUExample query params
loccode=LA15A 2JUFull curl command
curl -X GET \ "https://api.maiaddy.com/mediloca/api/v1/emergency-route?loccode=LA15A%202JU" \ -H "Authorization: Bearer YOUR_API_KEY"
Response — 200 OK
{
"success": true,
"message": "Emergency route recommendation retrieved successfully",
"timestamp": 1779786892961,
"data": {
"loccode": "LA15A 2JU",
"location": {
"lat": 6.5282223,
"lon": 3.3708662,
"state": "Lagos",
"lga": "Mainland"
},
"nearest_emergency_facilities": [
{
"name": "Adams Maternity and Clinic Home",
"category": "Maternity Home",
"latitude": 6.6700744,
"longitude": 3.3519884,
"phone": null,
"facility_level": "Secondary",
"distance_km": 21.04,
"travel_time_minutes": 22.0,
"functional_status": "Functional",
"google_maps_url": "https://www.google.com/maps/dir/6.5282223,3.3708662/6.6700744,3.3519884"
},
{
"name": "Total Health Hospital",
"category": "Primary Health Center",
"latitude": 6.671325683,
"longitude": 3.359924316,
"phone": null,
"facility_level": "Secondary",
"distance_km": 21.64,
"travel_time_minutes": 22.0,
"functional_status": "Unknown",
"google_maps_url": "https://www.google.com/maps/dir/6.5282223,3.3708662/6.671325683,3.359924316"
},
{
"name": "God's Hope Hospital",
"category": "Maternity Home",
"latitude": 6.729425,
"longitude": 3.405345,
"phone": null,
"facility_level": "Secondary",
"distance_km": 27.7,
"travel_time_minutes": 24.0,
"functional_status": "Functional",
"google_maps_url": "https://www.google.com/maps/dir/6.5282223,3.3708662/6.729425,3.405345"
}
],
"emergency_contacts": {
"police": "112",
"ambulance": "112",
"fire": "112",
"nema": "0800 033 3601"
},
"generated_at": "2026-05-26T09:14:52Z"
}
}Response fields
loccodestringThe Loccode queried, echoed back as submitted.locationobjectResolved coordinates and administrative area for the Loccode.nearest_emergency_facilitiesarrayRanked list of the closest emergency-capable facilities, each with distance, travel time, and a direct Google Maps navigation link.emergency_contactsobjectNigerian emergency service numbers.generated_atstringISO 8601 timestamp of when the response was generated.Errors
Get Specialist Recommendation
Maps a health condition or symptom description to a predicted medical specialty, then returns a ranked list of facilities that offer that specialist care near the queried location.
https://api.maiaddy.com/mediloca/api/v1/specialist?loccode=LA15A 2JU&health_condition=broken boneHeaders
Bearer YOUR_API_KEYQuery — Request parameters
loccodestringYesPatient Loccode. Example: LA15A 2JUhealth_conditionstringYesThe condition or symptom to match to a specialist. Plain language is accepted. Example: broken boneExample query params
loccode=LA15A 2JU&health_condition=broken boneFull curl command
curl -X GET \ "https://api.maiaddy.com/mediloca/api/v1/specialist?loccode=LA15A%202JU&health_condition=broken%20bone" \ -H "Authorization: Bearer YOUR_API_KEY"
Response — 200 OK
{
"success": true,
"message": "Specialist recommendations retrieved successfully",
"timestamp": 1779787005213,
"data": {
"loccode": "LA15A 2JU",
"location": {
"lat": 6.5282223,
"lon": 3.3708662,
"state": "Lagos",
"lga": "Mainland"
},
"input_condition": "broken bone",
"predicted_specialties": [{ "name": "Orthopedics", "confidence": 0.98 }],
"recommended_specialists": [
{
"name": "Rabonni Specialist Hospital",
"status": "Functional",
"category": "Specialist Hospital",
"coordinates": { "lat": 6.544785, "lon": 3.374063333 },
"specialty_matched": "Orthopedics",
"confidence_score": 0.98,
"distance_km": 1.88,
"facility_level": "Tertiary",
"final_rank_score": 0.845
},
{
"name": "German Friendship Specialist Hospital",
"status": "Functional",
"category": "Specialist Hospital",
"coordinates": { "lat": 6.49784, "lon": 3.362503333 },
"specialty_matched": "Orthopedics",
"confidence_score": 0.98,
"distance_km": 3.5,
"facility_level": "Tertiary",
"final_rank_score": 0.804
},
{
"name": "Faari Specialist Hospital",
"status": "Functional",
"category": "Specialist Hospital",
"coordinates": { "lat": 6.494, "lon": 3.37971 },
"specialty_matched": "Orthopedics",
"confidence_score": 0.98,
"distance_km": 3.93,
"facility_level": "Tertiary",
"final_rank_score": 0.794
}
]
}
}Response fields
loccodestringLoccode echoed from the request.input_conditionstringCondition text as interpreted by the ML layer.locationobjectResolved lat, lon, state, and lga.predicted_specialtiesarraySpecialties inferred from the condition with confidence scores.recommended_specialistsarrayProximity-ranked facilities with specialty_matched, confidence_score, distance_km, and final_rank_score.Errors
Get Health Risk
Returns a community health risk assessment for a location. The response includes an overall risk index, environmental condition indicators, infrastructure quality data, and disease prevalence trends for the population in that area.
https://api.maiaddy.com/mediloca/api/v1/health-risk?loccode=LA15A 2JUHeaders
Bearer YOUR_API_KEYQuery — Request parameters
loccodestringYesThe Loccode for the target location. Must be exactly as issued. Example: LA15A 2JUExample query params
loccode=LA15A 2JUFull curl command
curl -X GET \ "https://api.maiaddy.com/mediloca/api/v1/health-risk?loccode=LA15A%202JU" \ -H "Authorization: Bearer YOUR_API_KEY"
Response — 200 OK
{
"success": true,
"message": "Health risk analysis retrieved successfully",
"timestamp": 1779787104065,
"data": {
"loccode": "LA15A 2JU",
"location": {
"lat": 6.5282223,
"lon": 3.3708662,
"state": "Lagos",
"lga": "Mainland"
},
"health_risk_index": 36.4,
"risk_level": "Moderate",
"computation_breakdown": {
"urban_density_stress_35pct": 28.0,
"infrastructure_deficit_35pct": 0.0,
"socio_economic_vulnerability_30pct": 8.4
},
"environmental_vitals": {
"population_density_per_sqkm": 20000.0,
"infrastructure_quality_score": 1.0,
"crime_index": 3.5,
"avg_income_index": 0.7,
"nearby_facilities_10km": 42254
},
"disease_prevalence": {
"malaria": { "source": "WHO Africa 2024", "trend": "stable", "prevalence_per_1000": 280.0 },
"hypertension": { "source": "Nigeria NBS 2023", "trend": "increasing", "prevalence_per_1000": 180.0 },
"diabetes_mellitus": { "source": "WHO 2024", "trend": "increasing", "prevalence_per_1000": 65.0 },
"respiratory_infections": { "source": "NHMIS 2023", "trend": "stable", "prevalence_per_1000": 320.0 },
"diarrheal_diseases": { "source": "UNICEF 2024", "trend": "decreasing", "prevalence_per_1000": 240.0 },
"musculoskeletal_conditions": { "source": "WHO 2024", "trend": "stable", "prevalence_per_1000": 120.0 }
}
}
}Response fields
loccodestringLoccode queried.locationobjectResolved lat, lon, state, and lga.health_risk_indexnumberComposite risk index for the Loccode area.risk_levelstringBand such as Moderate or High.computation_breakdownobjectWeighted contributions from urban density, infrastructure, and socio-economic factors.environmental_vitalsobjectPopulation density, infrastructure score, crime index, income, and nearby facility counts.disease_prevalenceobjectPer-disease prevalence per 1000 with source and trend.Errors
Get Health Heatmap
Returns a geographic health visualisation for a location. Use this endpoint to retrieve heatmap points for facility strength and regional risk signals around a loccode.
https://api.maiaddy.com/mediloca/api/v1/heatmap?loccode=LA13A 1MLHeaders
Bearer YOUR_API_KEYQuery — Request parameters
loccodestringYesCenter Loccode for the heatmap. Example: LA13A 1MLExample query params
loccode=LA13A 1MLFull curl command
curl -X GET \ "https://api.maiaddy.com/mediloca/api/v1/heatmap?loccode=LA13A%201ML" \ -H "Authorization: Bearer YOUR_API_KEY"
Response — 200 OK
{
"loccode": "LA13A 1ML",
"center": {
"lat": 6.5885785,
"lon": 3.3492144
},
"radius_km": 10.0,
"heatmap_points": [
{
"lat": 6.65424,
"lon": 3.27292,
"type": "facility_strength",
"intensity": 0.05,
"label": "Femtake Convalescent Center"
},
{
"lat": 6.59376632,
"lon": 3.268632832,
"type": "facility_strength",
"intensity": 0.05,
"label": "Baruwa Alimosho Primary Health Center"
}
],
"summary": {
"facility_count": 999,
"risk_nodes": 100
}
}Response fields
loccodestringLoccode queried.centerobjectCenter point lat and lon.radius_kmnumberRadius of the heatmap in kilometres.heatmap_pointsarrayGeospatial nodes with lat, lon, type (facility_strength or risk), intensity, and label.summaryobjectAggregate facility_count and risk_nodes for the area.Errors
Error reference
HTTP error patterns the Mediloca API can return across any endpoint. Missing or invalid API keys typically produce 401 Unauthorized with the same JSON error envelope.
HTTP status codes — all endpoints
Error response examples
When an error occurs, the API returns a JSON body alongside the error status code:
{
"error": {
"code": "ERROR_CODE_STRING",
"message": "A plain-language description of what went wrong.",
"details": "Optional: additional context, such as which field failed."
}
}Quick reference
Endpoints at a glance
Required query parameters for each GET route — use with the overview table above when wiring clients or tests.
NOTE
All endpoints use HTTP GET with Authorization: Bearer YOUR_API_KEY.
Facility level values
Accepted values for the facility_level filter on Get Facilities:
Primary Secondary Tertiary
Get Healthcare Access returns a coverage_band such as:
Poor Adequate Strong Excellent
Further Resources
Everything you need to go further with the Mediloca API.
SDKs
Official Python and Java SDKs for Mediloca are published to PyPI and Maven Central. See the Mediloca SDK guide for installation, authentication, and working examples for every endpoint.
The Loccode
Loccodes are generated and validated by the Maiaddy location intelligence platform. Retrieve them from the Maiaddy app — do not guess or construct one manually.
Getting help
For bug reports, feature requests, or integration questions, contact the Maiaddy team directly.
- Email: developer@maiaddy.com
- Web: maiaddy.com