> ## Documentation Index
> Fetch the complete documentation index at: https://developers.manglai.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Emisiones logísticas GLEC / ISO 14083

> Registra servicios de transporte y calcula la huella logística según el estándar GLEC e ISO 14083

Manglai calcula las emisiones de tus operaciones logísticas siguiendo el estándar **GLEC Framework** e **ISO 14083**, el marco de referencia internacional para la huella de carbono del transporte de mercancías.

Puedes registrar servicios con vehículos propios (flota interna), vehículos de terceros o clasificaciones genéricas por tipo de transporte (camión, vuelo, tren, furgoneta).

## Listar servicios logísticos

`GET /api/v1/service-footprint/glec`

Obtén todos los servicios logísticos registrados en un periodo:

```bash theme={null}
curl -X GET "https://www.manglai.io/api/v1/service-footprint/glec\
?companyId=1b1e07a7-083d-4831-a1d2-84b6e93a1572\
&startDate=2024-01-01\
&endDate=2024-12-31" \
  -H "Authorization: Bearer TU_TOKEN_AQUI"
```

### Parámetros

| Parámetro    | Requerido | Descripción                                        |
| ------------ | --------- | -------------------------------------------------- |
| `companyId`  | Sí        | ID de la empresa                                   |
| `startDate`  | Sí        | Fecha de inicio del periodo (formato `YYYY-MM-DD`) |
| `endDate`    | Sí        | Fecha de fin del periodo (formato `YYYY-MM-DD`)    |
| `supplierId` | No        | Filtrar por proveedor de transporte                |
| `vehicleId`  | No        | Filtrar por vehículo concreto                      |
| `externalId` | No        | Filtrar por ID externo (referencia de tu sistema)  |

## Crear un servicio logístico

`POST /api/v1/service-footprint/glec`

Registra un servicio de transporte con uno o más tramos (acciones). Manglai calcula automáticamente las emisiones CO₂e de cada tramo siguiendo GLEC / ISO 14083.

```bash theme={null}
curl -X POST "https://www.manglai.io/api/v1/service-footprint/glec" \
  -H "Authorization: Bearer TU_TOKEN_AQUI" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "c5b87f15-33ed-4522-90eb-d23473ab911d",
    "clientId": "d0486f00-d1fc-4f96-95d3-155b038e98a7",
    "startDate": "2024-07-03",
    "endDate": "2024-07-18",
    "from": "Granada, Spain",
    "to": "Barcelona, Spain",
    "actions": [
      {
        "id": "ba7b8856-2ee7-43b4-ae42-9017a0bc273b",
        "externalId": "SHIP-001",
        "mode": "internal",
        "vehicleType": "hgv_diesel",
        "transportType": "articulated",
        "vehicleTransportSize": "40_t_gvw",
        "from": "Granada, Spain",
        "to": "Barcelona, Spain",
        "distance": "842.021",
        "load": 18000,
        "loadUnit": "kg"
      }
    ]
  }'
```

### Campos del servicio

| Campo        | Tipo     | Requerido | Descripción                              |
| ------------ | -------- | --------- | ---------------------------------------- |
| `id`         | `uuid`   | Sí        | Identificador único del servicio         |
| `clientId`   | `uuid`   | Sí        | ID del cliente o proveedor de transporte |
| `startDate`  | `date`   | Sí        | Inicio del servicio (`YYYY-MM-DD`)       |
| `endDate`    | `date`   | Sí        | Fin del servicio (`YYYY-MM-DD`)          |
| `from`       | `string` | No        | Origen del servicio                      |
| `to`         | `string` | No        | Destino del servicio                     |
| `externalId` | `string` | No        | Referencia en tu sistema externo         |

### Campos de cada tramo (action)

| Campo                  | Tipo                     | Descripción                                                    |
| ---------------------- | ------------------------ | -------------------------------------------------------------- |
| `id`                   | `uuid`                   | Identificador único del tramo                                  |
| `mode`                 | `internal` \| `external` | Flota propia o subcontratada                                   |
| `vehicleType`          | `string`                 | `hgv_diesel`, `vans`, `flight`, `train`                        |
| `transportType`        | `string`                 | `rigid`, `articulated`, `average`, `freighter`, `bellyFreight` |
| `vehicleTransportSize` | `string`                 | Tamaño del vehículo, p. ej. `40_t_gvw`                         |
| `from` / `to`          | `string`                 | Origen y destino del tramo                                     |
| `distance`             | `string`                 | Distancia en km                                                |
| `load`                 | `number`                 | Carga transportada                                             |
| `loadUnit`             | `kg` \| `mt`             | Unidad de la carga                                             |
| `vehicleId`            | `uuid`                   | ID de vehículo propio (alternativo a `vehicleType`)            |
| `energyQuantity`       | `string`                 | Consumo real de energía o combustible                          |
| `energyQuantityUnit`   | `string`                 | `l`, `kg`, `kwh`, `l/km`, `kg/km`, `kwh/km`                    |

<Tip>
  Si tienes la flota registrada en Manglai, puedes usar `vehicleId` directamente y omitir `vehicleType`, `transportType` y `vehicleTransportSize`.
</Tip>

## Más información

* [Referencia completa del endpoint Service Footprint GLEC →](/api-reference)
* [Estándar GLEC Framework](https://www.smartfreightcentre.org/en/our-programs/global-logistics-emissions-council/calculate-report-glec-framework/)
* [Autenticación →](/authentication)
