Create Waste
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
facility_id: '<string>',
identification_name: '<string>',
start_date: '<string>',
end_date: '<string>',
base_quantity: 123,
description: '<string>',
destination: '<string>',
total_km_to_waste_center: 123,
unit_id: '<string>',
waste_ler_code_id: '<string>',
waste_rd_code_id: '<string>',
custom_emission_factor_id: '<string>',
custom_ef_record_id: '<string>'
})
};
fetch('https://api.dcycle.io/v1/wastes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/wastes"
payload = {
"facility_id": "<string>",
"identification_name": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"base_quantity": 123,
"description": "<string>",
"destination": "<string>",
"total_km_to_waste_center": 123,
"unit_id": "<string>",
"waste_ler_code_id": "<string>",
"waste_rd_code_id": "<string>",
"custom_emission_factor_id": "<string>",
"custom_ef_record_id": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/wastes \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"facility_id": "<string>",
"identification_name": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"base_quantity": 123,
"description": "<string>",
"destination": "<string>",
"total_km_to_waste_center": 123,
"unit_id": "<string>",
"waste_ler_code_id": "<string>",
"waste_rd_code_id": "<string>",
"custom_emission_factor_id": "<string>",
"custom_ef_record_id": "<string>"
}
'{
"id": "<string>",
"identification_name": "<string>",
"description": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"base_quantity": 123,
"quantity": 123,
"percentage": 123,
"destination": "<string>",
"total_km_to_waste_center": 123,
"status": "<string>",
"error_messages": {},
"co2e": 123,
"co2e_biomass": 123,
"enabled": {},
"file_id": {},
"file_name": {},
"file_url": {},
"created_at": {},
"updated_at": {}
}Create Waste
Create a new waste record for a facility
POST
/
v1
/
wastes
Create Waste
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
facility_id: '<string>',
identification_name: '<string>',
start_date: '<string>',
end_date: '<string>',
base_quantity: 123,
description: '<string>',
destination: '<string>',
total_km_to_waste_center: 123,
unit_id: '<string>',
waste_ler_code_id: '<string>',
waste_rd_code_id: '<string>',
custom_emission_factor_id: '<string>',
custom_ef_record_id: '<string>'
})
};
fetch('https://api.dcycle.io/v1/wastes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/wastes"
payload = {
"facility_id": "<string>",
"identification_name": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"base_quantity": 123,
"description": "<string>",
"destination": "<string>",
"total_km_to_waste_center": 123,
"unit_id": "<string>",
"waste_ler_code_id": "<string>",
"waste_rd_code_id": "<string>",
"custom_emission_factor_id": "<string>",
"custom_ef_record_id": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/wastes \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"facility_id": "<string>",
"identification_name": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"base_quantity": 123,
"description": "<string>",
"destination": "<string>",
"total_km_to_waste_center": 123,
"unit_id": "<string>",
"waste_ler_code_id": "<string>",
"waste_rd_code_id": "<string>",
"custom_emission_factor_id": "<string>",
"custom_ef_record_id": "<string>"
}
'{
"id": "<string>",
"identification_name": "<string>",
"description": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"base_quantity": 123,
"quantity": 123,
"percentage": 123,
"destination": "<string>",
"total_km_to_waste_center": 123,
"status": "<string>",
"error_messages": {},
"co2e": 123,
"co2e_biomass": 123,
"enabled": {},
"file_id": {},
"file_name": {},
"file_url": {},
"created_at": {},
"updated_at": {}
}← Wastes API
Create a new waste disposal record linked to a specific facility. The waste record will be processed for CO2e emissions calculation based on the emission factor and quantity provided.
Solution: Verify your API key is valid and active.
Solution: Verify that the
Solution: Check that all required fields are provided and values are valid.
Deprecated. Use
POST /v2/wastes: one or many wastes per request,
idempotent, calculated asynchronously, with webhooks. This endpoint keeps working; its responses carry
Deprecation and Link: </v2/wastes>; rel="successor-version" headers. A removal date (Sunset) will be announced
in the changelog with notice.CO2e Calculation: After creation, emissions are automatically calculated using the specified emission factor or custom emission factor. The
co2e field will be updated asynchronously.waste_efs_id removed. The legacy catalog-based emission factor selector is no longer
accepted — sending it in the request body has no effect. Every waste is created through the
conversion-factors pipeline: pass waste_ler_code_id (required) and optionally
waste_rd_code_id for a standard emission factor, or custom_ef_record_id for a custom one.Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faBody Parameters
uuid
required
UUID of the facility this waste belongs toRetrieve available options from
GET /v1/facilitiesExample: "660e8400-e29b-41d4-a716-446655440000"string
required
Waste identification name or invoice numberExample:
"RSU-2024-001"date
required
Start date of the waste period (ISO 8601 format), a year from 1970 to next yearExample:
"2024-01-01"date
required
End date of the waste period (ISO 8601 format), a year from 1970 to next year, on or after
start_dateExample: "2024-03-31"number
required
Waste quantity in the specified unit. Must be greater than 0.Example:
1500.0string
Description of the wasteExample:
"Municipal solid waste from office building"string
Waste destination or treatment facility nameExample:
"Waste treatment plant Madrid"number
Distance to waste treatment center in kilometersExample:
25.0uuid
UUID of the quantity unit. Defaults to kilograms if not specified.Example:
"61743a63-ff70-459c-9567-5eee8f7dfd5c"uuid
required
UUID of the LER (European List of Waste) code. The pipeline resolves the emission factor from
waste_matches keyed on (LER, R/D, source).Retrieve available options from GET /v1/wastes/ler-codesExample: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"uuid
Optional (roughly a third of records name no treatment). UUID of the R/D (recovery/disposal)
operation code.Retrieve available options from
GET /v1/wastes/rd-codes —
pass ler_code_id to restrict to codes valid for the chosen LERExample: "b2c3d4e5-f6a7-8901-bcde-fa2345678901"uuid
Deprecated, no longer functional. Even if sent, it is never persisted — use
custom_ef_record_id for a custom emission factor.Example: "880e8400-e29b-41d4-a716-446655440000"uuid
UUID of a custom emission-factor record. Transient input — it is not stored on the waste row,
but persisted as a
client_choice calculation config keyed on the waste, which the calculation
pipeline consumes.Mutually exclusive with custom_emission_factor_id.Example: "c3d4e5f6-a7b8-9012-cdef-ab3456789012"Response
string
Unique identifier (UUID) for the waste record
string
Waste identification name
string
Description of the waste
date
Start date of the waste period
date
End date of the waste period
number
Original waste quantity
number
Adjusted quantity after applying percentage allocation
number
Allocation percentage (0–1)
string
Waste destination or treatment facility
number
Distance to waste treatment center in km
string
Current status:
uploaded, active, loading, or errorarray[string] | null
Error details when status is
errornumber
CO2 equivalent emissions in kg CO2e (calculated asynchronously)
number
Biogenic CO2 emissions in kg CO2e
boolean | null
Whether the waste record is enabled for emission calculations
string | null
UUID of the linked file (if created via bulk import)
string | null
Name of the linked import file
string | null
Download URL for the linked file
datetime
Timestamp when the record was created
datetime | null
Timestamp when the record was last updated
Example
curl -X POST "https://api.dcycle.io/v1/wastes" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"facility_id": "660e8400-e29b-41d4-a716-446655440000",
"identification_name": "RSU-2024-001",
"start_date": "2024-01-01",
"end_date": "2024-03-31",
"base_quantity": 1500.0,
"description": "Municipal solid waste",
"destination": "Waste treatment plant Madrid",
"total_km_to_waste_center": 25.0,
"waste_ler_code_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"waste_rd_code_id": "b2c3d4e5-f6a7-8901-bcde-fa2345678901"
}'
import requests
import os
api_key = os.getenv("DCYCLE_API_KEY")
org_id = os.getenv("DCYCLE_ORG_ID")
headers = {
"x-api-key": api_key,
"x-organization-id": org_id,
"Content-Type": "application/json"
}
payload = {
"facility_id": "660e8400-e29b-41d4-a716-446655440000",
"identification_name": "RSU-2024-001",
"start_date": "2024-01-01",
"end_date": "2024-03-31",
"base_quantity": 1500.0,
"description": "Municipal solid waste",
"destination": "Waste treatment plant Madrid",
"total_km_to_waste_center": 25.0,
"waste_ler_code_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"waste_rd_code_id": "b2c3d4e5-f6a7-8901-bcde-fa2345678901"
}
response = requests.post(
"https://api.dcycle.io/v1/wastes",
headers=headers,
json=payload
)
waste = response.json()
print(f"Waste created: {waste['id']}")
print(f"Status: {waste['status']}")
const axios = require('axios');
const apiKey = process.env.DCYCLE_API_KEY;
const orgId = process.env.DCYCLE_ORG_ID;
const headers = {
'x-api-key': apiKey,
'x-organization-id': orgId,
'Content-Type': 'application/json'
};
const payload = {
facility_id: "660e8400-e29b-41d4-a716-446655440000",
identification_name: "RSU-2024-001",
start_date: "2024-01-01",
end_date: "2024-03-31",
base_quantity: 1500.0,
description: "Municipal solid waste",
destination: "Waste treatment plant Madrid",
total_km_to_waste_center: 25.0,
waste_ler_code_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
waste_rd_code_id: "b2c3d4e5-f6a7-8901-bcde-fa2345678901"
};
axios.post('https://api.dcycle.io/v1/wastes', payload, { headers })
.then(response => {
const waste = response.data;
console.log(`Waste created: ${waste.id}`);
})
.catch(error => console.error(error));
Successful Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"identification_name": "RSU-2024-001",
"description": "Municipal solid waste",
"start_date": "2024-01-01",
"end_date": "2024-03-31",
"base_quantity": 1500.0,
"quantity": 1500.0,
"percentage": 1.0,
"destination": "Waste treatment plant Madrid",
"total_km_to_waste_center": 25.0,
"status": "uploaded",
"error_messages": null,
"co2e": 0.0,
"co2e_biomass": 0.0,
"enabled": true,
"file_id": null,
"file_name": null,
"file_url": null,
"created_at": "2024-11-24T10:30:00Z",
"updated_at": "2024-11-24T10:30:00Z"
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{
"detail": "Invalid API key",
"code": "INVALID_API_KEY"
}
403 Forbidden
Cause: Facility doesn’t belong to your organization{
"detail": "Facility doesn't belong to organization",
"code": "FACILITY_NOT_BELONG_TO_ORGANIZATION"
}
facility_id belongs to your organization. Use the Facilities API to list available facilities.
422 Validation Error
Cause: Missing required fields or invalid values{
"detail": [
{
"loc": ["body", "base_quantity"],
"msg": "ensure this value is greater than 0",
"type": "value_error.number.not_gt"
}
]
}
Related Endpoints
List Wastes
Retrieve all waste records with filtering
Update Waste
Modify an existing waste record
Facilities
List facilities for your organization
Was this page helpful?