Skip to main content

Create emission estimate(s) via receipt or invoice data.

Parameters
unstructured_dataobjectrequired

Data to be used to create the appropriate emission estimate.


namestring

A name to reference this calculation.


bundle_selectionarray of object

Bundle selection percentages.

The sum of all percentages must equal 100.

If not specified, the preconfigured allocation ratios are going to be used.

If, for each selection, percentage is not provided, the selection is divided equally (best effort) between bundles. percentage must be provided for all or none of the bundles.


quantity_truncenum

Selects to which precision to truncate quantities specific to carbon offsetting.

Enum:
  • g
  • kg
  • t

metadataobject

An arbitrary dictionary (key-value pairs) to store application-specific information.

Lune doesn't use this information for order processing. Its purpose is for the API clients to be able to attach arbitrary information (to an order for example) and then retrieve it.


idempotency_keystring

Account-unique identifier provided by the client.

idempotency_key has two purposes:

  1. Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
  2. Clients can use idempotency_key to reconcile estimates with entities on their system.

valuestring^[0-9]+(\.[0-9]+)?$

An amount of money (the fractional part is optional)


currencyenum

ISO 4217 3 character currency code.

Note: Lune supports most but not all currency codes.

Enum:
  • AED
  • AFN
  • ALL
  • AMD
  • ANG
  • AOA
  • ARS
  • AUD
  • AWG
  • AZN
  • BAM
  • BBD
  • BDT
  • BGN
  • BHD
  • BIF
  • BMD
  • BND
  • BOB
  • BRL
  • BSD
  • BTC
  • BTN
  • BWP
  • BYN
  • BYR
  • BZD
  • CAD
  • CDF
  • CHF
  • CLF
  • CLP
  • CNY
  • CNH
  • COP
  • CRC
  • CUC
  • CUP
  • CVE
  • CZK
  • DJF
  • DKK
  • DOP
  • DZD
  • EGP
  • ERN
  • ETB
  • EUR
  • FJD
  • FKP
  • GBP
  • GEL
  • GGP
  • GHS
  • GIP
  • GMD
  • GNF
  • GTQ
  • GYD
  • HKD
  • HNL
  • HRK
  • HTG
  • HUF
  • IDR
  • ILS
  • IMP
  • INR
  • IQD
  • IRR
  • ISK
  • JEP
  • JMD
  • JOD
  • JPY
  • KES
  • KGS
  • KHR
  • KMF
  • KPW
  • KRW
  • KWD
  • KYD
  • KZT
  • LAK
  • LBP
  • LKR
  • LRD
  • LSL
  • LTL
  • LVL
  • LYD
  • MAD
  • MDL
  • MGA
  • MKD
  • MMK
  • MNT
  • MOP
  • MRU
  • MUR
  • MVR
  • MWK
  • MXN
  • MYR
  • MZN
  • NAD
  • NGN
  • NIO
  • NOK
  • NPR
  • NZD
  • OMR
  • PAB
  • PEN
  • PGK
  • PHP
  • PKR
  • PLN
  • PYG
  • QAR
  • RON
  • RSD
  • RUB
  • RWF
  • SAR
  • SBD
  • SCR
  • SDG
  • SEK
  • SGD
  • SHP
  • SLE
  • SLL
  • SOS
  • SRD
  • STD
  • SVC
  • SYP
  • SZL
  • THB
  • TJS
  • TMT
  • TND
  • TOP
  • TRY
  • TTD
  • TWD
  • TZS
  • UAH
  • UGX
  • USD
  • UYU
  • UZS
  • VEF
  • VES
  • VND
  • VUV
  • WST
  • XAF
  • XAG
  • XAU
  • XCD
  • XDR
  • XOF
  • XPF
  • YER
  • ZAR
  • ZMK
  • ZMW
  • ZWL

merchant

dietenum

A diet followed by an individual.

High meat-eater is someone consuming over 100 grams of meat per day, medium is 50-99 grams per day and low is less than 50 grams per day. A fish eater is someone that doesn't consume meat other than fish.

Enum:
  • high_meat_eater
  • medium_meat_eater
  • low_meat_eater
  • fish_eater
  • vegetarian
  • vegan

region_fallbackenum

Controls how geographical constraints are interpreted and if a fallback is performed. For example, how fields like country_code and region are interpreted.

  • never (the default) means no fallback is performed and only emission factors that match the specified geographical area are returned.
  • always means the emission factors for related geographic areas are unconditionally included in the results.
Enum:
  • never
  • always
Returns
massobjectrequired

metadataobject

An arbitrary dictionary (key-value pairs) to store application-specific information.

Lune doesn't use this information for order processing. Its purpose is for the API clients to be able to attach arbitrary information (to an order for example) and then retrieve it.


idempotency_keystring

Account-unique identifier provided by the client.

idempotency_key has two purposes:

  1. Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
  2. Clients can use idempotency_key to reconcile estimates with entities on their system.

idstringrequired

The emission calculation unique identifier


quoterequired

requestobjectrequired

line_itemsarray of objectrequired

Line items for the transaction document estimate. At least one line item will always exist.

  • POST /estimates/transaction-documents
  • curl 'https://api.lune.co/v1/estimates/transaction-documents' \
      -H 'Authorization: Bearer <API_KEY>' \
      -H 'Content-Type: application/json' \
      -X POST \
      -d '{
        "merchant": {}
      }'
      
  • Response
  • {
      "mass": {
        "amount": "40.501",
        "unit": "t"
      },
      "idempotency_key": "5bd808a954e",
      "id": "90ng23MKvLqbkpMwMw7yMBD4wJQrV6O6",
      "quote": {
        "errors": [
          {
            "error_code": "account_suspended",
            "message": "message"
          }
        ],
        "error": {
          "error_code": "account_suspended",
          "message": "message"
        }
      },
      "request": {
        "unstructured_data": {
          "key_value": {
            "id": 123,
            "amount": {
              "value": "10",
              "currency": "EUR"
            },
            "line_items": [
              {
                "amount": "1"
              },
              {
                "amount": "9"
              }
            ]
          }
        },
        "name": "name",
        "bundle_selection": [
          {
            "bundle_id": "BmWxrvXo29eGqzA1qjANL5PwnkgaO8R3",
            "percentage": 34
          },
          {
            "bundle_id": "VndoQ0PZjGMzvYOZGwqy6kbgN1eOJx9B",
            "percentage": 66
          }
        ],
        "quantity_trunc": "t",
        "idempotency_key": "5bd808a954e",
        "value": "3.14",
        "currency": "GBP",
        "merchant": {
          "Merchant category code": {
            "name": "The Corner Store",
            "country_code": "GBR",
            "category_code": "0763"
          }
        },
        "diet": "high_meat_eater",
        "region_fallback": "never"
      },
      "line_items": [
        {
          "mass": {
            "amount": "40.501",
            "unit": "t"
          },
          "type": "transaction",
          "emission_factor": {
            "id": "ljmkOq7vXd238gAE9WALWQ8ZGVD5ExNz",
            "name": "Steel Pipe",
            "source": "exiobase",
            "source_version": "1.0",
            "publication_year": 2021,
            "numerator_unit": "t",
            "denominator_unit": "GBP",
            "created_at": "2022-09-01T00:00:00.000Z",
            "region": "region",
            "category": "category",
            "gas_emissions": {
              "co2e": "41.501",
              "co2": "30.231",
              "methane": "2.51",
              "nitrous_oxide": "4.3",
              "other": "0.93"
            }
          },
          "search_term_match": "search_term_match",
          "search_term_match_score": 1,
          "diet_factor": {
            "Diet factor": "0.6495"
          },
          "semantic_matching_model": "semantic_matching_model",
          "exchange_rate": {
            "Exchange rate": "0.2667"
          },
          "exchange_rate_date": {
            "Exchange rate date": "2024-01-01"
          },
          "country_code": "USA",
          "value": {
            "value": "3.14",
            "currency": "GBP"
          },
          "Item and category": {
            "item": "Office desks",
            "category": {
              "Category": "Furniture"
            },
            "category_code": null
          }
        }
      ]
    }