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

  1. Get an API key from the Taira operator (or via the admin API, §5). Keys look like tk_xxxxxxxx….
  2. Send it as a header on every request: X-API-Key: tk_… (or Authorization: Bearer tk_…).
  3. 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)

ResourceURLNotes
Style documentGET /tiles/styles/west-africa.jsonPass to MapLibre as style. Sources/sprites/glyphs are included; no token needed for subresources when the key is on the style URL.
Vector tilesGET /tiles/styles/west-africa/{z}/{x}/{y}.pbfWhat the style's source points at. Cacheable; send Cache-Control back to your users.
TileJSONGET /tiles/data/west-africa.jsonTile 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).

EndpointMethodKey paramsReturns
/search?q=lagos&limit=5GETq 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.39GETlat, 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

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

7. Troubleshooting

SymptomCause / fix
401 missing API keyNo X-API-Key header / ?key= param on the request.
401 invalid or revokedKey revoked or mistyped. Get a new key.
429Rate limit; honor Retry-After, batch or cache requests.
Blank map, 200s on style but tile errorsCheck the tile URL includes the key (?key=).
502 upstream unavailableService restart in progress; retry shortly.
Search returns nothingSearch covers West Africa only; add countrycodes to disambiguate.

Taira v1 — OpenStreetMap data © OpenStreetMap contributors (ODbL). Service operated on behalf of the Taira project.