Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.climatifai.com/llms.txt

Use this file to discover all available pages before exploring further.

The geocode endpoint lets you search for a location by name and retrieve its geographic coordinates along with administrative metadata. It is backed by the Open-Meteo Geocoding API and is oriented toward Latin American regions. You can use it to resolve a user-entered place name into latitude/longitude before calling other endpoints such as /agri/advisor or /fires/hotspots.

Endpoint

GET api.climatifai.com/agri/geocode

Parameters

q
string
required
Location name to search. Can be a city, municipality, region, or other place name. Example: "Oaxaca", "Valle del Cauca", "Cochabamba".
count
integer
default:"5"
Maximum number of results to return. The API returns the top matches ranked by relevance.

Response

results
array
required
Array of matching locations. May be empty if no results are found.

Error codes

CodeDescription
502Upstream error from the Open-Meteo Geocoding service.
503Open-Meteo rate limit exceeded. Retry after a short back-off.

Example

curl "https://api.climatifai.com/agri/geocode?q=Oaxaca&count=3"
{
  "results": [
    {
      "name": "Oaxaca",
      "lat": 17.0667,
      "lon": -96.7167,
      "country": "Mexico",
      "admin1": "Oaxaca",
      "elevation": 1555.0,
      "population": 258008
    },
    {
      "name": "Oaxaca de Juárez",
      "lat": 17.0606,
      "lon": -96.7254,
      "country": "Mexico",
      "admin1": "Oaxaca",
      "elevation": 1531.0,
      "population": 264968
    },
    {
      "name": "San Pablo Villa de Mitla",
      "lat": 16.9247,
      "lon": -96.4019,
      "country": "Mexico",
      "admin1": "Oaxaca",
      "elevation": 1520.0,
      "population": 11102
    }
  ]
}