Skip to main content

Overview

The location APIs provide hierarchical geographic data for Peru, allowing you to fetch departments, provinces (filtered by department), and districts (filtered by province).

Get Departments

GET /configuraciones/getDepartamentos

Response

Returns an array of department objects.
data
array
{
  "data": [
    {
      "id": 1,
      "departamento": "Lima"
    },
    {
      "id": 2,
      "departamento": "Arequipa"
    },
    {
      "id": 3,
      "departamento": "Cusco"
    }
  ]
}
Source: lib/models/department.dart:10 - Model definition shows the structure with id and departamento fields.

Usage Flow

The location APIs follow a hierarchical pattern:
  1. First, call getDepartamentos to get all available departments
  2. Second, use a department ID to call getProvincias for provinces within that department
  3. Third, use a province ID to call getDistritos for districts within that province
This hierarchy is commonly used in address forms and location-based filtering throughout the application.

Build docs developers (and LLMs) love