Creates a new consumption record or updates an existing one. For more information and see how to use this endpoint, see: https://manglai.notion.site/Consumptions-2af89a8b970b806e8359e8446b67f32e
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Consumption data to be inserted or updated
Unique identifier (UUID) for the consumption record
"550e8400-e29b-41d4-a716-446655440000"
Foreign key reference to the source entity (UUID): - For invoices: invoice ID from GET /api/v1/invoices - For vehicles: vehicle ID from GET /api/v1/vehicles?companyId={companyId}. The vehicle must exist and be available during the consumption period. - For surveys: survey answer ID
"invoice-123-abc"
GHG Protocol category ID (UUID). Call GET /api/v1/categories?level=subcategory to obtain the list and send the selected id. - Vehicle categories: LAND_TRANSPORTATION, AIR_TRANSPORTATION, MARITIME_TRANSPORTATION, RAIL_TRANSPORTATION, FORESTRY_MACHINERY, FARM_MACHINERY, INDUSTRIAL_MACHINERY
"668f3fcb-7fb0-4b65-b77d-9303c551632f"
Start date of the consumption period (ISO 8601)
"2024-01-01T00:00:00.000Z"
End date of the consumption period (ISO 8601)
"2024-01-31T23:59:59.999Z"
Company identifier (UUID). Retrieve it via GET /api/v1/companies and use the returned id.
"1b1e07a7-083d-4831-a1d2-84b6e93a1572"
Building identifier (UUID). Call GET /api/v1/companies/{companyId}/buildings?companyId={companyId} and use the building id. For vehicle consumptions: If the vehicle has a buildingId assigned, you can use that value. Otherwise, use a building from the company.
"7fef7760-f9e7-4de9-ae35-8c37db65e4a3"
Quantity consumed (e.g., kWh, liters, km)
1500.5
Unit of measurement for the quantity. Common values: kWh, MWh, m3, l, km, kg, mt
"kWh"
Provider/supplier code. For electricity consumptions call GET /api/v1/inputs/recommended?companyId={companyId}&types=provider&countryCode={countryCode} and send the code. Required for vehicle consumptions: If vehicle motorType is electric or hybrid, this field is mandatory.
"endesa"
Cost amount (excluding taxes if applicable)
250.75
Total cost including all charges
312.5
Currency code (ISO 4217)
"EUR"
Custom emission factor ID (UUID). Obtain it via GET /api/v1/emission-factors/custom?companyId={companyId}&entityName={entityName}&countryCode={countryCode}.
"218b2369-b86d-4517-a9f0-392d5f9e80e3"
ISO country code (e.g., ES, FR, US)
"ES"
Fuel code. For combustion consumptions call GET /api/v1/inputs/recommended?companyId={companyId}&types=fuel&countryCode={countryCode}. For gas leaks use types=gasLeak. Send the code. Required for vehicle consumptions: If vehicle motorType is combustion or hybrid, this field must be provided in extraData.fuelTypeId or extraData.fuelTypeCode.
"diesel"
Vehicle type code. For vehicle consumptions: This should be included in extraData.vehicleCategory with the vehicle category code. Vehicle types: vehicle, machine, transport
"vehicle"
Pre-calculated emission data (optional, usually system-calculated)
Additional metadata specific to the consumption type. May include: concept, gdo, renewablePercentage, wasteType, etc.
Path to attached file (e.g., invoice PDF)
"gs://bucket/company/invoice.pdf"
Efficiency data (optional). For vehicle consumptions: Can include distance and energy consumption data. Structure: { distance: number, distanceUnit: string, energy: number, energyUnit: string }
External system identifier for integration purposes
"EXT-2024-001"
Identifier to relate multiple consumptions
"batch-123"
If true, updates existing consumption by externalId instead of id. Useful for integrations that don't know internal IDs.
false
Array of category IDs (UUID) for multi-category emissions. Retrieve IDs via GET /api/v1/categories?level=subcategory.
For general consumptions (optional): Used when a consumption should generate emissions in multiple categories (e.g., electricity + energy-related-activities).
For vehicle consumptions (required): Must always include two categories: - Primary category (same as categoryId) - Related activity category:
ENERGY_RELATED_ACTIVITIES (47cb52b3-02e6-446e-bd70-e46316aa876b)FUEL_RELATED_ACTIVITIES (dd16800c-c79f-4717-9de6-07e15f4ceb64)[
"493782d7-7c17-4ed6-b75c-4fae0e254ff2",
"47cb52b3-02e6-446e-bd70-e46316aa876b"
]If true, bypasses duplicate validation (used for recalculation flows)
false
Validation metadata (timestamps, validator info)
Soft delete timestamp (null if active)
null