API Reference
Welcome to the Locara API documentation. Our platform provides the most comprehensive and up-to-date geographical data ecosystem, matching industry standards. Access countries, states, and cities seamlessly through our deeply nested RESTful API.
The current API version is v1. The base URL for all requests is https://www.locara.online/api/v1 .
Authentication
All API requests require authentication via an API Key. Pass your key in the Authorization header using the Bearer schema.
Authorization: Bearer YOUR_API_KEYGet All Countries
/countriesRetrieve a paginated list of all countries in the database.
Query Parameters
limitnumberLimit results per page (Default: 50).
offsetnumberPagination offset.
searchstringSearch by country name or ISO.
curl --location 'https://www.locara.online/api/v1/countries' \ --header 'Authorization: Bearer <API_KEY>'
{
"success": true,
"data": [
{
"id": "1",
"name": "United States",
"iso2": "US",
"iso3": "USA",
"phonecode": "1"
}
],
"pagination": { "total": 250, "limit": 50, "offset": 0, "hasMore": true }
}Get Single Country
/countries/[ciso]Retrieve specific details of a single country by passing its ISO2 code.
Path Parameters
cisostringRequiredThe ISO2 code of the country (e.g. US, IN).
curl --location 'https://www.locara.online/api/v1/countries/US' \ --header 'Authorization: Bearer <API_KEY>'
{
"success": true,
"data": {
"id": "1",
"name": "United States",
"iso2": "US",
"iso3": "USA",
"phonecode": "1"
}
}Get States of Country
/countries/[ciso]/statesRetrieve a paginated list of all states or provinces belonging to a specific country.
Path Parameters
cisostringRequiredThe ISO2 code of the country (e.g. IN).
curl --location 'https://www.locara.online/api/v1/countries/IN/states' \ --header 'Authorization: Bearer <API_KEY>'
{
"success": true,
"data": [
{
"id": "...",
"name": "Maharashtra",
"code": "MH",
"countryId": "..."
}
],
"pagination": { "total": 36, "limit": 50, "offset": 0, "hasMore": false }
}Get Single State
/countries/[ciso]/states/[siso]Retrieve specific details of a single state within a country.
Path Parameters
cisostringRequiredThe ISO2 code of the country.
sisostringRequiredThe ISO code of the state.
curl --location 'https://www.locara.online/api/v1/countries/IN/states/MH' \ --header 'Authorization: Bearer <API_KEY>'
{
"success": true,
"data": {
"id": "...",
"name": "Maharashtra",
"code": "MH",
"countryId": "..."
}
}Get Cities of Country
/countries/[ciso]/citiesRetrieve a paginated list of all cities belonging to a specific country across all its states.
Path Parameters
cisostringRequiredThe ISO2 code of the country.
curl --location 'https://www.locara.online/api/v1/countries/US/cities' \ --header 'Authorization: Bearer <API_KEY>'
{
"success": true,
"data": [
{
"id": "...",
"name": "New York City",
"stateId": "...",
"latitude": "40.7128",
"longitude": "-74.0060"
}
],
"pagination": { "total": 19500, "limit": 50, "offset": 0, "hasMore": true }
}Get Cities of State
/countries/[ciso]/states/[siso]/citiesRetrieve a paginated list of all cities belonging to a specific state.
Path Parameters
cisostringRequiredThe ISO2 code of the country.
sisostringRequiredThe ISO code of the state.
curl --location 'https://www.locara.online/api/v1/countries/US/states/CA/cities' \ --header 'Authorization: Bearer <API_KEY>'
{
"success": true,
"data": [
{
"id": "...",
"name": "Los Angeles",
"stateId": "...",
"latitude": "34.0522",
"longitude": "-118.2437"
}
],
"pagination": { "total": 1150, "limit": 50, "offset": 0, "hasMore": true }
}