Pre-requisites
Complete the following setup steps before using this guide:Generate an API key and authenticate your account.
Set up Client Accounts to track emissions for your individual customers.
1. Gather transaction details
Basic requirements
To calculate emissions, you need the value and merchant for each transaction. You can include up to 100 transactions in a single API request. If one transaction can’t be processed, the response will include results for the other transactions, and an error for the invalid one.The request requires an array of transaction objects, each containingvalue
and merchant
fields:
Value
Specify the value of each transaction using a monetary amount and an ISO 4217 3-character currency code:
Merchant
Themerchant
object can be customised based on the type of transaction.Card transactions
For card transactions, add the category and country code to the merchant object in ISO 18245 and ISO 3166-1 alpha-3 formats, respectively.
Non-card transactions
For transactions that are not processed by card, provide a search term and a country code and Lune will figure out the rest. For the best results, addcategory
to the object.For example, if you have a transaction for a desk chair, you can provide the following merchant
object for the calculation:
Optional properties
To make full use of Lune’s emissions reporting capabilities, we recommend including the following properties for each transaction in the request:is_transaction
: Set this property totrue
for a processed transaction. If the calculation is for a quote or forecast, set it tofalse
.transaction_processed_at
: Provide this property as the date and time of processing for the transaction in RFC 3339 format. This will improve reporting accuracy.
2. Make the API request
Use the estimates/transactions/batch/ endpoint to calculate emissions for several transactions. Send aPOST
request to this endpoint to create the estimate.Remember to add the Authorization header with your generated Bearer Token, as well as a Lune Account header with the client account that this emission is being calculated for.
Sample request
The following request estimates emissions for three transactions:- First transaction: A $1200.99 USD purchase from Herman Miller.
- Second transaction: A $120.00 USD purchase from American Airlines.
- Third transaction: A $550.49 USD purchase from Hyatt Hotels.
3. Interpret the results
The response will be returned as an array of calculations for each transaction. Refer to themass
property of each object for the CO₂e estimate for each transaction.In the sample request from Step 2, the CO₂e estimates are 0.002391 tonnes for the Herman Miller purchase, 0.11448 tonnes for the American Airlines purchase, and 0.024536 tonnes for the Hyatt Hotels purchase.
id
for each of the transactions in the response for future reference. You can use this property later on for reporting, analytics, and any updates to the calculation.For details on additional properties, go to the full API reference.4. Update the estimate
If the initial estimate was for a quote or forecast, you'll need to update it once the final details are confirmed.Use the estimate’sid
with the estimates/transactions/{id} endpoint, and send a PUT
request that includes the updated transaction. Ensure that is_transaction
is set to true
. See the reference for this endpoint here.Success! You’ve successfully calculated emissions for your transactions. This brings you one step closer to climate compliance!