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

# Get ESG footprint

> Spend-based CO2e footprint by lane, supplier and item, with mode-shift candidates.

Key scope: read (or execute). lanes, suppliers, items and transport.lanes each carry the top `limit` rows (default 100, at most 200) with no further page; supplier_count, item_count and transport.lanes_total say how many exist



## OpenAPI

````yaml /openapi.json get /v1/inventory/esg_footprint
openapi: 3.1.0
info:
  title: InsightChain API
  version: 2.0.0
  description: 'The InsightChain API. Send your key as `Authorization: Bearer <key>`.'
  contact:
    name: InsightChain
    url: https://insightchain.ai/docs
  license:
    name: Proprietary
    url: https://insightchain.ai/terms
servers:
  - url: https://api.insightchain.ai
security: []
tags:
  - name: Data ingestion
  - name: Tariff check
  - name: Landed cost
  - name: Import taxes
  - name: Customs documents
  - name: Denied party screening
  - name: Location risk
  - name: Tariff impact and trade data
  - name: Recommendations
  - name: Orders and approval
  - name: Explanations
  - name: Alerts
  - name: Inventory
  - name: Forecast check
  - name: Disruptions
  - name: Product compliance
  - name: Product recalls
  - name: Product passports
  - name: Webhooks
  - name: Connections
  - name: Sync runs
  - name: API keys
  - name: Usage
  - name: Request log
  - name: Agent (MCP) server
paths:
  /v1/inventory/esg_footprint:
    get:
      tags:
        - Inventory
      summary: Get ESG footprint
      description: >-
        Spend-based CO2e footprint by lane, supplier and item, with mode-shift
        candidates.


        Key scope: read (or execute). lanes, suppliers, items and
        transport.lanes each carry the top `limit` rows (default 100, at most
        200) with no further page; supplier_count, item_count and
        transport.lanes_total say how many exist
      operationId: getEsgFootprint
      parameters:
        - name: window_days
          in: query
          required: false
          schema:
            type: integer
            minimum: 30
            maximum: 365
            default: 90
          description: Demand history window
        - name: item
          in: query
          required: false
          schema:
            type: string
            maxLength: 50
          description: Narrow to one item (external id)
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 100
      responses:
        '200':
          description: OK
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            X-RateLimit-Limit-Day:
              $ref: '#/components/headers/X-RateLimit-Limit-Day'
            X-RateLimit-Remaining-Day:
              $ref: '#/components/headers/X-RateLimit-Remaining-Day'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
            X-Client-Request-ID:
              $ref: '#/components/headers/X-Client-Request-ID'
            X-InsightChain-Sandbox:
              $ref: '#/components/headers/X-InsightChain-Sandbox'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data_as_of:
                    type:
                      - string
                      - 'null'
                    format: date-time
                    description: >-
                      When the organization's data was last received; null
                      before the first sync
                  demand_source:
                    $ref: '#/components/schemas/DemandSource'
                  stale:
                    type: boolean
                    description: >-
                      True when the data is more than 24 hours old, or was never
                      received
                  total_purchase_spend:
                    type: number
                  estimated_total_kg_co2e:
                    type: number
                  estimated_total_t_co2e:
                    type: number
                  transport_kg_co2e:
                    type: number
                  lanes:
                    type: array
                    items:
                      type: object
                      properties:
                        lane:
                          type: string
                          description: Origin and destination country, for example CN → US
                        origin:
                          type: string
                        destination:
                          type: string
                        spend:
                          type: number
                        estimated_kg_co2e:
                          type: number
                      required:
                        - lane
                        - origin
                        - destination
                        - spend
                        - estimated_kg_co2e
                    description: Country pairs, largest footprint first; the top `limit`
                  categories:
                    type: array
                    items:
                      type: object
                      properties:
                        category:
                          type: string
                        spend:
                          type: number
                        emission_factor_kg_per_usd:
                          type: number
                        estimated_kg_co2e:
                          type: number
                      required:
                        - category
                        - spend
                        - emission_factor_kg_per_usd
                        - estimated_kg_co2e
                  suppliers:
                    type: array
                    items:
                      type: object
                      properties:
                        external_id:
                          type: string
                        name:
                          type: string
                        spend:
                          type: number
                        estimated_kg_co2e:
                          type: number
                        share_of_footprint_pct:
                          type: number
                        share_of_spend_pct:
                          type: number
                        intensity_kg_per_usd:
                          type: number
                        category_avg_kg_per_usd:
                          type: number
                          description: >-
                            The whole organization's intensity in the same
                            categories
                        intensity_vs_category_pct:
                          type: number
                        categories:
                          type: array
                          items:
                            type: string
                        default_factor_spend_pct:
                          type: number
                          description: >-
                            Share of this spend estimated with the default
                            factor (no usable category)
                        country:
                          type:
                            - string
                            - 'null'
                        items:
                          type: integer
                          description: Items bought from the supplier
                      required:
                        - external_id
                        - name
                        - spend
                        - estimated_kg_co2e
                        - share_of_footprint_pct
                        - share_of_spend_pct
                        - intensity_kg_per_usd
                        - category_avg_kg_per_usd
                        - intensity_vs_category_pct
                        - categories
                        - default_factor_spend_pct
                        - country
                        - items
                    description: Largest footprint first; the top `limit`
                  supplier_count:
                    type: integer
                    description: Suppliers in all
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        external_id:
                          type: string
                        name:
                          type: string
                        spend:
                          type: number
                        estimated_kg_co2e:
                          type: number
                        share_of_footprint_pct:
                          type: number
                        share_of_spend_pct:
                          type: number
                        intensity_kg_per_usd:
                          type: number
                        category_avg_kg_per_usd:
                          type: number
                          description: >-
                            The whole organization's intensity in the same
                            categories
                        intensity_vs_category_pct:
                          type: number
                        categories:
                          type: array
                          items:
                            type: string
                        default_factor_spend_pct:
                          type: number
                          description: >-
                            Share of this spend estimated with the default
                            factor (no usable category)
                        description:
                          type:
                            - string
                            - 'null'
                        category:
                          type:
                            - string
                            - 'null'
                        suppliers:
                          type: integer
                          description: Suppliers of the item
                      required:
                        - external_id
                        - name
                        - spend
                        - estimated_kg_co2e
                        - share_of_footprint_pct
                        - share_of_spend_pct
                        - intensity_kg_per_usd
                        - category_avg_kg_per_usd
                        - intensity_vs_category_pct
                        - categories
                        - default_factor_spend_pct
                        - description
                        - category
                        - suppliers
                    description: Largest footprint first; the top `limit`
                  item_count:
                    type: integer
                    description: Items in all
                  transport:
                    type: object
                    properties:
                      by_mode:
                        type: array
                        items:
                          type: object
                          properties:
                            mode:
                              type: string
                              enum:
                                - ocean
                                - air
                                - road
                                - rail
                                - unknown
                            lanes:
                              type: integer
                            shipped_mass_kg:
                              type: number
                            tonne_km:
                              type: number
                            estimated_kg_co2e:
                              type: number
                            share_of_transport_pct:
                              type: number
                          required:
                            - mode
                            - lanes
                            - shipped_mass_kg
                            - tonne_km
                            - estimated_kg_co2e
                            - share_of_transport_pct
                      lanes_total:
                        type: integer
                      lanes_estimated:
                        type: integer
                      lanes_unknown_mode:
                        type: integer
                      lanes_without_distance:
                        type: integer
                      lanes_without_mass:
                        type: integer
                      lanes:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                            supplier:
                              type: object
                              properties:
                                id:
                                  type: string
                                  format: uuid
                                external_id:
                                  type: string
                                name:
                                  type: string
                                country:
                                  type:
                                    - string
                                    - 'null'
                              required:
                                - id
                                - external_id
                                - name
                                - country
                            location:
                              type: object
                              properties:
                                id:
                                  type: string
                                  format: uuid
                                external_id:
                                  type: string
                                name:
                                  type: string
                                country:
                                  type:
                                    - string
                                    - 'null'
                              required:
                                - id
                                - external_id
                                - name
                                - country
                            mode:
                              type: string
                              enum:
                                - ocean
                                - air
                                - road
                                - rail
                                - unknown
                            distance_km:
                              type:
                                - number
                                - 'null'
                            transit_days_p50:
                              type:
                                - number
                                - 'null'
                            open_po_value:
                              type: number
                            cross_border:
                              type: boolean
                            shipped_mass_kg:
                              type: number
                            tonne_km:
                              type: number
                            estimated_kg_co2e:
                              type:
                                - number
                                - 'null'
                              description: >-
                                Null when the lane cannot be estimated; basis
                                says why
                            estimated_cost_usd:
                              type:
                                - number
                                - 'null'
                            basis:
                              type: string
                              enum:
                                - estimated
                                - unknown_mode
                                - no_distance
                                - no_mass
                          required:
                            - id
                            - supplier
                            - location
                            - mode
                            - distance_km
                            - transit_days_p50
                            - open_po_value
                            - cross_border
                            - shipped_mass_kg
                            - tonne_km
                            - estimated_kg_co2e
                            - estimated_cost_usd
                            - basis
                        description: Supplier-to-location lanes; the top `limit`
                    required:
                      - by_mode
                      - lanes_total
                      - lanes_estimated
                      - lanes_unknown_mode
                      - lanes_without_distance
                      - lanes_without_mass
                      - lanes
                  mode_shifts:
                    type: array
                    items:
                      $ref: '#/components/schemas/ModeShiftCandidate'
                    description: >-
                      Air lanes that could run on a slower mode, largest saving
                      first
                  engagement:
                    type: array
                    items:
                      type: object
                      properties:
                        external_id:
                          type: string
                        name:
                          type: string
                        country:
                          type:
                            - string
                            - 'null'
                        spend:
                          type: number
                        estimated_kg_co2e:
                          type: number
                        share_of_footprint_pct:
                          type: number
                        cumulative_share_pct:
                          type: number
                        passport_id:
                          type:
                            - string
                            - 'null'
                          format: uuid
                          description: >-
                            A passport of an item the supplier sells; null when
                            there is none
                      required:
                        - external_id
                        - name
                        - country
                        - spend
                        - estimated_kg_co2e
                        - share_of_footprint_pct
                        - cumulative_share_pct
                        - passport_id
                    description: >-
                      Suppliers in the top 80% of the footprint that have given
                      no material data and hold no submission link
                  trend:
                    type: object
                    properties:
                      months:
                        type: array
                        items:
                          type: object
                          properties:
                            month:
                              type: string
                              description: YYYY-MM
                            spend:
                              type: number
                            estimated_kg_co2e:
                              type: number
                            by_category:
                              type: object
                              additionalProperties:
                                type: number
                              description: 'kgCO2e by category: the top categories and OTHER'
                          required:
                            - month
                            - spend
                            - estimated_kg_co2e
                            - by_category
                      top_categories:
                        type: array
                        items:
                          type: string
                      lines_without_date:
                        type: integer
                      spend_without_date:
                        type: number
                    required:
                      - months
                      - top_categories
                      - lines_without_date
                      - spend_without_date
                    description: The last 12 months
                  coverage:
                    type: object
                    properties:
                      total_spend:
                        type: number
                      default_factor_spend:
                        type: number
                        description: >-
                          Spend estimated with the default factor (no usable
                          category)
                      default_factor_spend_pct:
                        type: number
                      uncategorised_items:
                        type: integer
                      no_destination_lines:
                        type: integer
                      no_destination_spend_pct:
                        type: number
                      no_date_lines:
                        type: integer
                      no_date_spend_pct:
                        type: number
                      mass_from_item_weight_pct:
                        type: number
                        description: Share of shipped mass taken from the item's own weight
                      lanes_total:
                        type: integer
                      lanes_unknown_mode:
                        type: integer
                      lanes_without_distance:
                        type: integer
                      lanes_without_mass:
                        type: integer
                    required:
                      - total_spend
                      - default_factor_spend
                      - default_factor_spend_pct
                      - uncategorised_items
                      - no_destination_lines
                      - no_destination_spend_pct
                      - no_date_lines
                      - no_date_spend_pct
                      - mass_from_item_weight_pct
                      - lanes_total
                      - lanes_unknown_mode
                      - lanes_without_distance
                      - lanes_without_mass
                    description: What the estimate does not cover
                  supplier_governance_flags:
                    type: array
                    items:
                      type: object
                      properties:
                        supplier:
                          type: string
                          description: Supplier external id
                        name:
                          type: string
                        country:
                          type: string
                        country_code:
                          type: string
                        risk_level:
                          type: string
                        sanctioned:
                          type: boolean
                        fatf_status:
                          type:
                            - string
                            - 'null'
                        reasons:
                          type: array
                          items:
                            type: string
                        spend:
                          type: number
                        share_of_footprint_pct:
                          type: number
                      required:
                        - supplier
                        - name
                        - country
                        - country_code
                        - risk_level
                        - sanctioned
                        - fatf_status
                        - reasons
                        - spend
                        - share_of_footprint_pct
                    description: Suppliers in a high-risk country, sanctioned first
                  methodology:
                    type: string
                  factors:
                    type: object
                    properties:
                      categories:
                        type: array
                        items:
                          type: object
                          properties:
                            category:
                              type: string
                            kg_per_usd:
                              type: number
                            source:
                              type: string
                          required:
                            - category
                            - kg_per_usd
                            - source
                      transport:
                        type: array
                        items:
                          type: object
                          properties:
                            mode:
                              type: string
                              enum:
                                - ocean
                                - air
                                - road
                                - rail
                                - unknown
                            kg_co2e_per_tonne_km:
                              type:
                                - number
                                - 'null'
                            usd_per_tonne_km:
                              type:
                                - number
                                - 'null'
                            km_per_day:
                              type:
                                - number
                                - 'null'
                            fixed_days:
                              type: number
                            source:
                              type: string
                          required:
                            - mode
                            - kg_co2e_per_tonne_km
                            - usd_per_tonne_km
                            - km_per_day
                            - fixed_days
                            - source
                      unit_mass:
                        type: array
                        items:
                          type: object
                          properties:
                            category:
                              type: string
                            kg_per_unit:
                              type: number
                            source:
                              type: string
                          required:
                            - category
                            - kg_per_unit
                            - source
                    required:
                      - categories
                      - transport
                      - unit_mass
                    description: The factors the estimate uses
                  duration_ms:
                    type: integer
                    description: Milliseconds the request took
                  request_id:
                    type: string
                    description: >-
                      Quote this when asking about the request; also the
                      X-Request-ID header
                required:
                  - data_as_of
                  - demand_source
                  - stale
                  - total_purchase_spend
                  - estimated_total_kg_co2e
                  - estimated_total_t_co2e
                  - transport_kg_co2e
                  - lanes
                  - categories
                  - suppliers
                  - supplier_count
                  - items
                  - item_count
                  - transport
                  - mode_shifts
                  - engagement
                  - trend
                  - coverage
                  - supplier_governance_flags
                  - methodology
                  - factors
                  - duration_ms
                  - request_id
              example:
                request_id: 038364d7-abe9-4c69-b18f-5b8b92e109f0
                data_as_of: null
                demand_source:
                  source: order_lines
                  history_complete: false
                  history_as_of: null
                  fallback_reason: history_not_built
                stale: true
                total_purchase_spend: 63938036.62
                estimated_total_kg_co2e: 32455519.4
                estimated_total_t_co2e: 32455.52
                transport_kg_co2e: 8640
                lanes:
                  - lane: CN → US
                    origin: CN
                    destination: US
                    spend: 4786951.02
                    estimated_kg_co2e: 2392806.76
                categories:
                  - category: SMALL_LEATHER_GOODS
                    spend: 13493586.76
                    emission_factor_kg_per_usd: 0.5
                    estimated_kg_co2e: 6746793.56
                suppliers:
                  - external_id: VEND-000001
                    name: Ho Chi Minh Leather Works 0001
                    country: PH
                    items: 14
                    spend: 999016.4
                    estimated_kg_co2e: 494471.78
                    share_of_footprint_pct: 1.5
                    share_of_spend_pct: 1.6
                    intensity_kg_per_usd: 0.495
                    category_avg_kg_per_usd: 0.519
                    intensity_vs_category_pct: -4.7
                    categories:
                      - SMALL_LEATHER_GOODS
                    default_factor_spend_pct: 56.9
                supplier_count: 203
                items:
                  - external_id: MAT-00000492
                    name: MAT-00000492
                    description: Footwear - Style 00000492
                    category: Footwear
                    suppliers: 3
                    spend: 772220.96
                    estimated_kg_co2e: 386110.48
                    share_of_footprint_pct: 1.2
                    share_of_spend_pct: 1.2
                    intensity_kg_per_usd: 0.5
                    category_avg_kg_per_usd: 0.5
                    intensity_vs_category_pct: 0
                    categories:
                      - FOOTWEAR
                    default_factor_spend_pct: 0
                item_count: 802
                transport:
                  by_mode:
                    - mode: ocean
                      lanes: 329
                      shipped_mass_kg: 180698.7
                      tonne_km: 0
                      estimated_kg_co2e: 0
                      share_of_transport_pct: 0
                  lanes_total: 348
                  lanes_estimated: 1
                  lanes_unknown_mode: 18
                  lanes_without_distance: 329
                  lanes_without_mass: 0
                  lanes:
                    - id: 72961b79-cd91-4ec3-910d-6763e1629a90
                      supplier:
                        id: a391513a-fccd-4e8e-92d4-c2e88521e6d5
                        external_id: SUP-IT-0044
                        name: Conceria Modello S.p.A.
                        country: IT
                      location:
                        id: 7ffeddbb-b3e9-4fb6-b7d7-3b7fc033d1b1
                        external_id: '1004'
                        name: Store 1004
                        country: US
                      mode: air
                      distance_km: 7200
                      transit_days_p50: 4
                      open_po_value: 0
                      cross_border: true
                      shipped_mass_kg: 2000
                      tonne_km: 14400
                      estimated_kg_co2e: 8640
                      estimated_cost_usd: 5040
                      basis: estimated
                mode_shifts:
                  - key: mode_shift:SUP-IT-0044>1004:air>ocean
                    supplier:
                      id: a391513a-fccd-4e8e-92d4-c2e88521e6d5
                      external_id: SUP-IT-0044
                      name: Conceria Modello S.p.A.
                      country: IT
                    location:
                      id: 7ffeddbb-b3e9-4fb6-b7d7-3b7fc033d1b1
                      external_id: '1004'
                      name: Store 1004
                      country: US
                    from_mode: air
                    to_mode: ocean
                    alternative: estimated
                    distance_km: 7200
                    shipped_mass_kg: 2000
                    kg_co2e_before: 8640
                    kg_co2e_after: 230.4
                    kg_co2e_saved: 8409.6
                    cost_before: 5040
                    cost_after: 144
                    cost_saved: 4896
                    transit_days_before: 4
                    transit_days_after: 15
                    transit_days_added: 11
                    priority: 69
                    reason: >-
                      Conceria Modello S.p.A. ships 2,000 kg to Store 1004 by
                      air over 7,200 km. Moving it to ocean (modelled from the
                      lane's distance) cuts a...
                    formula: >-
                      14400 t·km × (0.6 − 0.016) kgCO2e/t·km = 8410 kgCO2e
                      saved; cost × (0.35 − 0.01) $/t·km
                    recommendation_id: null
                engagement:
                  - external_id: VEND-000001
                    name: Ho Chi Minh Leather Works 0001
                    country: PH
                    spend: 999016.4
                    estimated_kg_co2e: 494471.78
                    share_of_footprint_pct: 1.5
                    cumulative_share_pct: 1.5
                    passport_id: 2f4c21b8-40c2-4252-b669-ca8818fb3c1e
                trend:
                  months:
                    - month: 2025-12
                      spend: 0
                      estimated_kg_co2e: 0
                      by_category:
                        OUTERWEAR: 0
                        SMALL_LEATHER_GOODS: 0
                  top_categories:
                    - OUTERWEAR
                  lines_without_date: 7
                  spend_without_date: 1950
                coverage:
                  total_spend: 63938036.62
                  default_factor_spend: 23724118.17
                  default_factor_spend_pct: 37.1
                  uncategorised_items: 280
                  no_destination_lines: 9
                  no_destination_spend_pct: 0.1
                  no_date_lines: 7
                  no_date_spend_pct: 0
                  mass_from_item_weight_pct: 0
                  lanes_total: 348
                  lanes_unknown_mode: 18
                  lanes_without_distance: 329
                  lanes_without_mass: 0
                supplier_governance_flags:
                  - supplier: VEND-000001
                    name: Ho Chi Minh Leather Works 0001
                    country: Philippines
                    country_code: PH
                    risk_level: ELEVATED
                    sanctioned: false
                    fatf_status: greylist
                    reasons:
                      - FATF greylist
                    spend: 999016.4
                    share_of_footprint_pct: 1.5
                methodology: >-
                  Spend-based screening estimate: estimated kgCO2e = purchase
                  spend x sector-average emission factor. Transport leg: shipped
                  mass x lane distance x a tonne-km factor per mode. Suitable
                  for hotspot identification and prioritization, not for
                  reporting measured emissions. Replace with supplier-specific
                  or activity-based data as it becomes available.
                factors:
                  categories:
                    - category: FRAGRANCE
                      kg_per_usd: 0.42
                      source: >-
                        Screening default in the range of published sector
                        averages (kgCO2e per USD, purchaser price): perfumes and
                        toiletries
                  transport:
                    - mode: ocean
                      kg_co2e_per_tonne_km: 0.016
                      usd_per_tonne_km: 0.01
                      km_per_day: 800
                      fixed_days: 6
                      source: >-
                        Published default freight intensity, well-to-wheel,
                        container vessel deep-sea; cost: indicative 2024 spot
                        rates (order of magnitude); replace with contracted
                        rates; transit: planning rule of thumb (cruise speed
                        plus port, airport or terminal handling)
                  unit_mass:
                    - category: FRAGRANCE
                      kg_per_unit: 0.35
                      source: >-
                        Screening default per unit, packaged; the item's own
                        weight (its weight_kg attribute) overrides it
                duration_ms: 78
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
        '502':
          $ref: '#/components/responses/UpstreamError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      security:
        - apiKey: []
components:
  headers:
    RateLimit-Limit:
      schema:
        type: integer
      description: Requests allowed per minute. On every answer to an accepted API key
    RateLimit-Remaining:
      schema:
        type: integer
      description: Requests left in the current minute window
    RateLimit-Reset:
      schema:
        type: integer
      description: Seconds until the minute window resets
    X-RateLimit-Limit-Day:
      schema:
        type: integer
      description: The key's daily quota
    X-RateLimit-Remaining-Day:
      schema:
        type: integer
      description: Requests left today (resets 00:00 UTC)
    X-Request-ID:
      schema:
        type: string
      description: Quote this when asking about a request
    X-Client-Request-ID:
      schema:
        type: string
      description: Your own X-Request-ID request header, echoed. Absent when you sent none
    X-InsightChain-Sandbox:
      schema:
        type: string
        enum:
          - 'true'
      description: >-
        Present, and true, on every answer to a test key: the data is the
        sandbox's
    Allow:
      schema:
        type: string
      description: The methods the path takes
    Retry-After:
      schema:
        type: integer
      description: Seconds to wait before trying again
  schemas:
    DemandSource:
      type: object
      properties:
        source:
          type: string
          enum:
            - daily_demand
            - order_lines
          description: >-
            Which demand history the answer was computed from. daily_demand: the
            daily history we keep (point of sale where a store has a feed, sales
            orders elsewhere). order_lines: your sales order lines, added up for
            this request while that history is not complete
        history_complete:
          type: boolean
          description: >-
            Whether the stored daily demand history is complete for the
            organization
        history_as_of:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Every change committed before this time is in the stored history;
            null while it is not complete
        fallback_reason:
          type:
            - string
            - 'null'
          enum:
            - history_not_built
            - history_rebuilding
            - history_lagging
            - null
          description: Why the stored history did not answer; null when it did
      required:
        - source
        - history_complete
        - history_as_of
        - fallback_reason
    ModeShiftCandidate:
      type: object
      properties:
        key:
          type: string
          description: Send it back to propose
        supplier:
          type: object
          properties:
            id:
              type: string
              format: uuid
            external_id:
              type: string
            name:
              type: string
            country:
              type:
                - string
                - 'null'
          required:
            - id
            - external_id
            - name
            - country
        location:
          type: object
          properties:
            id:
              type: string
              format: uuid
            external_id:
              type: string
            name:
              type: string
            country:
              type:
                - string
                - 'null'
          required:
            - id
            - external_id
            - name
            - country
        from_mode:
          const: air
        to_mode:
          type: string
          enum:
            - ocean
            - rail
            - road
        alternative:
          type: string
          enum:
            - existing_lane
            - estimated
          description: >-
            existing_lane: the pair already runs the other mode; estimated: the
            other mode is modelled on the lane's distance
        distance_km:
          type: number
        shipped_mass_kg:
          type: number
        kg_co2e_before:
          type: number
        kg_co2e_after:
          type: number
        kg_co2e_saved:
          type: number
        cost_before:
          type: number
        cost_after:
          type: number
        cost_saved:
          type: number
        transit_days_before:
          type:
            - number
            - 'null'
        transit_days_after:
          type:
            - number
            - 'null'
        transit_days_added:
          type:
            - number
            - 'null'
          description: 'Above 0: slower after the shift'
        priority:
          type: number
          description: 40-100, higher first
        reason:
          type: string
        formula:
          type: string
        recommendation_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            The recommendation waiting for approval; null while the candidate
            has not been sent
      required:
        - key
        - supplier
        - location
        - from_mode
        - to_mode
        - alternative
        - distance_km
        - shipped_mass_kg
        - kg_co2e_before
        - kg_co2e_after
        - kg_co2e_saved
        - cost_before
        - cost_after
        - cost_saved
        - transit_days_before
        - transit_days_after
        - transit_days_added
        - priority
        - reason
        - formula
        - recommendation_id
    Error:
      type: object
      description: The body of every non-2xx answer
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - invalid_request_error
                - authentication_error
                - permission_error
                - rate_limit_error
                - api_error
            code:
              type: string
              description: >-
                Stable machine-readable code, e.g. parameter_invalid,
                scope_missing, rate_limit_exceeded. Every code is listed at
                /docs/errors
            message:
              type: string
              description: For people; what `error` used to be as a plain string
            param:
              type:
                - string
                - 'null'
              description: The parameter the error is about, when there is one
            doc_url:
              type: string
              description: Where the code is documented
          required:
            - type
            - code
            - message
            - param
            - doc_url
        request_id:
          type: string
        details:
          type: array
          items: {}
          description: >-
            On a 400 for input with several problems: one entry per problem, a
            sentence or an object with `field` and `message`
        limit:
          type: integer
          description: 'On a 429: the limit that was reached'
        code:
          type: string
          deprecated: true
          description: 'Deprecated: use error.code'
        field:
          type: string
          deprecated: true
          description: 'Deprecated: use error.param'
      required:
        - error
        - request_id
      additionalProperties: true
  responses:
    BadRequest:
      description: >-
        Invalid input: an unknown or invalid parameter (error.param names it) or
        a body the route does not accept
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-RateLimit-Limit-Day:
          $ref: '#/components/headers/X-RateLimit-Limit-Day'
        X-RateLimit-Remaining-Day:
          $ref: '#/components/headers/X-RateLimit-Remaining-Day'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        The key lacks the scope, or the organization lacks the module or is
        suspended
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-RateLimit-Limit-Day:
          $ref: '#/components/headers/X-RateLimit-Limit-Day'
        X-RateLimit-Remaining-Day:
          $ref: '#/components/headers/X-RateLimit-Remaining-Day'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    MethodNotAllowed:
      description: The route does not take this method; Allow lists the ones it takes
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-RateLimit-Limit-Day:
          $ref: '#/components/headers/X-RateLimit-Limit-Day'
        X-RateLimit-Remaining-Day:
          $ref: '#/components/headers/X-RateLimit-Remaining-Day'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
        Allow:
          $ref: '#/components/headers/Allow'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PayloadTooLarge:
      description: >-
        The body, or the data the request would read, is larger than the route
        allows
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-RateLimit-Limit-Day:
          $ref: '#/components/headers/X-RateLimit-Limit-Day'
        X-RateLimit-Remaining-Day:
          $ref: '#/components/headers/X-RateLimit-Remaining-Day'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Per-minute or daily key limit; Retry-After is the real reset
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-RateLimit-Limit-Day:
          $ref: '#/components/headers/X-RateLimit-Limit-Day'
        X-RateLimit-Remaining-Day:
          $ref: '#/components/headers/X-RateLimit-Remaining-Day'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Internal error; quote request_id
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-RateLimit-Limit-Day:
          $ref: '#/components/headers/X-RateLimit-Limit-Day'
        X-RateLimit-Remaining-Day:
          $ref: '#/components/headers/X-RateLimit-Remaining-Day'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UpstreamError:
      description: >-
        The API could not be reached, or a service this route depends on failed.
        Try again shortly
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-RateLimit-Limit-Day:
          $ref: '#/components/headers/X-RateLimit-Limit-Day'
        X-RateLimit-Remaining-Day:
          $ref: '#/components/headers/X-RateLimit-Remaining-Day'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServiceUnavailable:
      description: The API, or this route, is not available right now
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-RateLimit-Limit-Day:
          $ref: '#/components/headers/X-RateLimit-Limit-Day'
        X-RateLimit-Remaining-Day:
          $ref: '#/components/headers/X-RateLimit-Remaining-Day'
        X-Client-Request-ID:
          $ref: '#/components/headers/X-Client-Request-ID'
        X-InsightChain-Sandbox:
          $ref: '#/components/headers/X-InsightChain-Sandbox'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        An InsightChain API key: ic_live_... for your organization, ic_test_...
        for its sandbox

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.