Taira
Hosted OpenStreetMap-based map service — display tiles + address search. You install nothing; you take an API key and point your app at this domain.
Coverage: West Africa (16 countries). Base data: OpenStreetMap, updated regularly. Endpoint: https://taira.afchdev.com
1. Quickstart
- Get an API key from the Taira operator (or via the admin API, §5). Keys look like
tk_xxxxxxxx….
- Send it as a header on every request:
X-API-Key: tk_… (or Authorization: Bearer tk_…).
- Display a map with the copy-paste example in §2, then add address search with §3.
CORS is enabled (*) so browser apps work directly. All endpoints are HTTPS. Unsupported or revoked keys get 401.
2. Map display (vector tiles)
Taira serves Mapbox Vector Tiles in the OpenMapTiles layer schema. Any MapLibre GL / Mapbox GL client works.
Minimal complete example (single HTML file, map + search box)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Taira test app</title>
<link href="https://unpkg.com/maplibre-gl@4/dist/maplibre-gl.css" rel="stylesheet">
<script src="https://unpkg.com/maplibre-gl@4/dist/maplibre-gl.js"></script>
<style> body { margin:0; } #map { width:100vw; height:100vh; }
#search { position:absolute; top:10px; left:10px; z-index:10; }
#search input { padding:8px; width:280px; font-size:14px; border:1px solid #999; border-radius:6px; }
#results { position:absolute; top:48px; left:10px; z-index:10; background:white; border:1px solid #ddd;
border-radius:6px; max-width:340px; display:none; font-size:13px; }
#results div { padding:6px 10px; cursor:pointer; border-bottom:1px solid #eee; }
</style>
</head>
<body>
<div id="search"><input id="q" placeholder="Search a place… (e.g. Lagos)"></div>
<div id="results"></div>
<div id="map"></div>
<script>
const API = "https://taira.afchdev.com";
const KEY = "YOUR_API_KEY"; // tk_…
const map = new maplibregl.Map({
container: "map",
style: API + "/tiles/styles/west-africa.json?key=" + KEY,
center: [3.39, 6.45], // Lagos; pick your area
zoom: 11
});
map.addControl(new maplibregl.NavigationControl());
const input = document.getElementById("q");
const results = document.getElementById("results");
let timer;
input.addEventListener("input", () => {
clearTimeout(timer);
timer = setTimeout(async () => {
if (input.value.length < 3) { results.style.display = "none"; return; }
const r = await fetch(API + "/search?q=" + encodeURIComponent(input.value) + "&limit=5", {
headers: { "X-API-Key": KEY }
});
const hits = await r.json();
results.innerHTML = "";
results.style.display = hits.length ? "block" : "none";
for (const hit of hits) {
const d = document.createElement("div");
d.textContent = hit.display_name;
d.onclick = () => map.jumpTo({ center: [hit.lon, hit.lat], zoom: 14 });
results.appendChild(d);
}
}, 300);
});
</script>
</body>
</html>
</html>
Style & tile endpoints (all under /tiles/, all need the key)
| Resource | URL | Notes |
| Style document | GET /tiles/styles/west-africa.json | Pass to MapLibre as style. Sources/sprites/glyphs are included; no token needed for subresources when the key is on the style URL. |
| Vector tiles | GET /tiles/styles/west-africa/{z}/{x}/{y}.pbf | What the style's source points at. Cacheable; send Cache-Control back to your users. |
| TileJSON | GET /tiles/data/west-africa.json | Tile metadata (bounds, min/max zoom). |
Key on the style URL vs header: the example appends ?key= to the style URL so MapLibre can fetch sources/sprites/glyphs without extra headers. Both ?key= and X-API-Key are accepted.
3. Address search (geocoding)
Powered by Nominatim (OpenStreetMap data). JSON only (format=jsonv2 is forced).
| Endpoint | Method | Key params | Returns |
/search?q=lagos&limit=5 | GET | q free-form; or structured: street, city, state, country, postalcode; limit ≤ 50; countrycodes=ng etc. | Array of {place_id, display_name, lat, lon, type, importance, address{…}} |
/reverse?lat=6.45&lon=3.39 | GET | lat, lon; optional zoom (1–18) | Single object with address{…} |
curl -H "X-API-Key: $TAIRA_KEY" \
"https://taira.afchdev.com/search?q=Lagos%20Nigeria&limit=5"
Search quota: 60 search requests per minute per key (tiles are counted separately at the per-key limit, §4). Exceeding it returns 429 with Retry-After — back off and retry.
4. Keys, rate limits & quotas
- One key per consumer/app. Keys are shown once at issue — store them like passwords.
- Default limit: 120 requests/minute per key (burst +30), of which geocode/search calls are capped at 60/min.
- Over-limit:
HTTP 429 + Retry-After header. No hard monthly quota in v1; sustained abuse will get a key revoked by the operator.
- Revocation is immediate (
401 after revoke).
5. Key management API (operators)
# Issue
curl -X POST https://taira.afchdev.com/admin/keys \
-H "X-Admin-Key: $ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"name": "marketplace-web", "rate_limit_per_min": 120}'
# -> {"key": "tk_…", "name": "marketplace-web"}
# List (hashes only, no secrets)
curl https://taira.afchdev.com/admin/keys -H "X-Admin-Key: $ADMIN_KEY"
# Revoke (by key_hash from the list)
curl -X DELETE https://taira.afchdev.com/admin/keys/<key_hash> \
-H "X-Admin-Key: $ADMIN_KEY"
6. Coverage & data
- Coverage: Benin, Burkina Faso, Cape Verde, Côte d'Ivoire, Gambia, Ghana, Guinea, Guinea-Bissau, Liberia, Mali, Mauritania, Niger, Nigeria, Senegal, Sierra Leone, Togo.
- Zooms: 0–14 (client-side overzoom above 14 is fine).
- Attribution: keep an "© OpenStreetMap contributors" credit on any visible map — it is an OSM license requirement, not a nicety.
- Data updates: refreshed from daily OSM diffs; see status page for the current import date.
7. Troubleshooting
| Symptom | Cause / fix |
401 missing API key | No X-API-Key header / ?key= param on the request. |
401 invalid or revoked | Key revoked or mistyped. Get a new key. |
429 | Rate limit; honor Retry-After, batch or cache requests. |
| Blank map, 200s on style but tile errors | Check the tile URL includes the key (?key=). |
502 upstream unavailable | Service restart in progress; retry shortly. |
| Search returns nothing | Search covers West Africa only; add countrycodes to disambiguate. |
Taira v1 — OpenStreetMap data © OpenStreetMap contributors (ODbL). Service operated on behalf of the Taira project.