Export LCA to Excel
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': '<content-type>'
},
body: JSON.stringify({
category_impacts: [{}],
recursive: true,
max_depth: 123,
view: '<string>',
output_product_id: '<string>'
})
};
fetch('https://api.dcycle.io/lca/export-xlsx/{lca_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/lca/export-xlsx/{lca_id}"
payload = {
"category_impacts": [{}],
"recursive": True,
"max_depth": 123,
"view": "<string>",
"output_product_id": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/lca/export-xlsx/{lca_id} \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"category_impacts": [
{}
],
"recursive": true,
"max_depth": 123,
"view": "<string>",
"output_product_id": "<string>"
}
'{
"download_url": "<string>"
}Export LCA to Excel
Export LCA impact results to an Excel spreadsheet
POST
/
lca
/
export-xlsx
/
{lca_id}
Export LCA to Excel
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': '<content-type>'
},
body: JSON.stringify({
category_impacts: [{}],
recursive: true,
max_depth: 123,
view: '<string>',
output_product_id: '<string>'
})
};
fetch('https://api.dcycle.io/lca/export-xlsx/{lca_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/lca/export-xlsx/{lca_id}"
payload = {
"category_impacts": [{}],
"recursive": True,
"max_depth": 123,
"view": "<string>",
"output_product_id": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/lca/export-xlsx/{lca_id} \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"category_impacts": [
{}
],
"recursive": true,
"max_depth": 123,
"view": "<string>",
"output_product_id": "<string>"
}
'{
"download_url": "<string>"
}← LCA API
Exports the environmental impact results of an LCA portfolio to an Excel file. The file is uploaded to S3 and a presigned download URL is returned.
Every line of the detailed sheet states the calculation behind its impact: the quantity, its unit, the emission factor and where that factor came from, so that quantity × factor gives the impact printed next to it. On the co-product views (
product_total, product_unit) the quantities are scaled by the same allocation as the impacts.
The export always reflects the LCA as it is now. If the LCA changed since its impacts were last calculated, it is recalculated first — and with
recursive: true, so is every LCA it references as a piece, up to max_depth levels. The request then takes as long as that recalculation.Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51fastring
required
Must be
application/jsonPath Parameters
string
required
UUID of the LCA portfolio to exportExample:
550e8400-e29b-41d4-a716-446655440000Body Parameters
array
required
List of impact categories to include in the export (max 50)
boolean
default:"false"
Expand pieces that are themselves LCAs into their own lines, instead of one aggregated line each
integer
default:"10"
Maximum number of LCA levels to expand when
recursive is true (1-10)string
default:"system"
Visualization mode for the export
| Value | Description |
|---|---|
system | Absolute impact of the whole system (no allocation) |
product_total | Impact allocated to one co-product (requires output_product_id) |
product_unit | Per-unit impact of one co-product (requires output_product_id) |
string
UUID of the co-product for
product_total or product_unit views. Required when view is not system.Response
string
Presigned S3 URL to download the Excel file. The URL expires after a limited time.
Example
curl -X POST "https://api.dcycle.io/lca/export-xlsx/${LCA_ID}" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"category_impacts": [
{"key": "gwp", "name": "Global Warming Potential"},
{"key": "ap", "name": "Acidification"}
],
"recursive": true,
"max_depth": 5,
"view": "system"
}'
import requests
import os
lca_id = "550e8400-e29b-41d4-a716-446655440000"
response = requests.post(
f"https://api.dcycle.io/lca/export-xlsx/{lca_id}",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
},
json={
"category_impacts": [
{"key": "gwp", "name": "Global Warming Potential"},
{"key": "ap", "name": "Acidification"},
],
"recursive": True,
"max_depth": 5,
"view": "system",
},
)
result = response.json()
print(f"Download: {result['download_url']}")
const axios = require('axios');
const lcaId = '550e8400-e29b-41d4-a716-446655440000';
axios.post(`https://api.dcycle.io/lca/export-xlsx/${lcaId}`, {
category_impacts: [
{ key: 'gwp', name: 'Global Warming Potential' },
{ key: 'ap', name: 'Acidification' },
],
recursive: true,
max_depth: 5,
view: 'system',
}, {
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
},
})
.then(({ data }) => {
console.log(`Download: ${data.download_url}`);
});
Successful Response
{
"download_url": "https://dcycle-exports.s3.eu-west-1.amazonaws.com/org-id/Results%20LCA%20My%20Product.xlsx?X-Amz-Algorithm=..."
}
Co-product View Example
To export impacts allocated to a specific co-product:{
"category_impacts": [
{"key": "gwp", "name": "Global Warming Potential"}
],
"recursive": true,
"view": "product_total",
"output_product_id": "c3d4e5f6-a7b8-9012-cdef-345678901234"
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
403 Forbidden
Cause: The authenticated user is not a member of the organization{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
404 Not Found
Cause: LCA portfolio not found or doesn’t belong to your organization{"detail": "LCA Portfolio not found"}
422 Unprocessable Entity
Cause: Invalid view value or missingoutput_product_id for co-product views
{
"detail": [
{
"loc": ["body", "view"],
"msg": "view must be one of ['product_total', 'product_unit', 'system']",
"type": "value_error"
}
]
}
Related Endpoints
Get LCA Impacts
Calculate impacts before exporting
LCA Dashboard
View aggregated impact results in the UI
LCA routes are not versioned. Only portfolio creation is served under
/v1
(POST /v1/lca/portfolio); every other route in this module lives at /lca/....Get LCA Portfolio
View portfolio details
Was this page helpful?