API Documentation

All endpoints return JSON. No authentication required. Base URL: /api

List States

GET /api/states

Returns all 36 states + FCT.

Example response
{
  "success": true,
  "data": [
    { "id": 1, "name": "Abia", "slug": "abia" },
    { "id": 2, "name": "Adamawa", "slug": "adamawa" },
    ...
  ]
}

Get State

GET /api/states/:slug

Returns a state and its LGAs.

Example response
{
  "success": true,
  "data": {
    "id": 25, "name": "Lagos", "slug": "lagos",
    "lgas": [
      { "id": 100, "name": "Eti-Osa", "slug": "eti-osa" },
      ...
    ]
  }
}

Get LGA

GET /api/lgas/:slug

Returns an LGA with its parent state and all markets.

Example response
{
  "success": true,
  "data": {
    "id": 100, "name": "Eti-Osa", "slug": "eti-osa",
    "state": { "id": 25, "name": "Lagos", "slug": "lagos" },
    "markets": [
      { "id": 1, "name": "Lekki Market", "slug": "lekki-market", "lat": 6.47, "lng": 3.59, "added_by": "ifihan" }
    ]
  }
}

List Markets

GET /api/markets?limit=20&offset=0&order=asc

Paginated list of all markets. Max limit is 100.

ParamDefaultDescription
limit20Number of results (1–100)
offset0Skip N results
orderascasc or desc by name

Search Markets

GET /api/search?q=balogun

Searches market names, LGA names, and state names. Returns up to 50 results.

Submit a Market

POST /api/contribute

Creates a GitHub issue for review. Body (JSON):

{
  "market_name": "Balogun Market",
  "state": "Lagos",
  "lga": "Lagos Island",
  "lat": 6.4541,
  "lng": 3.3947,
  "description": "One of the largest markets in Lagos",
  "contributor_name": "your-github-username"
}