Introduction
Geo Data NG API provides reliable, up-to-date information on Nigerian states, local government areas (LGAs), demographics, geography, economy, and cultural insights. With easy-to-integrate endpoints, developers and businesses can access comprehensive data to enhance applications and research.
This documentation aims to provide all the information you need to work with our API.
As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile). You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).
Authenticating requests
To authenticate requests, include an Authorization
header with the value "Bearer {YOUR_AUTH_KEY}"
.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
You can retrieve your token by visiting your profile image > API token. Enter a name for the token and then click Create.
Cities and Towns
Get a Listing of Cities and Towns.
requires authentication
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/cities-or-towns" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/cities-or-towns"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/cities-or-towns';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/cities-or-towns'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"cities_or_towns": {
"current_page": 1,
"data": [
{
"id": 1,
"geoname_id": 2221794,
"name": "Sraki",
"geoname_adm1code": 27,
"geoname_adm2code": null,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "12.26623",
"longitude": "14.54377",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 2,
"geoname_id": 2222343,
"name": "Sadigo",
"geoname_adm1code": 27,
"geoname_adm2code": null,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "12.31728",
"longitude": "14.51782",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 3,
"geoname_id": 2225931,
"name": "Moudi",
"geoname_adm1code": 35,
"geoname_adm2code": null,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "10.40517",
"longitude": "13.51979",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 4,
"geoname_id": 2228406,
"name": "Mardia",
"geoname_adm1code": 27,
"geoname_adm2code": null,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "12.32781",
"longitude": "14.50458",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 5,
"geoname_id": 2233458,
"name": "Bourha Ouango",
"geoname_adm1code": 35,
"geoname_adm2code": null,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "10.27047",
"longitude": "13.4751",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 6,
"geoname_id": 2317531,
"name": "Zwabo",
"geoname_adm1code": 26,
"geoname_adm2code": 7005,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "7.35721",
"longitude": "8.69171",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 7,
"geoname_id": 2317532,
"name": "Zwabo",
"geoname_adm1code": 26,
"geoname_adm2code": 7005,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "7.29927",
"longitude": "8.68749",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 8,
"geoname_id": 2317533,
"name": "Zwabo",
"geoname_adm1code": 26,
"geoname_adm2code": 7010,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "7.01637",
"longitude": "8.83474",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 9,
"geoname_id": 2317535,
"name": "Zuzu",
"geoname_adm1code": 26,
"geoname_adm2code": 7022,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "7.21918",
"longitude": "8.92438",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 10,
"geoname_id": 2317536,
"name": "Zuyel",
"geoname_adm1code": 35,
"geoname_adm2code": 2010,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "10.78009",
"longitude": "13.48559",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 11,
"geoname_id": 2317537,
"name": "Zuwo",
"geoname_adm1code": 29,
"geoname_adm2code": 20034,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "11.74797",
"longitude": "8.20692",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 12,
"geoname_id": 2317538,
"name": "Zuwel",
"geoname_adm1code": 26,
"geoname_adm2code": 7022,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "7.06848",
"longitude": "8.93001",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 13,
"geoname_id": 2317539,
"name": "Zuwai",
"geoname_adm1code": 35,
"geoname_adm2code": 2018,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "9.96813",
"longitude": "12.35711",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 14,
"geoname_id": 2317541,
"name": "Zuwa",
"geoname_adm1code": 27,
"geoname_adm2code": 105,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "10.76512",
"longitude": "12.02198",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 15,
"geoname_id": 2317542,
"name": "Zuwa",
"geoname_adm1code": 43,
"geoname_adm2code": 35015,
"geoname_adm3code": null,
"geoname_adm4code": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "8.96721",
"longitude": "11.41116",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
}
],
"first_page_url": "https://data.test/api/cities-or-towns?page=1",
"from": 1,
"last_page": 3947,
"last_page_url": "https://data.test/api/cities-or-towns?page=3947",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=1",
"label": "1",
"active": true
},
{
"url": "https://data.test/api/cities-or-towns?page=2",
"label": "2",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=3",
"label": "3",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=4",
"label": "4",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=5",
"label": "5",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=6",
"label": "6",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=7",
"label": "7",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=8",
"label": "8",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=9",
"label": "9",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=10",
"label": "10",
"active": false
},
{
"url": null,
"label": "...",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=3946",
"label": "3946",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=3947",
"label": "3947",
"active": false
},
{
"url": "https://data.test/api/cities-or-towns?page=2",
"label": "Next »",
"active": false
}
],
"next_page_url": "https://data.test/api/cities-or-towns?page=2",
"path": "https://data.test/api/cities-or-towns",
"per_page": 15,
"prev_page_url": null,
"to": 15,
"total": 59193
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get A Specified City or Town.
requires authentication
Get a city or town identified by its _id
or name
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/cities-or-towns/Saraki" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/cities-or-towns/Saraki"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/cities-or-towns/Saraki';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/cities-or-towns/Saraki'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"city_or_town": {
"_id": 2221794,
"name": "Sraki",
"state_id": 27,
"local_government_id": null,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "12.26623",
"longitude": "14.54377"
}
}
}
Example response (404, Not found):
{
"message": "Not Found",
"data": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Countries
Get All Supported Countries
requires authentication
This endpoint returns the details for all countries supported. At the moment, it's just Nigeria. But this endpoint will eventually return pretty great data about Nigeria that could be useful
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/countries" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/countries"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/countries';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/countries'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"countries": [
{
"geoname_id": 2328926,
"name": "Nigeria",
"capital": "Abuja",
"phone_code": "234",
"iso2code": "NG",
"iso3code": "NGA",
"population": 195874740,
"latitude": null,
"longitude": null,
"currency_code": "NGN",
"currency": "Naira",
"language": "en-NG,ha,yo,ig,ff",
"gdp": null,
"flag": null,
"areasqkm": "923768",
"continent": "AF",
"tld": ".ng",
"postal_code_format": "######",
"postal_code_regex": "^(\\d{6})$",
"neighbours": null
}
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
data
object
countries
The list of countries and their respective data
Local Governments
Get A List of Nigerian Local Government Headquarters
requires authentication
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/lg-headquarters" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/lg-headquarters"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/lg-headquarters';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/lg-headquarters'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"lg_headquarters": {
"data": [
{
"_id": 2317548,
"name": "Zuru",
"state_id": 40,
"local_government_id": 521,
"country_code": "NG",
"postal_code": null,
"population": "24338",
"latitude": "11.43522",
"longitude": "5.23494"
},
{
"_id": 2317551,
"name": "Zurmi",
"state_id": 57,
"local_government_id": 814,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "12.77675",
"longitude": "6.78404"
},
{
"_id": 2317630,
"name": "Zonkwa",
"state_id": 23,
"local_government_id": 19022,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "9.78453",
"longitude": "8.29056"
},
{
"_id": 2317675,
"name": "Zing",
"state_id": 43,
"local_government_id": 35016,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "8.99064",
"longitude": "11.74763"
},
{
"_id": 2317818,
"name": "Zango",
"state_id": 24,
"local_government_id": 434,
"country_code": "NG",
"postal_code": null,
"population": "12371",
"latitude": "13.05313",
"longitude": "8.48574"
},
{
"_id": 2317897,
"name": "Zakirai",
"state_id": 29,
"local_government_id": 20016,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "12.10033",
"longitude": "8.88524"
},
{
"_id": 2318152,
"name": "Yelwa",
"state_id": 40,
"local_government_id": 520,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "10.83505",
"longitude": "4.74244"
},
{
"_id": 2318514,
"name": "Yabo",
"state_id": 51,
"local_government_id": 623,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "12.72217",
"longitude": "5.01329"
},
{
"_id": 2318554,
"name": "Wushishi",
"state_id": 31,
"local_government_id": 27025,
"country_code": "NG",
"postal_code": null,
"population": null,
"latitude": "9.73035",
"longitude": "6.07305"
},
{
"_id": 2318858,
"name": "Wurno",
"state_id": 51,
"local_government_id": 622,
"country_code": "NG",
"postal_code": null,
"population": "13087",
"latitude": "13.29048",
"longitude": "5.42373"
}
],
"links": {
"first": "https://data.test/api/lg-headquarters?page=1",
"last": "https://data.test/api/lg-headquarters?page=69",
"prev": null,
"next": "https://data.test/api/lg-headquarters?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 69,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=1",
"label": "1",
"active": true
},
{
"url": "https://data.test/api/lg-headquarters?page=2",
"label": "2",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=3",
"label": "3",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=4",
"label": "4",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=5",
"label": "5",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=6",
"label": "6",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=7",
"label": "7",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=8",
"label": "8",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=9",
"label": "9",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=10",
"label": "10",
"active": false
},
{
"url": null,
"label": "...",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=68",
"label": "68",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=69",
"label": "69",
"active": false
},
{
"url": "https://data.test/api/lg-headquarters?page=2",
"label": "Next »",
"active": false
}
],
"path": "https://data.test/api/lg-headquarters",
"per_page": 10,
"to": 10,
"total": 689
}
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get A Specified Local Government Headquarter
requires authentication
Get a local government HQ, identified by the local_government_id
or name
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/lg-headquarters/Zuru" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/lg-headquarters/Zuru"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/lg-headquarters/Zuru';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/lg-headquarters/Zuru'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"lg_headquarter": {
"_id": 2317548,
"name": "Zuru",
"state_id": 40,
"local_government_id": 521,
"country_code": "NG",
"postal_code": null,
"population": "24338",
"latitude": "11.43522",
"longitude": "5.23494"
}
}
}
Example response (404, Not found):
{
"message": "Not Found",
"data": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get All Local Governments (LGAs)
requires authentication
Returns a List of Local government areas in Nigeria
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/local-governments" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/local-governments"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/local-governments';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/local-governments'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"states": {
"current_page": 1,
"data": [
{
"id": 1,
"geoname_id": 7644922,
"geoname_adm1code": 5,
"geoname_adm2code": 25012,
"country_code": "NG",
"name": "Ikorodu",
"postal_code": null,
"population": null,
"latitude": "6.62641",
"longitude": "3.55167",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 2,
"geoname_id": 7701336,
"geoname_adm1code": 45,
"geoname_adm2code": 1001,
"country_code": "NG",
"name": "Aba North",
"postal_code": null,
"population": null,
"latitude": "5.09386",
"longitude": "7.39479",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 3,
"geoname_id": 7701374,
"geoname_adm1code": 45,
"geoname_adm2code": 1002,
"country_code": "NG",
"name": "Aba South",
"postal_code": null,
"population": null,
"latitude": "5.1",
"longitude": "7.35",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 4,
"geoname_id": 7701376,
"geoname_adm1code": 45,
"geoname_adm2code": 1005,
"country_code": "NG",
"name": "Ikwuano",
"postal_code": null,
"population": null,
"latitude": "5.43333",
"longitude": "7.56667",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 5,
"geoname_id": 7701380,
"geoname_adm1code": 45,
"geoname_adm2code": 1013,
"country_code": "NG",
"name": "Ukwa East",
"postal_code": null,
"population": null,
"latitude": "4.9",
"longitude": "7.36667",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 6,
"geoname_id": 7701381,
"geoname_adm1code": 21,
"geoname_adm2code": 3004,
"country_code": "NG",
"name": "Esit Eket",
"postal_code": null,
"population": null,
"latitude": "4.63086",
"longitude": "8.07058",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 7,
"geoname_id": 7701382,
"geoname_adm1code": 21,
"geoname_adm2code": 3018,
"country_code": "NG",
"name": "Mkpat Enin",
"postal_code": null,
"population": null,
"latitude": "4.73361",
"longitude": "7.74861",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 8,
"geoname_id": 7701383,
"geoname_adm1code": 21,
"geoname_adm2code": 3026,
"country_code": "NG",
"name": "Oruk Anam",
"postal_code": null,
"population": null,
"latitude": "4.9",
"longitude": "7.71667",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 9,
"geoname_id": 7701409,
"geoname_adm1code": 25,
"geoname_adm2code": 4002,
"country_code": "NG",
"name": "Anambra East",
"postal_code": null,
"population": null,
"latitude": "6.26667",
"longitude": "6.81667",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 10,
"geoname_id": 7701411,
"geoname_adm1code": 25,
"geoname_adm2code": 4004,
"country_code": "NG",
"name": "Anaocha",
"postal_code": null,
"population": null,
"latitude": "6.06824",
"longitude": "6.9963",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 11,
"geoname_id": 7701412,
"geoname_adm1code": 25,
"geoname_adm2code": 4005,
"country_code": "NG",
"name": "Awka North",
"postal_code": null,
"population": null,
"latitude": "6.33333",
"longitude": "7",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 12,
"geoname_id": 7701413,
"geoname_adm1code": 25,
"geoname_adm2code": 4006,
"country_code": "NG",
"name": "Awka South",
"postal_code": null,
"population": null,
"latitude": "6.20694",
"longitude": "7.06778",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 13,
"geoname_id": 7701428,
"geoname_adm1code": 29,
"geoname_adm2code": 20015,
"country_code": "NG",
"name": "Tofa",
"postal_code": null,
"population": null,
"latitude": "12.05",
"longitude": "8.26667",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 14,
"geoname_id": 7701431,
"geoname_adm1code": 41,
"geoname_adm2code": 23017,
"country_code": "NG",
"name": "Okene",
"postal_code": null,
"population": null,
"latitude": "7.48333",
"longitude": "6.21667",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 15,
"geoname_id": 7701432,
"geoname_adm1code": 31,
"geoname_adm2code": 27010,
"country_code": "NG",
"name": "Katcha",
"postal_code": null,
"population": null,
"latitude": "9.15",
"longitude": "6.23333",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 16,
"geoname_id": 7701433,
"geoname_adm1code": 31,
"geoname_adm2code": 27014,
"country_code": "NG",
"name": "Magama",
"postal_code": null,
"population": null,
"latitude": "10.46667",
"longitude": "5.05",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 17,
"geoname_id": 7701434,
"geoname_adm1code": 31,
"geoname_adm2code": 27017,
"country_code": "NG",
"name": "Mokwa",
"postal_code": null,
"population": null,
"latitude": "9.2",
"longitude": "5.33333",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 18,
"geoname_id": 7701464,
"geoname_adm1code": 31,
"geoname_adm2code": 27020,
"country_code": "NG",
"name": "Rafi",
"postal_code": null,
"population": null,
"latitude": "10.18444",
"longitude": "6.25333",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 19,
"geoname_id": 7701466,
"geoname_adm1code": 42,
"geoname_adm2code": 30007,
"country_code": "NG",
"name": "Ede North",
"postal_code": null,
"population": null,
"latitude": "7.7069",
"longitude": "4.50922",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
},
{
"id": 20,
"geoname_id": 7701468,
"geoname_adm1code": 42,
"geoname_adm2code": 30009,
"country_code": "NG",
"name": "Egbedore",
"postal_code": null,
"population": null,
"latitude": "7.81667",
"longitude": "4.43333",
"created_at": "2024-10-09T16:54:52.000000Z",
"updated_at": "2024-10-09T16:54:52.000000Z"
}
],
"first_page_url": "https://data.test/api/local-governments?page=1",
"from": 1,
"last_page": 40,
"last_page_url": "https://data.test/api/local-governments?page=40",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=1",
"label": "1",
"active": true
},
{
"url": "https://data.test/api/local-governments?page=2",
"label": "2",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=3",
"label": "3",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=4",
"label": "4",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=5",
"label": "5",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=6",
"label": "6",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=7",
"label": "7",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=8",
"label": "8",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=9",
"label": "9",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=10",
"label": "10",
"active": false
},
{
"url": null,
"label": "...",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=39",
"label": "39",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=40",
"label": "40",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=2",
"label": "Next »",
"active": false
}
],
"next_page_url": "https://data.test/api/local-governments?page=2",
"path": "https://data.test/api/local-governments",
"per_page": 20,
"prev_page_url": null,
"to": 20,
"total": 785
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get A Specified LGA
requires authentication
Returns a Local Government Area identified by its _id
or name
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/local-governments/7644922" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/local-governments/7644922"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/local-governments/7644922';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/local-governments/7644922'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"local_governments": {
"data": [
{
"_id": 7644922,
"state_id": 5,
"country_code": "NG",
"name": "Ikorodu",
"postal_code": null,
"population": null,
"latitude": "6.62641",
"longitude": "3.55167",
"get_headquarters": "https://data.test/api/lg-headquarters/355"
},
{
"_id": 7701336,
"state_id": 45,
"country_code": "NG",
"name": "Aba North",
"postal_code": null,
"population": null,
"latitude": "5.09386",
"longitude": "7.39479",
"get_headquarters": ""
},
{
"_id": 7701374,
"state_id": 45,
"country_code": "NG",
"name": "Aba South",
"postal_code": null,
"population": null,
"latitude": "5.1",
"longitude": "7.35",
"get_headquarters": "https://data.test/api/lg-headquarters/619"
},
{
"_id": 7701376,
"state_id": 45,
"country_code": "NG",
"name": "Ikwuano",
"postal_code": null,
"population": null,
"latitude": "5.43333",
"longitude": "7.56667",
"get_headquarters": "https://data.test/api/lg-headquarters/670"
},
{
"_id": 7701380,
"state_id": 45,
"country_code": "NG",
"name": "Ukwa East",
"postal_code": null,
"population": null,
"latitude": "4.9",
"longitude": "7.36667",
"get_headquarters": "https://data.test/api/lg-headquarters/579"
},
{
"_id": 7701381,
"state_id": 21,
"country_code": "NG",
"name": "Esit Eket",
"postal_code": null,
"population": null,
"latitude": "4.63086",
"longitude": "8.07058",
"get_headquarters": "https://data.test/api/lg-headquarters/23"
},
{
"_id": 7701382,
"state_id": 21,
"country_code": "NG",
"name": "Mkpat Enin",
"postal_code": null,
"population": null,
"latitude": "4.73361",
"longitude": "7.74861",
"get_headquarters": "https://data.test/api/lg-headquarters/179"
},
{
"_id": 7701383,
"state_id": 21,
"country_code": "NG",
"name": "Oruk Anam",
"postal_code": null,
"population": null,
"latitude": "4.9",
"longitude": "7.71667",
"get_headquarters": "https://data.test/api/lg-headquarters/352"
},
{
"_id": 7701409,
"state_id": 25,
"country_code": "NG",
"name": "Anambra East",
"postal_code": null,
"population": null,
"latitude": "6.26667",
"longitude": "6.81667",
"get_headquarters": "https://data.test/api/lg-headquarters/105"
},
{
"_id": 7701411,
"state_id": 25,
"country_code": "NG",
"name": "Anaocha",
"postal_code": null,
"population": null,
"latitude": "6.06824",
"longitude": "6.9963",
"get_headquarters": "https://data.test/api/lg-headquarters/186"
}
],
"links": {
"first": "https://data.test/api/local-governments?page=1",
"last": "https://data.test/api/local-governments?page=79",
"prev": null,
"next": "https://data.test/api/local-governments?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 79,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=1",
"label": "1",
"active": true
},
{
"url": "https://data.test/api/local-governments?page=2",
"label": "2",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=3",
"label": "3",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=4",
"label": "4",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=5",
"label": "5",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=6",
"label": "6",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=7",
"label": "7",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=8",
"label": "8",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=9",
"label": "9",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=10",
"label": "10",
"active": false
},
{
"url": null,
"label": "...",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=78",
"label": "78",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=79",
"label": "79",
"active": false
},
{
"url": "https://data.test/api/local-governments?page=2",
"label": "Next »",
"active": false
}
],
"path": "https://data.test/api/local-governments",
"per_page": 10,
"to": 10,
"total": 785
}
}
}
}
Example response (404, Not Found):
{
"message": "Not Found",
"data": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
States
Get A Listing of State Capital/HQs .
requires authentication
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/state-headquarters" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/state-headquarters"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/state-headquarters';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/state-headquarters'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"state_headquarter": {
"current_page": 1,
"data": [
{
"id": 1,
"geoname_id": 2318044,
"geoname_adm1code": 35,
"geoname_adm2code": 2020,
"name": "Yola",
"country_code": "NG",
"postal_code": null,
"population": "96006",
"latitude": "9.20839",
"longitude": "12.48146",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 2,
"geoname_id": 2318123,
"geoname_adm1code": 52,
"geoname_adm2code": 6008,
"name": "Yenagoa",
"country_code": "NG",
"postal_code": null,
"population": "24335",
"latitude": "4.92675",
"longitude": "6.26764",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 3,
"geoname_id": 2319480,
"geoname_adm1code": 21,
"geoname_adm2code": 3031,
"name": "Uyo",
"country_code": "NG",
"postal_code": null,
"population": "436606",
"latitude": "5.05127",
"longitude": "7.9335",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 4,
"geoname_id": 2320576,
"geoname_adm1code": 45,
"geoname_adm2code": 1016,
"name": "Umuahia",
"country_code": "NG",
"postal_code": null,
"population": "264662",
"latitude": "5.52491",
"longitude": "7.49461",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 5,
"geoname_id": 2322911,
"geoname_adm1code": 51,
"geoname_adm2code": 616,
"name": "Sokoto",
"country_code": "NG",
"postal_code": null,
"population": "563861",
"latitude": "13.06269",
"longitude": "5.24322",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 6,
"geoname_id": 2324774,
"geoname_adm1code": 50,
"geoname_adm2code": 33022,
"name": "Port Harcourt",
"country_code": "NG",
"postal_code": null,
"population": "1865000",
"latitude": "4.77742",
"longitude": "7.0134",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 7,
"geoname_id": 2325330,
"geoname_adm1code": 28,
"geoname_adm2code": 17024,
"name": "Owerri",
"country_code": "NG",
"postal_code": null,
"population": "215038",
"latitude": "5.48363",
"longitude": "7.03325",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 8,
"geoname_id": 2325590,
"geoname_adm1code": 42,
"geoname_adm2code": 30030,
"name": "Osogbo",
"country_code": "NG",
"postal_code": null,
"population": "156694",
"latitude": "7.77104",
"longitude": "4.55698",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 9,
"geoname_id": 2330100,
"geoname_adm1code": 31,
"geoname_adm2code": 27006,
"name": "Minna",
"country_code": "NG",
"postal_code": null,
"population": "291905",
"latitude": "9.61524",
"longitude": "6.54776",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 10,
"geoname_id": 2331140,
"geoname_adm1code": 26,
"geoname_adm2code": 7013,
"name": "Makurdi",
"country_code": "NG",
"postal_code": null,
"population": "292645",
"latitude": "7.73375",
"longitude": "8.52139",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 11,
"geoname_id": 2331447,
"geoname_adm1code": 27,
"geoname_adm2code": 124,
"name": "Maiduguri",
"country_code": "NG",
"postal_code": null,
"population": "758700",
"latitude": "11.84692",
"longitude": "13.15712",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 12,
"geoname_id": 2331939,
"geoname_adm1code": 41,
"geoname_adm2code": 23012,
"name": "Lokoja",
"country_code": "NG",
"postal_code": null,
"population": "60579",
"latitude": "7.79688",
"longitude": "6.74048",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 13,
"geoname_id": 2332515,
"geoname_adm1code": 56,
"geoname_adm2code": 26008,
"name": "Lafia",
"country_code": "NG",
"postal_code": null,
"population": "127236",
"latitude": "8.4939",
"longitude": "8.51532",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 14,
"geoname_id": 2334802,
"geoname_adm1code": 24,
"geoname_adm2code": 421,
"name": "Katsina",
"country_code": "NG",
"postal_code": null,
"population": "432149",
"latitude": "12.99082",
"longitude": "7.60177",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
{
"id": 15,
"geoname_id": 2335204,
"geoname_adm1code": 29,
"geoname_adm2code": 20043,
"name": "Kano",
"country_code": "NG",
"postal_code": null,
"population": "4103000",
"latitude": "12.00012",
"longitude": "8.51672",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
}
],
"first_page_url": "https://data.test/api/state-headquarters?page=1",
"from": 1,
"last_page": 3,
"last_page_url": "https://data.test/api/state-headquarters?page=3",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://data.test/api/state-headquarters?page=1",
"label": "1",
"active": true
},
{
"url": "https://data.test/api/state-headquarters?page=2",
"label": "2",
"active": false
},
{
"url": "https://data.test/api/state-headquarters?page=3",
"label": "3",
"active": false
},
{
"url": "https://data.test/api/state-headquarters?page=2",
"label": "Next »",
"active": false
}
],
"next_page_url": "https://data.test/api/state-headquarters?page=2",
"path": "https://data.test/api/state-headquarters",
"per_page": 15,
"prev_page_url": null,
"to": 15,
"total": 37
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get A Specified State Capital
requires authentication
Get a state capital identified by the state_id
or name
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/state-headquarters/eum" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/state-headquarters/eum"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/state-headquarters/eum';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/state-headquarters/eum'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"state_headquarter": {
"geoname_id": 2353099,
"state_id": 53,
"local_government_id": 11004,
"name": "Abakaliki",
"country_code": "NG",
"population": "134102",
"postal_code": null,
"latitude": "6.32485",
"longitude": "8.11368"
}
}
}
Example response (404, Not found):
{
"message": "Not Found",
"data": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get All Nigerian States
requires authentication
Returns all the states or regions (geoname ADM1) in Nigeria
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/states" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/states"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/states';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/states'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"states": {
"data": [
{
"_id": 2322907,
"geoname_adm1code": 51,
"name": "Sokoto State",
"iso2code": null,
"country_code": "NG",
"population": 4244399,
"postal_code": null,
"latitude": "13.08333",
"longitude": "5.25",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/5"
},
{
"_id": 2324433,
"geoname_adm1code": 50,
"name": "Rivers State",
"iso2code": null,
"country_code": "NG",
"population": 6689087,
"postal_code": null,
"latitude": "4.74974",
"longitude": "6.82766",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/6"
},
{
"_id": 2324828,
"geoname_adm1code": 49,
"name": "Plateau State",
"iso2code": null,
"country_code": "NG",
"population": 3553440,
"postal_code": null,
"latitude": "9.16667",
"longitude": "9.75",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/17"
},
{
"_id": 2325190,
"geoname_adm1code": 32,
"name": "Oyo State",
"iso2code": null,
"country_code": "NG",
"population": 6617720,
"postal_code": null,
"latitude": "8",
"longitude": "4",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/21"
},
{
"_id": 2326168,
"geoname_adm1code": 48,
"name": "Ondo State",
"iso2code": null,
"country_code": "NG",
"population": 4011407,
"postal_code": null,
"latitude": "7.16667",
"longitude": "5.08333",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/33"
},
{
"_id": 2327546,
"geoname_adm1code": 16,
"name": "Ogun State",
"iso2code": null,
"country_code": "NG",
"population": 4054272,
"postal_code": null,
"latitude": "7",
"longitude": "3.58333",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/35"
},
{
"_id": 2328925,
"geoname_adm1code": 31,
"name": "Niger State",
"iso2code": null,
"country_code": "NG",
"population": 4082558,
"postal_code": null,
"latitude": "10",
"longitude": "6",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/9"
},
{
"_id": 2332453,
"geoname_adm1code": 5,
"name": "Lagos State",
"iso2code": null,
"country_code": "NG",
"population": 10601345,
"postal_code": null,
"latitude": "6.53774",
"longitude": "3.3522",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/20"
},
{
"_id": 2332785,
"geoname_adm1code": 30,
"name": "Kwara State",
"iso2code": null,
"country_code": "NG",
"population": 2591555,
"postal_code": null,
"latitude": "8.5",
"longitude": "5",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/19"
},
{
"_id": 2334797,
"geoname_adm1code": 24,
"name": "Katsina State",
"iso2code": null,
"country_code": "NG",
"population": 6483429,
"postal_code": null,
"latitude": "12.25",
"longitude": "7.5",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"get_capital": "https://data.test/api/state-headquarters/14"
}
],
"links": {
"first": "https://data.test/api/states?page=1",
"last": "https://data.test/api/states?page=4",
"prev": null,
"next": "https://data.test/api/states?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 4,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://data.test/api/states?page=1",
"label": "1",
"active": true
},
{
"url": "https://data.test/api/states?page=2",
"label": "2",
"active": false
},
{
"url": "https://data.test/api/states?page=3",
"label": "3",
"active": false
},
{
"url": "https://data.test/api/states?page=4",
"label": "4",
"active": false
},
{
"url": "https://data.test/api/states?page=2",
"label": "Next »",
"active": false
}
],
"path": "https://data.test/api/states",
"per_page": 10,
"to": 10,
"total": 37
}
}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get A Specified State
requires authentication
Returns a Nigerian state identiffied by it's state_id
Example request:
curl --request GET \
--get "https://ngdata.udeh.ng/api/states/aut" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://ngdata.udeh.ng/api/states/aut"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://ngdata.udeh.ng/api/states/aut';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://ngdata.udeh.ng/api/states/aut'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Request was successful):
{
"message": "Successful request",
"data": {
"state": {
"geoname_id": 2595345,
"geoname_adm1code": 53,
"name": "Ebonyi State",
"iso2code": null,
"country_code": "NG",
"population": 3490383,
"postal_code": null,
"latitude": "6.25",
"longitude": "8.08333",
"website": null,
"nickname": null,
"per_capita_income": null,
"median_household_income": null,
"alt_names": null,
"capital": {
"id": 36,
"geoname_id": 2353099,
"geoname_adm1code": 53,
"geoname_adm2code": 11004,
"name": "Abakaliki",
"country_code": "NG",
"postal_code": null,
"population": "134102",
"latitude": "6.32485",
"longitude": "8.11368",
"created_at": "2024-10-09T16:54:53.000000Z",
"updated_at": "2024-10-09T16:54:53.000000Z"
},
"get_capital": "https://data.test/api/state-headquarters/36"
}
}
}
Example response (404, Not found):
{
"message": "Not Found",
"data": []
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.