Skip to content

Geographic Endpoints

Endpoints for accessing geographic hierarchy data: countries, administrative divisions (Admin1, Admin2), and weather stations/locations.

Countries

List all countries

GET /countries

Returns all enabled countries with id, name, and iso2 code.

Response:

[
  { "id": 1, "name": "COLOMBIA", "iso2": "CO" },
  { "id": 2, "name": "PERU", "iso2": "PE" }
]

Get countries by name

GET /countries/by-name?name=<name>
Parameter Type Description
name string Country name to search

Admin Level 1 (Departments / States)

Get by country ID

GET /admin1/by-country-id?country_id=<id>
Parameter Type Description
country_id integer Country ID

Response:

[
  {
    "id": 1,
    "name": "Putumayo",
    "ext_id": "86",
    "country_id": 3,
    "country_name": "AMAZONIA",
    "country_iso2": "ST"
  }
]

Get by name

GET /admin1/by-name?name=<name>

Admin Level 2 (Municipalities / Districts)

Get by country ID

GET /admin2/by-country-id?country_id=<id>

Get by name

GET /admin2/by-name?name=<name>

Response:

[
  {
    "id": 1,
    "name": "Mocoa",
    "ext_id": "86001",
    "admin1_id": 1,
    "admin1_name": "Putumayo",
    "admin1_ext_id": "86",
    "country_id": 3,
    "country_name": "AMAZONIA",
    "country_iso2": "ST"
  }
]

Locations (Weather Stations)

Get by ID

GET /locations/by-id?id=<id>

Get by name

GET /locations/by-name?name=<name>

Get locations with latest monitoring data

GET /locations/by-country-ids-with-data?country_ids=<ids>&days=<days>

Returns locations with their complete admin hierarchy and latest monitoring data.

Parameter Type Description
country_ids string Comma-separated country IDs
days integer Days back for latest data (0 = no limit, max 365)

Response:

{
  "id": 1,
  "name": "CAMPUCANA",
  "ext_id": "44010030",
  "machine_name": "campucana",
  "enable": true,
  "altitude": 1400.0,
  "latitude": 1.2025,
  "longitude": -76.68083333,
  "visible": true,
  "source_id": 1,
  "source_name": "IDEAM",
  "source_type": "observational",
  "admin2_id": 1,
  "admin2_name": "Mocoa",
  "admin1_id": 1,
  "admin1_name": "Putumayo",
  "country_id": 3,
  "country_name": "AMAZONIA",
  "country_iso2": "ST",
  "latest_data": {
    "date": "1996-10-01",
    "measures": [
      {
        "measure_id": 7,
        "measure_name": "Minimum temperature",
        "measure_short_name": "tmin",
        "measure_unit": "\u00b0C",
        "value": 20.71
      }
    ]
  }
}