Skip to main content

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.

Description

Consumptions are records of energy, fuels or activity (e.g. km driven). Emissions are calculated from them following the GHG Protocol.

Endpoints

MethodPathDescription
GET/api/v1/consumptionsList consumptions
GET/api/v1/consumptions/{id}Get a consumption
POST/api/v1/consumptionsCreate or update consumption
GET/api/v1/consumptions/dashboardConsumption dashboard

Consumption types

  • Invoices: Electricity, heat, fuels, water, waste
  • Vehicles: Fleet consumption
  • Surveys: Manual activity data

Required fields to create a consumption

  • id (UUID)
  • entityId (invoice, vehicle or survey answer)
  • categoryId (from GET /api/v1/categories)
  • startDate, endDate (ISO 8601)
  • companyId, buildingId
  • quantity, unitType (kWh, l, km, etc.)

Example

curl -X POST "https://www.manglai.io/api/v1/consumptions" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "entityId": "invoice-123",
    "categoryId": "668f3fcb-7fb0-4b65-b77d-9303c551632f",
    "startDate": "2024-01-01T00:00:00.000Z",
    "endDate": "2024-01-31T23:59:59.999Z",
    "companyId": "1b1e07a7-083d-4831-a1d2-84b6e93a1572",
    "buildingId": "7fef7760-f9e7-4de9-ae35-8c37db65e4a3",
    "quantity": 1500.5,
    "unitType": "kWh"
  }'