Create LCA from JSON
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': '<content-type>'
},
body: JSON.stringify({
name: '<string>',
unit: '<string>',
value: 123,
start_date: '<string>',
end_date: '<string>',
start_node: '<string>',
nodes: {}
})
};
fetch('https://api.dcycle.io/lca/create-from-json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/lca/create-from-json"
payload = {
"name": "<string>",
"unit": "<string>",
"value": 123,
"start_date": "<string>",
"end_date": "<string>",
"start_node": "<string>",
"nodes": {}
}
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/create-from-json \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"name": "<string>",
"unit": "<string>",
"value": 123,
"start_date": "<string>",
"end_date": "<string>",
"start_node": "<string>",
"nodes": {}
}
'{
"acv_id": "<string>",
"summary": {}
}Create LCA from JSON
Create a complete LCA portfolio from a hierarchical JSON tree structure
POST
/
lca
/
create-from-json
Create LCA from JSON
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': '<content-type>'
},
body: JSON.stringify({
name: '<string>',
unit: '<string>',
value: 123,
start_date: '<string>',
end_date: '<string>',
start_node: '<string>',
nodes: {}
})
};
fetch('https://api.dcycle.io/lca/create-from-json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/lca/create-from-json"
payload = {
"name": "<string>",
"unit": "<string>",
"value": 123,
"start_date": "<string>",
"end_date": "<string>",
"start_node": "<string>",
"nodes": {}
}
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/create-from-json \
--header 'Content-Type: <content-type>' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"name": "<string>",
"unit": "<string>",
"value": 123,
"start_date": "<string>",
"end_date": "<string>",
"start_node": "<string>",
"nodes": {}
}
'{
"acv_id": "<string>",
"summary": {}
}← LCA API
Creates a complete LCA portfolio with all its components (processes, materials, energy, waste, transport) from a hierarchical JSON tree structure. This is the recommended endpoint for programmatic LCA creation.
This endpoint requires API key authentication only (
x-api-key header).Request
Authentication
string
required
Your API keyExample:
sk_live_1234567890abcdefHeaders
string
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51fastring
required
Must be
application/jsonBody Parameters
string
required
Name of the LCA portfolio
string
required
Functional unit name (e.g.
"kg", "unit", "m2")number
required
Functional unit quantity (must be >= 0)
string
required
Start date of the assessment periodFormat:
YYYY-MM-DDstring
required
End date of the assessment period (must be after start_date)Format:
YYYY-MM-DDstring
required
ID of the root node in the
nodes dictionary. Must be a process type node.object
required
Dictionary of node definitions keyed by node ID. Each node has a
type that determines its fields.Node types:Show process node
Show process node
Show material node
Show material node
Show energy node
Show energy node
Show waste node
Show waste node
Response
Returns HTTP 201 with the created LCA information.string
UUID of the created LCA portfolio
object
Summary of the created LCA structure
Example
curl -X POST "https://api.dcycle.io/lca/create-from-json" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"name": "Wooden Table LCA",
"unit": "unit",
"value": 1.0,
"start_date": "2024-01-01",
"end_date": "2024-12-31",
"start_node": "assembly",
"nodes": {
"assembly": {
"type": "process",
"name": "Table Assembly",
"location": "ES",
"children": ["wood", "steel_bolts", "electricity", "transport_wood"],
"attributes": {}
},
"wood": {
"type": "material",
"name": "Sawn timber, softwood",
"supplier": "Forest Co",
"location": "FI",
"quantity": 15.0,
"unit": "kg"
},
"steel_bolts": {
"type": "material",
"name": "Steel, low-alloyed",
"supplier": "Steel Inc",
"location": "DE",
"quantity": 0.5,
"unit": "kg"
},
"electricity": {
"type": "energy",
"name": "Electricity",
"location": "ES",
"quantity": 2.5,
"unit": "kWh"
},
"transport_wood": {
"type": "transport",
"name": "Wood transport from Finland",
"transport_type": "truck",
"quantity": 45.0,
"unit": "tkm",
"children": ["wood"]
}
}
}'
import requests
import os
response = requests.post(
"https://api.dcycle.io/lca/create-from-json",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
},
json={
"name": "Wooden Table LCA",
"unit": "unit",
"value": 1.0,
"start_date": "2024-01-01",
"end_date": "2024-12-31",
"start_node": "assembly",
"nodes": {
"assembly": {
"type": "process",
"name": "Table Assembly",
"location": "ES",
"children": ["wood", "steel_bolts", "electricity"],
"attributes": {},
},
"wood": {
"type": "material",
"name": "Sawn timber, softwood",
"supplier": "Forest Co",
"location": "FI",
"quantity": 15.0,
"unit": "kg",
},
"steel_bolts": {
"type": "material",
"name": "Steel, low-alloyed",
"supplier": "Steel Inc",
"location": "DE",
"quantity": 0.5,
"unit": "kg",
},
"electricity": {
"type": "energy",
"name": "Electricity",
"location": "ES",
"quantity": 2.5,
"unit": "kWh",
},
},
},
)
result = response.json()
print(f"Created LCA: {result['acv_id']}")
const axios = require('axios');
const response = await axios.post('https://api.dcycle.io/lca/create-from-json', {
name: 'Wooden Table LCA',
unit: 'unit',
value: 1.0,
start_date: '2024-01-01',
end_date: '2024-12-31',
start_node: 'assembly',
nodes: {
assembly: {
type: 'process',
name: 'Table Assembly',
location: 'ES',
children: ['wood', 'steel_bolts', 'electricity'],
attributes: {},
},
wood: {
type: 'material',
name: 'Sawn timber, softwood',
supplier: 'Forest Co',
location: 'FI',
quantity: 15.0,
unit: 'kg',
},
steel_bolts: {
type: 'material',
name: 'Steel, low-alloyed',
supplier: 'Steel Inc',
location: 'DE',
quantity: 0.5,
unit: 'kg',
},
electricity: {
type: 'energy',
name: 'Electricity',
location: 'ES',
quantity: 2.5,
unit: 'kWh',
},
},
}, {
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
},
});
console.log(`Created LCA: ${response.data.acv_id}`);
Successful Response
{
"acv_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"summary": {
"name": "Wooden Table LCA",
"nodes_created": 5,
"processes": 1,
"materials": 2,
"energy": 1,
"transport": 1
}
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
422 Unprocessable Entity
Cause: Invalid tree structure, missing nodes, or broken references{
"detail": [
{
"loc": ["body", "start_node"],
"msg": "start_node 'missing_node' not found in nodes",
"type": "value_error"
}
]
}
422 Unprocessable Entity — Invalid date range
Cause: Invalid or missing required fields in the request body{
"detail": [
{
"loc": ["body", "end_date"],
"msg": "End date must be after start date",
"type": "value_error"
}
]
}
Related Endpoints
Create LCA Portfolio
Create a basic portfolio (without tree structure)
List LCA Portfolios
Browse all LCA portfolios
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/....LCA Dashboard
View environmental impact results
Was this page helpful?