Skip to main content

Update a transaction emission estimate

Path Parameters
idstringrequired

The estimate's unique identifier

Parameters
namestring

A name to reference this calculation.


valueobjectrequired


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

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.



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.

is_transactionboolean

When true, the emission estimate refers to an actual transaction for goods or services and will be included in Lune analytics and can be included in any CO2 emissions reporting.

This property exists to distinguish generic estimates, quotes or forecasts from actual transactions that have occured.

You can mark an estimate as transaction at any time.


transaction_processed_atstringdate-time

This property captures the exact date and time at which the transaction was recorded and processed.

If a value is provided when creating or updating an estimate we use the value. Otherwise defaults to the current time when creating estimates and remains unchanged when updating estimates.

This property must be formatted as RFC 3339, section 5.6 timestamp.

Examples:

  • 2023-12-01T12:30:30.000Z
  • 2023-12-01T12:30:30Z
  • 2023-12-01T11:30:30+01.00

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

emission_factorrequired

This property is null for any estimate created before 01/03/2024


search_term_matchstringrequired

The most accurate term matching the search.

The emission factor for this term is used to compute the emission estimate.


search_term_match_scorenumberfloatrequired

Populated if semantic search was used to find a match to the provided search term or category Indicates confidence in the match from 0 - 2, 0 being most confident.


diet_factorrequired

exchange_raterequired

exchange_rate_daterequired

requestobjectrequired

Parameters for estimating emissions associated with purchasing goods or services.


external_estimate_urlrequired

An external accessible URL linking to a detailed page that provides complete information about the estimate.


is_transactionrequired

transaction_processed_atrequired
  • PUT /estimates/transactions/{id}
  • curl 'https://api.lune.co/v1/estimates/transactions/Vxg3b7MoBkrNQA328Rgpnvmw1J8a6Lqj' \
      -H 'Authorization: Bearer <API_KEY>' \
      -H 'Content-Type: application/json' \
      -X PUT \
      -d '{
        "value": {
          "value": "8.99",
          "currency": "USD"
        },
        "merchant": {
          "category_code": "5818",
          "name": "Netflix",
          "country_code": "USA"
        }
      }'
      
  • Response
  • {
      "id": "04QD7GPaBx5b6Y6mJlZyONXLvrZljRE2",
      "mass": {
        "amount": "0.01388",
        "unit": "t"
      },
      "quote": {
        "estimated_quantity": "0.01388",
        "estimated_commission": "0.04",
        "estimated_total_cost": "0.38",
        "estimated_offset_cost": "0.34",
        "requested_value": null,
        "requested_quantity": "0.01388",
        "currency": "USD",
        "bundles": [
          {
            "bundle_id": "q9aKx7b6nNXMk3Yv3pD1mlW5Od2eLZE8",
            "bundle_name": "Conserving forests in Asia",
            "quantity": "0.013186",
            "unit_price": "12.8",
            "gross_unit_price": "14.22",
            "offset_cost": "0.17",
            "insufficient_available_quantity": null
          },
          {
            "bundle_id": "xWaKJL3okjD46VpJ4yGXnQNZRe1vzP0w",
            "bundle_name": "Ocean Carbon Removal",
            "quantity": "14.22",
            "unit_price": "250",
            "gross_unit_price": "277.78",
            "offset_cost": "0.17",
            "insufficient_available_quantity": null
          }
        ]
      },
      "request": {
        "value": {
          "value": "8.99",
          "currency": "USD"
        },
        "merchant": {
          "category_code": "5818",
          "name": "Netflix",
          "country_code": "USA"
        }
      },
      "diet_factor": null,
      "exchange_rate": "0.2667",
      "exchange_rate_date": "2024-01-01"
    }