Skip to main content
Manage all locations (both origins and vias) through a unified endpoint. This endpoint operates on the locations table without filtering by type.
For type-specific operations, use the dedicated /api/origenes or /api/vias endpoints which filter by location_type.

GET - List All Locations

Retrieves all locations regardless of type (both “origen” and “via”).

Response

id
integer
Unique identifier for the location
name
string
Location name
country
string
Country name
region
string
Region or state (nullable)
location_type
string
Type of location: “origen” or “via”
is_active
boolean
Whether the location is active

Request Example

cURL
curl -X GET https://api.iclcotizaciones.com/api/locations \
  -H "Cookie: session=your_session_token"

Response Example

200
[
  {
    "id": 1,
    "name": "Shanghai",
    "country": "China",
    "region": "Shanghai",
    "location_type": "origen",
    "is_active": true
  },
  {
    "id": 10,
    "name": "Buenos Aires",
    "country": "Argentina",
    "region": "Buenos Aires",
    "location_type": "via",
    "is_active": true
  }
]
401
{
  "error": "No autorizado"
}

POST - Create Location

Creates a new location of any type. This endpoint requires admin permissions.
Admin Only: Only users with admin roles (DIRECTOR, GERENTE, ADMINISTRACION) can create locations.

Request Body

name
string
required
Location name
country
string
required
Country name
region
string
Region or state
location_type
string
required
Type of location. Must be either “origen” or “via”
is_active
boolean
default:true
Whether the location is active

Request Example

cURL
curl -X POST https://api.iclcotizaciones.com/api/locations \
  -H "Cookie: session=your_session_token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Hamburg",
    "country": "Germany",
    "region": "Hamburg",
    "location_type": "via",
    "is_active": true
  }'

Response Example

201
{
  "id": 30,
  "name": "Hamburg",
  "country": "Germany",
  "region": "Hamburg",
  "location_type": "via",
  "is_active": true
}
403
{
  "error": "No autorizado"
}

PUT - Update Location

Updates an existing location by ID. This endpoint requires admin permissions.
Admin Only: Only users with admin roles (DIRECTOR, GERENTE, ADMINISTRACION) can update locations.

Path Parameters

id
integer
required
The unique identifier of the location to update

Request Body

name
string
required
Location name
country
string
required
Country name
region
string
Region or state
location_type
string
required
Type of location. Must be either “origen” or “via”
is_active
boolean
Whether the location is active

Request Example

cURL
curl -X PUT https://api.iclcotizaciones.com/api/locations/30 \
  -H "Cookie: session=your_session_token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Hamburg Port",
    "country": "Germany",
    "region": "Hamburg",
    "location_type": "via",
    "is_active": true
  }'

Response Example

200
{
  "id": 30,
  "name": "Hamburg Port",
  "country": "Germany",
  "region": "Hamburg",
  "location_type": "via",
  "is_active": true
}
403
{
  "error": "No autorizado"
}

DELETE - Delete Location

Deletes a location by ID. This endpoint requires admin permissions.
Admin Only: Only users with admin roles (DIRECTOR, GERENTE, ADMINISTRACION) can delete locations. This is a hard delete and cannot be undone.

Path Parameters

id
integer
required
The unique identifier of the location to delete

Request Example

cURL
curl -X DELETE https://api.iclcotizaciones.com/api/locations/30 \
  -H "Cookie: session=your_session_token"

Response Example

200
{
  "ok": true
}
403
{
  "error": "No autorizado"
}

Build docs developers (and LLMs) love