Create an account and generate an API key from your dashboard.
Call any endpoint with your API key in the x-api-key header.
Every response includes success, data, and optional meta pagination.
Example Request
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/geocode/reverse?lat=23.8103&lon=90.4125" \ -H "x-api-key: YOUR_API_KEY"
Response
All service endpoints require a valid API key. You can pass it via request header or query parameter.
| Method | Example |
|---|---|
| Header | x-api-key: rm_live_xxx |
| Query | ?api_key=rm_live_xxx |
Base URL
https://rasta-mapen-server.vercel.app/api/v1
Auth Examples
# Via header curl -H "x-api-key: rm_live_xxx" \ "https://rasta-mapen-server.vercel.app/api/v1/divisions" # Via query parameter curl "https://rasta-mapen-server.vercel.app/api/v1/divisions?api_key=rm_live_xxx"
Click anywhere on the map below — we'll call /geocode/reverse and show you the resolved address hierarchy in real time.
Map tiles are served free by OpenStreetMap contributors.
/api/v1/divisionsGet all divisions (paginated)
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| page | query | number | no | Page number (default 1) |
| limit | query | number | no |
/api/v1/districtsGet all districts (paginated)
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| page | query | number | no | Page number |
| limit | query | number | no | Per page (max 50) |
/api/v1/sub-districtsGet all sub-districts (paginated)
/api/v1/sub-districts/:idGet sub-district by ID
/api/v1/thanasGet all thanas (paginated)
/api/v1/thanas/:idGet thana by ID
/api/v1/thanas/sub-district/:name/api/v1/unionsGet all unions (paginated)
/api/v1/unions/:idGet union by ID
/api/v1/unions/sub-district/:name/api/v1/placesGet all places (paginated, filterable)
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| page | query | number | no | Page number |
| limit | query | number | no | Per page (max 50) |
| type | query |
/api/v1/geocode/reverseReverse geocode — coordinates to full address hierarchy
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| lat | query | number | yes | Latitude |
| lon | query | number | yes | Longitude |
Division → District → Sub-district → Thana → Union + nearby places + formatted address
/api/v1/ward-zonesGet all ward zones (paginated)
/api/v1/ward-zones/city/:cityGet ward zone by city name
| Param | In | Type | Req | Description |
|---|---|---|---|---|
/api/v1/routing/routeTurn-by-turn directions between two coordinates. Returns distance, duration, and (optionally) per-step instructions plus a GeoJSON LineString geometry.
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| from | query | string | yes | Origin "lat,lng" |
| to | query |
/api/v1/roads/nearestFind the road segment whose centerline is closest to a lat/lng.
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| lat | query | number | yes | Latitude |
| lng | query | number | yes | Longitude (lon also accepted) |
API requests are rate-limited based on your subscription plan. Exceeding your limit returns 429 Too Many Requests.
| Plan | Daily | Monthly |
|---|---|---|
| Free | 500 | 15,000 |
| Starter | 5,000 | 150,000 |
| Growth | 25,000 | 750,000 |
| Enterprise | 100,000 | 3,000,000 |
Limits reset at midnight UTC. Check X-RateLimit-Remaining header for real-time usage.
Rate Limit Headers
| Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad Request — invalid parameters |
| 401 | Unauthorized — missing or invalid API key |
| 403 |
| Per page (max 50, default 20) |
Response: Array of divisions + meta pagination
/api/v1/divisions/:idGet division by MongoDB ObjectId
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| id | path | string | yes | MongoDB ObjectId |
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/divisions?limit=8" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
/api/v1/districts/:idGet district by ID
/api/v1/districts/division/:nameGet districts by division name
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| name | path | string | yes | Division name (e.g. Dhaka) |
/api/v1/districts/division-id/:divisionIdGet districts by division ID
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/districts/division/Dhaka" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
/api/v1/sub-districts/district/:nameGet sub-districts by district name
/api/v1/sub-districts/division/:nameGet sub-districts by division name
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/sub-districts?limit=10" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
Get thanas by sub-district name
/api/v1/thanas/district/:nameGet thanas by district name
/api/v1/thanas/division/:nameGet thanas by division name
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/thanas/district/Dhaka" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
Get unions by sub-district name
/api/v1/unions/thana/:nameGet unions by thana name
/api/v1/unions/district/:nameGet unions by district name
/api/v1/unions/division/:nameGet unions by division name
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/unions?limit=10" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
| string |
| no |
| Filter by place type (e.g. restaurant) |
| district | query | string | no | Filter by district name |
/api/v1/places/lookupSmart lookup: find the place at lat/lon from cache, or fetch from Google Places and store it for next time.
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| lat | query | number | yes | Latitude |
| lon | query | number | yes | Longitude |
| radius | query | number | no | Match radius in meters (default 60) |
Response: { place, source: "db" | "google" | "none", isNew: boolean }
/api/v1/places/searchSearch places by name
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| q | query | string | yes | Search query (min 2 chars) |
| limit | query | number | no | Max results (default 10) |
/api/v1/places/nearbyFind nearby places using geospatial query
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| lat | query | number | yes | Latitude |
| lng | query | number | yes | Longitude |
| radius | query | number | no | Radius in meters (default 1000) |
| type | query | string | no | Filter by place type |
/api/v1/places/district/:nameGet places by district name
/api/v1/places/type/:typeGet places by type
/api/v1/places/:idGet place by ID
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/places/search?q=restaurant&limit=5" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
/api/v1/geocode/searchForward geocode — search all entities by name
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| q | query | string | yes | Search query (min 2 chars) |
| limit | query | number | no | Max results (default 10) |
Response: Array of results with type, name, coordinates
/api/v1/geocode/autocompleteFast prefix search for real-time typing
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| q | query | string | yes | Search prefix |
| limit | query | number | no | Max results (default 8) |
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/geocode/reverse?lat=23.8103&lon=90.4125" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
| city |
| path |
| string |
| yes |
| City name (e.g. Chattogram) |
/api/v1/ward-zones/:idGet ward zone by ID
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/ward-zones/city/Dhaka" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
| string |
| yes |
| Destination "lat,lng" |
| via | query | string | no | Optional waypoints "lat,lng;lat,lng" |
| profile | query | string | no | driving | walking | cycling (default: driving) |
| steps | query | boolean | no | Include per-step instructions |
| alternatives | query | boolean | no | Suggest alternative routes |
| overview | query | string | no | simplified | full | false |
| geometries | query | string | no | geojson | polyline | polyline6 |
Response: distance_m, duration_s, geometry, legs[], waypoints
/api/v1/routing/routeSame as GET /routing/route but accepts an array of coordinates in the body (more than two waypoints, or coordinates that would overflow a query string).
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| coordinates | body | array | yes | Array of {lat, lng} (min 2) |
| profile | body | string | no | driving | walking | cycling |
| steps | body | boolean | no | Include per-step instructions |
| alternatives | body | boolean | no | Suggest alternative routes |
/api/v1/routing/nearestSnap a single point to the nearest road on the routing network.
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| lat | query | number | yes | Latitude |
| lng | query | number | yes | Longitude |
| profile | query | string | no | driving | walking | cycling |
/api/v1/routing/matchSnap a noisy GPS trace to the road network. Returns matched route segments.
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| coordinates | body | array | yes | Array of {lat, lng} |
| timestamps | body | array | no | Per-coordinate epoch seconds (improves quality) |
| profile | body | string | no | driving | walking | cycling |
/api/v1/routing/tableDistance / duration matrix between many coordinates (one-to-many or many-to-many).
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| coordinates | body | array | yes | Array of {lat, lng} |
| sources | body | array | no | Indices into coordinates to use as sources |
| destinations | body | array | no | Indices into coordinates to use as destinations |
| annotations | body | string | no | duration | distance | duration,distance |
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/routing/route" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
| maxMeters |
| query |
| number |
| no |
| Search radius in meters (default 200) |
Response: Road document with name, highway class, ref, length_m, GeoJSON LineString
/api/v1/roads/in-bboxList road segments overlapping a bounding-box viewport. Useful for drawing a road overlay on a map.
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| minLat | query | number | yes | Bounding box south latitude |
| minLng | query | number | yes | Bounding box west longitude |
| maxLat | query | number | yes | Bounding box north latitude |
| maxLng | query | number | yes | Bounding box east longitude |
| limit | query | number | no | Cap results (default 500, max 2000) |
| classes | query | string | no | Comma-separated highway classes filter, e.g. "motorway,primary" |
/api/v1/roads/searchFull-text search across road name + ref (e.g. "N1", "Mirpur Road").
| Param | In | Type | Req | Description |
|---|---|---|---|---|
| q | query | string | yes | Search query |
| limit | query | number | no | Cap results (default 20, max 100) |
Code Example
curl -X GET "https://rasta-mapen-server.vercel.app/api/v1/roads/nearest" \ -H "x-api-key: YOUR_API_KEY"
Sample Response
| Forbidden — insufficient permissions |
| 404 | Not Found — resource does not exist |
| 429 | Rate Limited — daily or monthly limit exceeded |
| 500 | Server Error — something went wrong |
Error Response Format
{
"success": false,
"message": "Invalid API key",
"errorMessages": [
{
"path": "x-api-key",
"message": "API key is missing or invalid"
}
]
}{
"success": false,
"message": "Validation error",
"errorMessages": [
{
"path": "lat",
"message": "Latitude is required"
},
{
"path": "lon",
"message": "Longitude is required"
}
]
}Complete reference for the Rasta Mapen Location API. All service endpoints require a valid API key via the x-api-key header.
API Info
Base URL
https://rasta-mapen-server.vercel.app/api/v1
Authentication
Header: x-api-key: YOUR_KEY
Response Format
JSON (UTF-8)
Rate Limit
500 req/day on Free plan
{
"success": true,
"data": {
"coordinates": { "lat": 23.8103, "lon": 90.4125 },
"division": {
"name": "Dhaka",
"coordinates": { "type": "Point", "lat": 23.685, "lon": 90.3563 }
},
"district": {
"name": "Dhaka",
"coordinates": { "type": "Point", "lat": 23.81, "lon": 90.41 }
},
"thana": {
"name": "Dhanmondi",
"coordinates": { "type": "Point", "lat": 23.75, "lon": 90.37 }
},
"address": "Dhanmondi, Dhaka Sadar, Dhaka, Dhaka Division"
}
}HTTP/1.1 200 OK
X-RateLimit-Limit: 500
X-RateLimit-Remaining: 423
X-RateLimit-Reset: 1712361600
---
HTTP/1.1 429 Too Many Requests
{
"success": false,
"message": "Daily limit exceeded",
"retryAfter": "2024-04-06T00:00:00Z"
}