Carbonara CO2 Scenario API

The Scenario API from Carbonara CO2 — 1 operation(s) for scenario.

Operations 1

POST /v1/scenario What-if comparison of up to 2,500 shipments #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/carbonara-co2-org:carbonara-co2-org-scenario-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

carbonara-co2-org-scenario-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Sootcase Scenario API
  version: 0.1.0
  description: Freight emissions calculator following the GLEC Framework / ISO 14083 approach. Emissions are in kg CO2e. TTW = tank-to-wheel, WTW = well-to-wheel.
  license:
    name: PolyForm Noncommercial 1.0.0
    identifier: PolyForm-Noncommercial-1.0.0
servers:
- url: https://sootcase.org
  description: 'Free test service; send your API key as ''Authorization: Bearer <key>'' (get one at https://sootcase.org)'
- url: http://localhost:8080
  description: sootcase serve
tags:
- name: Scenario
paths:
  /v1/scenario:
    post:
      summary: What-if comparison of up to 2,500 shipments
      description: 'Calculates the shipments as they are and with the plan''s changes (road_to_rail, electrify, fuel_switch, load), with the same method, and returns both totals, the difference, and per change what it affected and the sources of its values. Defaults for road_to_rail: legs over 300 km, 30% of the cargo (EU Transport White Paper 2011), rail part over 100 km in a straight line (Directive 92/106/EEC), road to and from the nearest rail terminal, and each terminal handling at GLEC v3.3''s intermodal terminal value per container. Results are scenarios, not reported emissions. Send JSON, or a shipments CSV (text/csv) with the plan as JSON in the plan query parameter.'
      parameters:
      - name: plan
        in: query
        schema:
          type: string
        description: With a text/csv body, the plan as JSON.
      - name: add_road_legs
        in: query
        schema:
          type: boolean
          default: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - plan
              - shipments
              properties:
                plan:
                  $ref: '#/components/schemas/ScenarioPlan'
                shipments:
                  type: array
                  items:
                    $ref: '#/components/schemas/Shipment'
          text/csv:
            schema:
              type: string
      responses:
        '200':
          description: Comparison
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScenarioResult'
        '400':
          $ref: '#/components/responses/Error'
        '413':
          $ref: '#/components/responses/Error'
        '503':
          $ref: '#/components/responses/Busy'
        '504':
          $ref: '#/components/responses/Error'
      tags:
      - Scenario
      operationId: postV1Scenario
      x-operation-id-source: derived
components:
  responses:
    Busy:
      description: Too many requests in progress; retry after the given seconds
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
    Error:
      description: Error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
  schemas:
    ScenarioPlan:
      type: object
      required:
      - changes
      properties:
        name:
          type: string
        changes:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioChange'
    Location:
      type: object
      description: Coordinates, or a code instead of them.
      properties:
        name:
          type: string
        code:
          type: string
          description: UN/LOCODE (NLRTM) or IATA airport code (CPH), used when lat and lon are not given. Find codes with GET /v1/places.
          example: NLRTM
        lat:
          type: number
        lon:
          type: number
    Shipment:
      type: object
      required:
      - legs
      description: Give weight_kg, or teu with teu_net_tonnes or container_load; teu alone uses the dataset's "average" profile (GLEC, 10 t per TEU).
      properties:
        id:
          type: string
        weight_kg:
          type: number
          exclusiveMinimum: 0
        teu:
          type: number
          exclusiveMinimum: 0
        teu_net_tonnes:
          type: number
          description: Net cargo tonnes per TEU
        container_load:
          type: string
          description: Profile name from the dataset's container_loads
        cargo_type:
          type: string
          description: Optional GLEC cargo or load category from the dataset's cargo_types (container, temperature_controlled, light, heavy, European rail commodities); picks GLEC's value for it where the leg's vehicle has one
        legs:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Leg'
        hubs:
          type: array
          items:
            $ref: '#/components/schemas/HubStop'
        add_road_legs:
          type: boolean
          default: true
          description: 'Add road legs where the trip doesn''t join up: across a gap of more than 5 km between one leg''s end and the next leg''s start, and to or from a port or rail terminal when a sea, rail or inland waterway leg starts or ends off its network (the leg is moved there). Added and moved legs are marked in the result. When false, gaps and inland sea ends are only warnings.

            '
    ScenarioResult:
      type: object
      properties:
        plan:
          type: string
        label:
          type: string
        base:
          $ref: '#/components/schemas/ScenarioTotals'
        scenario:
          $ref: '#/components/schemas/ScenarioTotals'
        diff_kg:
          type: number
          description: Scenario minus base
          WTW: null
        diff_pct:
          type: number
        failed:
          type: integer
        changes:
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/ScenarioChange'
            - type: object
              properties:
                shipments_affected:
                  type: integer
                legs_affected:
                  type: integer
                sources:
                  type: array
                  items:
                    type: string
        shipments:
          type: array
          items:
            type: object
            properties:
              shipment_id:
                type: string
              base:
                $ref: '#/components/schemas/ScenarioTotals'
              scenario:
                $ref: '#/components/schemas/ScenarioTotals'
              diff_kg:
                type: number
              notes:
                type: array
                items:
                  type: string
              error:
                type: string
              retryable:
                type: boolean
                description: 'The error is temporary (a routing service that didn''t answer): try again later'
    HubStop:
      type: object
      required:
      - hub_type
      properties:
        id:
          type: string
        hub_type:
          type: string
          example: transshipment
          description: 'GLEC v3.3 Table 3 hub types: transshipment, storage_transshipment, warehouse, liquid_bulk_terminal (add _mixed for ambient and temperature-controlled sites; per tonne), intermodal_terminal, intermodal_terminal_temperature_controlled (per container)'
        containers:
          type: number
          description: Containers handled, for per-container hub types (intermodal terminals)
    DistanceType:
      type: string
      enum:
      - sfd
      - gcd
      - actual
      description: Shortest feasible, great-circle, or actually travelled distance (GLEC / ISO 14083)
    ScenarioChange:
      type: object
      required:
      - type
      properties:
        type:
          type: string
          enum:
          - road_to_rail
          - electrify
          - fuel_switch
          - load
        vehicle_types:
          type: array
          items:
            type: string
          description: Road vehicle types the change applies to; empty means all road legs
        share:
          type: number
          exclusiveMinimum: 0
          maximum: 1
          description: Share of the cargo on each matching leg (default 0.3 for road_to_rail, else 1)
        source:
          type: string
          description: Where the given values come from (required for electrify
          and for energy_ratio other than 1): null
        min_road_km:
          type: number
          description: 'road_to_rail: road legs longer than this (default 300)'
        min_rail_km:
          type: number
          description: 'road_to_rail: rail part longer than this in a straight line (default 100)'
        rail_vehicle:
          type: string
          description: 'road_to_rail: default freight_train'
        terminal:
          type: string
          enum:
          - nearest
          - best_trip
          description: 'road_to_rail: nearest rail terminal reachable by road (default, Directive 92/106/EEC), or the best trip among the nearest'
        kwh_per_tkm:
          type: number
          description: 'electrify: kWh per tonne-km'
        country:
          type: string
          description: 'electrify: ISO 3166 alpha-3 for the grid factor'
        fuel:
          type: string
          description: 'fuel_switch: hvo, b100, biodiesel, biomethane, biomethane_lng, cng, lng, or a dataset fuel id'
        energy_ratio:
          type: number
          description: 'fuel_switch: energy per tonne-km relative to the diesel vehicle (default 1)'
        load_tonnes:
          type: number
        load_factor:
          type: number
        empty_trip_factor:
          type: number
    ScenarioTotals:
      type: object
      properties:
        ttw_kg:
          type: number
        biogenic_co2_kg:
          type: number
          description: Biogenic CO2, reported separately and not included in the totals (GLEC v3.3 p. 64)
        wtt_kg:
          type: number
        wtw_kg:
          type: number
    FuelUse:
      type: object
      required:
      - fuel
      - amount
      properties:
        fuel:
          type: string
          example: diesel
        amount:
          type: number
          description: In the fuel factor's unit
        vehicle_tonne_km:
          type: number
          description: Total tonne-km on the vehicle trip, for allocation. 0 or absent = whole trip.
        factor:
          type: object
          description: The fuel supplier's or your own emission factor, used instead of the dataset's (fuel is then just its name).
          required:
          - unit
          - wtw_kg_per_unit
          - source
          properties:
            unit:
              type: string
              example: l
            wtw_kg_per_unit:
              type: number
              exclusiveMinimum: 0
              description: Well-to-wheel kg CO2e per unit
            ttw_kg_per_unit:
              type: number
              minimum: 0
              description: Tank-to-wheel kg CO2e per unit
              part of WTW: null
            source:
              type: string
              description: Who gives the factor
              and for what: null
            biogenic_co2_kg_per_unit:
              type: number
              minimum: 0
              description: Reported apart
              not in WTW: null
    Mode:
      type: string
      enum:
      - road
      - rail
      - sea
      - air
      - inland_waterway
    OwnFactor:
      type: object
      description: The carrier's or your own intensity for a leg (primary data, ISO 14083 7.2.3), used instead of a default value.
      required:
      - wtw_g_per_tkm
      - source
      properties:
        wtw_g_per_tkm:
          type: number
          exclusiveMinimum: 0
        ttw_g_per_tkm:
          type: number
          minimum: 0
          description: Part of WTW; the rest is WTT
        source:
          type: string
          description: Who measured it
          and for what (e.g. the carrier's TOC report and year): null
        distance_basis:
          type: string
          enum:
          - sfd
          - gcd
          - actual
          description: Distance type the intensity is per tonne-km of. Absent = the leg's own distance type, so no DAF.
    Leg:
      type: object
      required:
      - mode
      properties:
        id:
          type: string
        mode:
          $ref: '#/components/schemas/Mode'
        cargo_type:
          type: string
          description: Overrides the shipment's cargo_type for this leg
        vehicle_type:
          type: string
          example: hgv
          description: Must exist in the loaded dataset; list them with GET /v1/factors
        from:
          $ref: '#/components/schemas/Location'
        to:
          $ref: '#/components/schemas/Location'
        distance_km:
          type: number
          description: Overrides computed distance when > 0
        distance_type:
          $ref: '#/components/schemas/DistanceType'
        fuel:
          $ref: '#/components/schemas/FuelUse'
        load_factor:
          type: number
          exclusiveMinimum: 0
          maximum: 1
          description: 'Load as a share of the load model''s payload (DESNZ''s average full load, e.g. 17.9 t for an artic over 33 t), not of the truck''s rated payload; switches the leg to the dataset''s load model. Give this or load_tonnes. In GLEC and EcoTransIT a load factor is a share of the rated payload, so the same value means more tonnes there: to compare, or when the weight is known, give load_tonnes.

            '
        load_tonnes:
          type: number
          exclusiveMinimum: 0
          description: 'Tonnes on the truck (all cargo, average over the loaded km); switches the leg to the load model. Up to 1.6 × the model''s payload: above its payload the model is extended linearly.

            '
        empty_trip_factor:
          type: number
          minimum: 0
          description: Empty km per loaded km (needs load_factor or load_tonnes)
        repositioning_km:
          type: number
          minimum: 0
          description: 'Trucks: km driven empty for this trip (to the pickup, or back after delivery), shared over the truck''s load like empty running (added to the empty trip factor as km per actual loaded km). Without a load, the shipment is taken as the truck''s whole load.

            '
        energy_kwh_per_tkm:
          type: number
          exclusiveMinimum: 0
          description: Electricity per tonne-km; with country, switches the leg to the energy method
        country:
          type: string
          description: ISO 3166-1 alpha-3 country whose grid powers the leg, e.g. DNK
        own_factor:
          $ref: '#/components/schemas/OwnFactor'