By document
Create emission estimate(s) via receipt or invoice data.
POST
to /v1/estimates/transaction-documents
Query parameters
relative_amount_tolerance_thresholdstring (float)
Use this property to set the maximum allowed difference between the sum of line items and the total amount processed in the document.
Expressed as a decimal (e.g., 0.05 allows up to 5% difference). Set to 0 to require an exact match. Defaults 0.1 (10% difference).
Request body
unstructured_dataobjectrequired
Add unstructured JSON data representing the document to calculate its emission estimate.
key_valueobject
An arbitrary dictionary (key-value pairs).
Lune attempts to extract valuable information from here.
is_transaction_documentboolean
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
namestring
A name to reference this calculation.
bundle_selectionarray
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.
object
Maps a bundle id to an allocation ratio
bundle_idstringrequired
The bundle's unique identifier
percentageoneOf
quantity_truncstring
Selects to which precision to truncate quantities specific to carbon offsetting.
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:
- Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
- Clients can use
idempotency_key
to reconcile estimates with entities on their system.
valuestring
Pattern: ^[0-9]+(\.[0-9]+)?$
Specify the monetary value in the currency defined by the currency_code
property in the request. If no currency_code
is provided, the currency will default to that of the associated account.
currencystring
ISO 4217 3 character currency code.
Note: Lune supports most but not all currency codes.
AED
AFN
ALL
AMD
ANG
merchantoneOf
The merchant from whom the goods or services were purchased.
dietstring
Specify individual dietary preferences to improve estimates for food-related purchases.
high_meat_eater
medium_meat_eater
low_meat_eater
fish_eater
vegetarian
region_fallbackstring
Specify how geographical constraints (e.g., country_code
, region
) should be handled when matching emission factors, and if fallbacks should be used.
Defaults to never
, meaning only emission factors that exactly match the specified geography are used. No fallbacks are applied.
never
always
client_accountoneOf
Perform the estimate request on behalf of a client account.
The client account is identfied by the handle
or idempotency_key
.
The client account is created if it does not exist.
For existing client accounts, if both handle
and idempotency_key
are provided,
they must be consistent with the existing client account. Other properties are ignored.
Response
massobjectrequired
amountstringrequired
Pattern: ^[0-9]+(\.[0-9]+)?$
unitstringrequired
Unit, t
for tonne, kg
for kilogram, g
for gram, mg
for milligram
mg
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:
- Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
- Clients can use
idempotency_key
to reconcile estimates with entities on their system.
idstringrequired
The emission calculation unique identifier
quoteoneOfrequired
requestobjectrequired
unstructured_dataobjectrequired
Add unstructured JSON data representing the document to calculate its emission estimate.
key_valueobject
An arbitrary dictionary (key-value pairs).
Lune attempts to extract valuable information from here.
is_transaction_documentboolean
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
namestring
A name to reference this calculation.
bundle_selectionarray
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.
object
Maps a bundle id to an allocation ratio
bundle_idstringrequired
The bundle's unique identifier
percentageoneOf
quantity_truncstring
Selects to which precision to truncate quantities specific to carbon offsetting.
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:
- Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
- Clients can use
idempotency_key
to reconcile estimates with entities on their system.
valuestring
Pattern: ^[0-9]+(\.[0-9]+)?$
Specify the monetary value in the currency defined by the currency_code
property in the request. If no currency_code
is provided, the currency will default to that of the associated account.
currencystring
ISO 4217 3 character currency code.
Note: Lune supports most but not all currency codes.
AED
AFN
ALL
AMD
ANG
merchantoneOf
The merchant from whom the goods or services were purchased.
dietstring
Specify individual dietary preferences to improve estimates for food-related purchases.
high_meat_eater
medium_meat_eater
low_meat_eater
fish_eater
vegetarian
region_fallbackstring
Specify how geographical constraints (e.g., country_code
, region
) should be handled when matching emission factors, and if fallbacks should be used.
Defaults to never
, meaning only emission factors that exactly match the specified geography are used. No fallbacks are applied.
never
always
is_transaction_documentbooleanrequired
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)required
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
oneOf
Errors
This API operation can return the following errors:400
api_version_invalid
400
bundle_selection_ratios_invalid
400
bundle_selection_bundle_invalid
400
order_value_invalid
400
bundle_id_invalid
400
id_invalid
400
distance_invalid
400
test_account_name_update_disallowed
400
bundle_selection_ratios_invalid_format
400
address_not_found
Asynchronously create emission estimate(s) via receipt or invoice data.
POST
to /v1/estimates/transaction-documents/async
This endpoint processes requests asynchronously. Once complete, the results are sent to your configured webhook.It's recommended to include a correlation_id
to help reconcile requests with their corresponding responses.Query parameters
relative_amount_tolerance_thresholdstring (float)
Use this property to set the maximum allowed difference between the sum of line items and the total amount processed in the document.
Expressed as a decimal (e.g., 0.05 allows up to 5% difference). Set to 0 to require an exact match. Defaults 0.1 (10% difference).
Request body
unstructured_dataobjectrequired
Add unstructured JSON data representing the document to calculate its emission estimate.
key_valueobject
An arbitrary dictionary (key-value pairs).
Lune attempts to extract valuable information from here.
is_transaction_documentboolean
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
namestring
A name to reference this calculation.
bundle_selectionarray
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.
object
Maps a bundle id to an allocation ratio
bundle_idstringrequired
The bundle's unique identifier
percentageoneOf
quantity_truncstring
Selects to which precision to truncate quantities specific to carbon offsetting.
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:
- Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
- Clients can use
idempotency_key
to reconcile estimates with entities on their system.
valuestring
Pattern: ^[0-9]+(\.[0-9]+)?$
Specify the monetary value in the currency defined by the currency_code
property in the request. If no currency_code
is provided, the currency will default to that of the associated account.
currencystring
ISO 4217 3 character currency code.
Note: Lune supports most but not all currency codes.
AED
AFN
ALL
AMD
ANG
merchantoneOf
The merchant from whom the goods or services were purchased.
dietstring
Specify individual dietary preferences to improve estimates for food-related purchases.
high_meat_eater
medium_meat_eater
low_meat_eater
fish_eater
vegetarian
region_fallbackstring
Specify how geographical constraints (e.g., country_code
, region
) should be handled when matching emission factors, and if fallbacks should be used.
Defaults to never
, meaning only emission factors that exactly match the specified geography are used. No fallbacks are applied.
never
always
correlation_idstring
Provide an ID to reconcile requests and responses. This value is returned in webhook events.
Errors
This API operation can return the following errors:204
400
api_version_invalid
400
bundle_selection_ratios_invalid
400
bundle_selection_bundle_invalid
400
order_value_invalid
400
bundle_id_invalid
400
id_invalid
400
distance_invalid
400
test_account_name_update_disallowed
400
bundle_selection_ratios_invalid_format
Get a transaction document emission estimate
GET
to /v1/estimates/transaction-documents/{id}
Query parameters
idstringrequired
The estimate's unique identifier
Response
massobjectrequired
amountstringrequired
Pattern: ^[0-9]+(\.[0-9]+)?$
unitstringrequired
Unit, t
for tonne, kg
for kilogram, g
for gram, mg
for milligram
mg
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:
- Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
- Clients can use
idempotency_key
to reconcile estimates with entities on their system.
idstringrequired
The emission calculation unique identifier
quoteoneOfrequired
requestobjectrequired
unstructured_dataobjectrequired
Add unstructured JSON data representing the document to calculate its emission estimate.
key_valueobject
An arbitrary dictionary (key-value pairs).
Lune attempts to extract valuable information from here.
is_transaction_documentboolean
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
namestring
A name to reference this calculation.
bundle_selectionarray
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.
object
Maps a bundle id to an allocation ratio
bundle_idstringrequired
The bundle's unique identifier
percentageoneOf
quantity_truncstring
Selects to which precision to truncate quantities specific to carbon offsetting.
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:
- Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
- Clients can use
idempotency_key
to reconcile estimates with entities on their system.
valuestring
Pattern: ^[0-9]+(\.[0-9]+)?$
Specify the monetary value in the currency defined by the currency_code
property in the request. If no currency_code
is provided, the currency will default to that of the associated account.
currencystring
ISO 4217 3 character currency code.
Note: Lune supports most but not all currency codes.
AED
AFN
ALL
AMD
ANG
merchantoneOf
The merchant from whom the goods or services were purchased.
dietstring
Specify individual dietary preferences to improve estimates for food-related purchases.
high_meat_eater
medium_meat_eater
low_meat_eater
fish_eater
vegetarian
region_fallbackstring
Specify how geographical constraints (e.g., country_code
, region
) should be handled when matching emission factors, and if fallbacks should be used.
Defaults to never
, meaning only emission factors that exactly match the specified geography are used. No fallbacks are applied.
never
always
is_transaction_documentbooleanrequired
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)required
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
oneOf
Errors
This API operation can return the following errors:401
404
429
503
service_unavailable
Update a transaction document emission estimate's annotations
PATCH
to /v1/estimates/transaction-documents/{id}/annotations
This method allows updating a selection of estimate annotations without going through a full estimate update (with all the necessary inputs).Only properties included in the input data are updated.Query parameters
idstringrequired
The estimate's unique identifier
Request body
is_transaction_documentboolean
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
Response
massobjectrequired
amountstringrequired
Pattern: ^[0-9]+(\.[0-9]+)?$
unitstringrequired
Unit, t
for tonne, kg
for kilogram, g
for gram, mg
for milligram
mg
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:
- Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
- Clients can use
idempotency_key
to reconcile estimates with entities on their system.
idstringrequired
The emission calculation unique identifier
quoteoneOfrequired
requestobjectrequired
unstructured_dataobjectrequired
Add unstructured JSON data representing the document to calculate its emission estimate.
key_valueobject
An arbitrary dictionary (key-value pairs).
Lune attempts to extract valuable information from here.
is_transaction_documentboolean
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
namestring
A name to reference this calculation.
bundle_selectionarray
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.
object
Maps a bundle id to an allocation ratio
bundle_idstringrequired
The bundle's unique identifier
percentageoneOf
quantity_truncstring
Selects to which precision to truncate quantities specific to carbon offsetting.
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:
- Clients can safely retry estimate requests without accidentally performing the same operation multiple times.
- Clients can use
idempotency_key
to reconcile estimates with entities on their system.
valuestring
Pattern: ^[0-9]+(\.[0-9]+)?$
Specify the monetary value in the currency defined by the currency_code
property in the request. If no currency_code
is provided, the currency will default to that of the associated account.
currencystring
ISO 4217 3 character currency code.
Note: Lune supports most but not all currency codes.
AED
AFN
ALL
AMD
ANG
merchantoneOf
The merchant from whom the goods or services were purchased.
dietstring
Specify individual dietary preferences to improve estimates for food-related purchases.
high_meat_eater
medium_meat_eater
low_meat_eater
fish_eater
vegetarian
region_fallbackstring
Specify how geographical constraints (e.g., country_code
, region
) should be handled when matching emission factors, and if fallbacks should be used.
Defaults to never
, meaning only emission factors that exactly match the specified geography are used. No fallbacks are applied.
never
always
is_transaction_documentbooleanrequired
Use to distinguish confirmed transaction documents from quotes or forecasts. Defaults to false
when omitted. Can be updated at any point.
When true
, the estimate represents an actual transaction document for purchased goods and services and will be included in Lune analytics.
transaction_document_processed_atstring (date-time)required
Provide the date and time that the document is processed, as an RFC 3339 timestamp.
If omitted, the property defaults to the time of request. Used only for analytics, with no impact on the actual estimate calculation.
oneOf
Errors
This API operation can return the following errors:400
api_version_invalid
400
bundle_selection_ratios_invalid
400
bundle_selection_bundle_invalid
400
order_value_invalid
400
bundle_id_invalid
400
id_invalid
400
distance_invalid
400
test_account_name_update_disallowed
400
bundle_selection_ratios_invalid_format
400
address_not_found