Introduction


Welcome to the documentation for PH Regions API. This part of the website intends to inform you about how to use the API.

Get Regions


Get regions route enables users to get all existing regions on the database. Technical details regarding the usage of the get regions function can be found below. Example route schema is provided for use on any project you can think of, along with a response schema.

Route Schema

https://api.phregions.eu.org/region/get

Parameters

ID Type Description Required
region_code string ID of a region. Obtained by searching for it using get regions and selecting a valid one. Provide only if you need to get a specific region data. No

Response Schema

200 OK [{ "psgc_code": "010000000", "description": "REGION I (ILOCOS REGION)", "region_code": "01" }, { "psgc_code": "020000000", "description": "REGION II (CAGAYAN VALLEY)", "region_code": "02" }]
404 Not Found { "message": "No regions found." }
500 Internal Server Error { "message": "Server error." }

Get Provinces


Get provinces route enables users to get all existing provinces that matches the region code parameter on the database. Technical details regarding the usage of the get provinces function can be found below. Example route schema is provided for use on any project you can think of, along with required parameters and a response schema.

Route Schema

https://api.phregions.eu.org/province/get?region_code={region_code}

Parameters

ID Type Description Required
region_code string ID of a region. Obtained by searching for it using get regions and selecting a valid one. Yes
province_code string ID of a province. Obtained by searching for it using get provinces and selecting a valid one. Provide only if you need to get a specific province data. No

Response Schema

200 OK [{ "psgc_code": "041000000", "description": "BATANGAS", "region_code": "04", "province_code": "0410" }, { "psgc_code": "042100000", "description": "CAVITE", "region_code": "04", "province_code": "0421" }]
200 OK without parameters { "message": "Region code not provided." }
400 Bad Request { "message": "Malformed region code input." }
404 Not Found { "message": "No provinces found." }
500 Internal Server Error { "message": "Server error." }

Get Cities


Get cities route enables users to get all existing cities that matches the province code parameter on the database. Technical details regarding the usage of the get cities function can be found below. Example route schema is provided for use on any project you can think of, along with required parameters and a response schema.

Route Schema

https://api.phregions.eu.org/city/get?province_code={province_code}

Parameters

ID Type Description Required
province_code string ID of a province. Obtained by searching for it using get provinces and selecting a valid one. Yes
city_code string ID of a city. Obtained by searching for it using get cities and selecting a valid one. Provide only if you need to get a specific city data. No

Response Schema

200 OK [{ "psgc_code": "045601000", "description": "AGDANGAN", "region_code": "04", "province_code": "0456", "city_code": "045601" }, { "psgc_code": "045602000", "description": "ALABAT", "region_code": "04", "province_code": "0456", "city_code": "045602" }]
200 OK without parameters { "message": "Province code not provided." }
400 Bad Request { "message": "Malformed province code input." }
404 Not Found { "message": "No cities found." }
500 Internal Server Error { "message": "Server error." }

Get Barangays


Get barangays route enables users to get all existing barangays that matches the city code parameter on the database. Technical details regarding the usage of the get barangays function can be found below. Example route schema is provided for use on any project you can think of, along with required parameters and a response schema.

Route Schema

https://api.phregions.eu.org/barangay/get?city_code={city_code}

Parameters

ID Type Description Required
city_code string ID of a city. Obtained by searching for it using get cities and selecting a valid one. Yes
brgy_code string ID of a barangay. Obtained by searching for it using get cities and selecting a valid one. Provide only if you need to get a specific barangay data. No

Response Schema

200 OK [{ "psgc_code": null, "description": "Adia Bitaog", "region_code": "04", "province_code": "0456", "city_code": "045619", "brgy_code": "045619001" }, { "psgc_code": null, "description": "Anonangin", "region_code": "04", "province_code": "0456", "city_code": "045619", "brgy_code": "045619002" }]
200 OK without parameters { "message": "City code not provided." }
400 Bad Request { "message": "Malformed city code input." }
404 Not Found { "message": "No barangays found." }
500 Internal Server Error { "message": "Server error." }