Core & Batch Emission Calculation API

The Core Calculation API combines exact factor selection (emissionFactorId, activityCode), custom organizational mapping rules, and VALENQ Engine in a single endpoint. Requests can run as stateless simulations (persist: false), saved carbon ledger records (persist: true), background jobs (async: true), or blockchain-sealed records (anchorToBlockchain: true).

1. Emission Factor Selection Order

When POST /api/v1/integrations/emissions/calculate is called, the engine selects an emission factor in this order:

1. Exact Factor ID (emissionFactorId): Pins the calculation to a specific public or private emission factor UUID.

2. Activity Code (activityCode / activityId): Selects the best matching factor for the requested region, dataVersion, year, and calculationMethod (ar4, ar5, ar6).

  • Setting regionFallback: false requires an exact regional match and returns 422 no_emission_factors_found instead of falling back to macro/global regions.
  • Setting yearFallback: false restricts selection strictly to the requested year.

3. Custom Organization Rules: Applies vendor, GL account code, and keyword rules configured by your organization.

4. Manual Factor Override (manualFactorValue): Applies primary supplier EPD or metered coefficients directly.

5. VALENQ Engine Matching: Matches free-text activity descriptions (sourceType) automatically using AI.

2. Single Emission Calculation

POST /api/v1/integrations/emissions/calculate

  • Required Scope: emissions:calculate (persist: false) or emissions:write (persist: true / async: true)

#### Request Parameters

FieldTypeRequiredDefaultDescription
sourceTypestringSelector""Activity description (e.g., "Natural Gas", "Steel Hot Rolled Coil"). At least one selector field is required.
activityCode / activityIdstringSelectornullStandard activity code (e.g., "steel_section_structural").
emissionFactorIdstringSelectornullExact public or private emission factor UUID.
quantitynumberYes—Positive activity quantity.
unitstringYes—Input unit (kWh, MWh, GJ, kg, t, L, m3, tkm, pkm, EUR, USD, TRY, etc.).
regionstringNo"Global"ISO-3166 country or macro-region code ("TR", "DE", "EU", "US").
regionFallbackbooleanNotrueWhen false, rejects candidates outside the exact requested region.
yearintegerNoCurrent YearPreferred factor validity year (1990–2100).
yearFallbackbooleanNotrueWhen false, rejects candidates outside the exact requested year.
dataVersionstringNo"^2026.1"Fixed ("2026.1") or dynamic ("^2026.1") dataset release selector.
calculationMethodstringNo"ar6"IPCC 100-year GWP metric family: "ar6", "ar5", or "ar4".
distancenumberNonullTransport distance (km) when converting mass into freight tkm.
persistbooleanNotruefalse runs statelessly in-memory; true saves to the corporate carbon ledger.
asyncbooleanNofalsetrue queues the calculation for background processing.
anchorToBlockchainbooleanNofalseWhen persist: true, anchors a SHA-256 proof of the record on-chain.
externalReferenceIdstringNonullERP invoice or document ID (e.g., "SAP-INV-2026-009841").
vendorNamestringNonullSupplier or vendor name.

#### Example Request (cURL)

curl -X POST "https://api.climeqai.com/api/v1/integrations/emissions/calculate" \
  -H "X-Api-Key: sust_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "activityCode": "steel_section_structural",
    "quantity": 2500,
    "unit": "kg",
    "region": "DE",
    "regionFallback": false,
    "dataVersion": "^2026.1",
    "calculationMethod": "ar6",
    "persist": true,
    "externalReferenceId": "SAP-MM-2026-4410",
    "anchorToBlockchain": true
  }'

#### Example Response (200 OK)

{
  "success": true,
  "message": "Emission calculated synchronously and persisted to ledger.",
  "data": {
    "id": "94a8f2c1-7b3d-4e9a-8c21-6f0e5d1a3b9c",
    "scope": 3,
    "sourceType": "steel_section_structural",
    "quantity": 2500,
    "unit": "kg",
    "co2e": 4.625,
    "appliedFactor": 1.85,
    "factorSource": "Verified LCA Dataset 2025",
    "dataVersion": "2026.1",
    "confidenceScore": 1.0,
    "matchStatus": "Verified",
    "externalReferenceId": "SAP-MM-2026-4410"
  }
}

3. Batch Emission Calculation

POST /api/v1/integrations/emissions/calculate/batch

Processes up to 100 calculation items in a single HTTP call. Responses preserve the input order: if individual items fail validation or factor matching, valid items still succeed and every item is returned at its original index.

  • Required Scope: emissions:calculate (all items persist: false) or emissions:write
{
  "items": [
    { "sourceType": "Diesel", "quantity": 500, "unit": "L", "region": "TR", "persist": false },
    { "activityCode": "natural_gas_industrial", "quantity": 1200, "unit": "m3", "region": "TR", "persist": false }
  ]
}

#### Example Batch Response

{
  "success": true,
  "message": "Batch emission calculation completed (2/2 succeeded).",
  "data": {
    "totalItems": 2,
    "succeededCount": 2,
    "failedCount": 0,
    "totalCO2eTons": 3.764,
    "totalCO2eKg": 3764.0,
    "results": [
      { "index": 0, "success": true, "message": "Stateless emission calculation completed synchronously (persist=false).", "data": { "scope": 1, "co2e": 1.34 } },
      { "index": 1, "success": true, "message": "Stateless emission calculation completed synchronously (persist=false).", "data": { "scope": 1, "co2e": 2.424 } }
    ]
  }
}

4. Get Emission Record

GET /api/v1/integrations/emissions/{id}

  • Required Scope: emissions:read
  • Returns full details for a saved emission record, including matchStatus (Pending, Autonomous, Verified), gas breakdown (CO₂, CH₄, N₂O), sourceTrailJson calculation history, factorValueMasked license status, and blockchainProof (txHash, blockNumber, payloadHash).

Platform Guide & Technical Documents