Skip to main content
GET
/
api
/
v1
/
sucursales
List Branch Offices
curl --request GET \
  --url https://api.example.com/api/v1/sucursales
{
  "[]": [
    {
      "id": 123,
      "codigoSucursal": "<string>",
      "nombreSucursal": "<string>",
      "direccion": "<string>",
      "ciudad": "<string>"
    }
  ]
}

Endpoint

GET /api/v1/sucursales
Retrieve a list of all branch offices (sucursales) in the system. This endpoint is useful for displaying available pickup and dropoff locations.

Response

Returns an array of branch office objects:
[]
array
Array of branch office objects
id
number
Unique branch identifier
codigoSucursal
string
Branch code (e.g., “LIM-001”)
nombreSucursal
string
Branch office name
direccion
string
Physical address
ciudad
string
City name

Example Request

curl -X GET http://localhost:8080/api/v1/sucursales

Example Response

[
  {
    "id": 1,
    "codigoSucursal": "LIM-001",
    "nombreSucursal": "Lima Centro",
    "direccion": "Av. Abancay 123",
    "ciudad": "Lima"
  },
  {
    "id": 2,
    "codigoSucursal": "LIM-002",
    "nombreSucursal": "Lima Norte",
    "direccion": "Av. Tupac Amaru 456",
    "ciudad": "Lima"
  },
  {
    "id": 3,
    "codigoSucursal": "CUS-001",
    "nombreSucursal": "Cusco Principal",
    "direccion": "Av. El Sol 456",
    "ciudad": "Cusco"
  },
  {
    "id": 4,
    "codigoSucursal": "AQP-001",
    "nombreSucursal": "Arequipa Centro",
    "direccion": "Calle Mercaderes 789",
    "ciudad": "Arequipa"
  },
  {
    "id": 5,
    "codigoSucursal": "TRU-001",
    "nombreSucursal": "Trujillo Norte",
    "direccion": "Av. España 321",
    "ciudad": "Trujillo"
  },
  {
    "id": 6,
    "codigoSucursal": "IQT-001",
    "nombreSucursal": "Iquitos Central",
    "direccion": "Jr. Próspero 654",
    "ciudad": "Iquitos"
  }
]

Get Single Branch Office

To retrieve a specific branch office by ID:
curl -X GET http://localhost:8080/api/v1/sucursales/1
Response:
{
  "id": 1,
  "codigoSucursal": "LIM-001",
  "nombreSucursal": "Lima Centro",
  "direccion": "Av. Abancay 123",
  "ciudad": "Lima"
}

Create New Branch Office

To create a new branch office:
curl -X POST http://localhost:8080/api/v1/sucursales \
  -H "Content-Type: application/json" \
  -d '{
    "codigoSucursal": "PIU-001",
    "nombreSucursal": "Piura Centro",
    "direccion": "Av. Grau 147",
    "ciudad": "Piura"
  }'
Response:
{
  "id": 7,
  "codigoSucursal": "PIU-001",
  "nombreSucursal": "Piura Centro",
  "direccion": "Av. Grau 147",
  "ciudad": "Piura"
}
Branch offices are typically pre-configured during system setup. The list endpoint is most commonly used in UI dropdowns for selecting origin and destination locations when creating shipments.

Use Cases

Shipment Creation Form

Fetch all branches to populate origin and destination dropdowns:
fetch('http://localhost:8080/api/v1/sucursales')
  .then(response => response.json())
  .then(branches => {
    // Populate origin dropdown
    const originSelect = document.getElementById('origin');
    branches.forEach(branch => {
      const option = document.createElement('option');
      option.value = branch.id;
      option.text = `${branch.nombreSucursal} - ${branch.ciudad}`;
      originSelect.appendChild(option);
    });
  });

Filter by City

To filter branches by city, process the results client-side:
const limaBranches = branches.filter(b => b.ciudad === 'Lima');
The API currently does not support filtering or pagination for branch listings. All branches are returned in a single request.

Build docs developers (and LLMs) love