Lune Docs Logo
Log inContact us

By document

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

HTTP POST to /v1/estimates/transaction-documents
Request body

Data to be used to create the appropriate emission estimate.

An arbitrary dictionary (key-value pairs).

Lune attempts to extract valuable information from here.

When true, the emission estimate refers to an actual transaction document 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 transaction documents that have occured.

You can mark an estimate as a transaction document at any time.

This property captures the exact date and time at which the transaction document 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

A name to reference this calculation.

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.

Maps a bundle id to an allocation ratio

The bundle's unique identifier

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

g
kg
t

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.

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.

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

An amount of money (the fractional part is optional)

ISO 4217 3 character currency code.

Note: Lune supports most but not all currency codes.

AED
AFN
ALL
AMD
ANG

Merchant from whom the goods or services the purchase was made

Individual diet. Used to better estimate food-related purchases.

high_meat_eater
medium_meat_eater
low_meat_eater
fish_eater
vegetarian

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.
never
always
  • Sample request
  • Response

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

    Unit, t for tonne, kg for kilogram, g for gram, mg for milligram

    mg
    g
    kg
    t

    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.

    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.

    The emission calculation unique identifier

    Data to be used to create the appropriate emission estimate.

    An arbitrary dictionary (key-value pairs).

    Lune attempts to extract valuable information from here.

    When true, the emission estimate refers to an actual transaction document 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 transaction documents that have occured.

    You can mark an estimate as a transaction document at any time.

    This property captures the exact date and time at which the transaction document 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

    A name to reference this calculation.

    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.

    Maps a bundle id to an allocation ratio

    The bundle's unique identifier

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

    g
    kg
    t

    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.

    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.

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

    An amount of money (the fractional part is optional)

    ISO 4217 3 character currency code.

    Note: Lune supports most but not all currency codes.

    AED
    AFN
    ALL
    AMD
    ANG

    Merchant from whom the goods or services the purchase was made

    Individual diet. Used to better estimate food-related purchases.

    high_meat_eater
    medium_meat_eater
    low_meat_eater
    fish_eater
    vegetarian

    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.
    never
    always

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

    Transaction document line item estimate.

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

    Unit, t for tonne, kg for kilogram, g for gram, mg for milligram

    mg
    g
    kg
    t

    Identifies the type of the line item emission estimate. New values are expected to be introduced over time and considered to be a non breaking change.

    transaction

    When true, the emission estimate refers to an actual transaction document 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 transaction documents that have occured.

    You can mark an estimate as a transaction document at any time.

    This property captures the exact date and time at which the transaction document 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
  • Sample response
  • Errors
    This API operation can return the following errors:
    HTTP status codeError code
    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

    Get a transaction document emission estimate

    HTTP GET to /v1/estimates/transaction-documents/{id}
    Query parameters

    The estimate's unique identifier

  • Sample request
  • Response

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

    Unit, t for tonne, kg for kilogram, g for gram, mg for milligram

    mg
    g
    kg
    t

    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.

    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.

    The emission calculation unique identifier

    Data to be used to create the appropriate emission estimate.

    An arbitrary dictionary (key-value pairs).

    Lune attempts to extract valuable information from here.

    When true, the emission estimate refers to an actual transaction document 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 transaction documents that have occured.

    You can mark an estimate as a transaction document at any time.

    This property captures the exact date and time at which the transaction document 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

    A name to reference this calculation.

    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.

    Maps a bundle id to an allocation ratio

    The bundle's unique identifier

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

    g
    kg
    t

    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.

    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.

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

    An amount of money (the fractional part is optional)

    ISO 4217 3 character currency code.

    Note: Lune supports most but not all currency codes.

    AED
    AFN
    ALL
    AMD
    ANG

    Merchant from whom the goods or services the purchase was made

    Individual diet. Used to better estimate food-related purchases.

    high_meat_eater
    medium_meat_eater
    low_meat_eater
    fish_eater
    vegetarian

    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.
    never
    always

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

    Transaction document line item estimate.

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

    Unit, t for tonne, kg for kilogram, g for gram, mg for milligram

    mg
    g
    kg
    t

    Identifies the type of the line item emission estimate. New values are expected to be introduced over time and considered to be a non breaking change.

    transaction

    When true, the emission estimate refers to an actual transaction document 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 transaction documents that have occured.

    You can mark an estimate as a transaction document at any time.

    This property captures the exact date and time at which the transaction document 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
  • Sample response
  • Errors
    This API operation can return the following errors:
    HTTP status codeError code
    401
    404
    429
    503
    service_unavailable