Update Waste
Update specific fields of an existing waste record. All fields are optional - only include fields you want to modify. Omitted fields will retain their current values.
CO2e Recalculation : When you update fields like base_quantity, waste_efs_id, or unit_id, CO2e emissions are automatically recalculated.
Request
Path Parameters
The UUID of the waste record to update Example: 550e8400-e29b-41d4-a716-446655440000
Your API key for authentication Example: sk_live_1234567890abcdef
Your organization UUID Example: a8315ef3-dd50-43f8-b7ce-d839e68d51fa
Body Parameters
All parameters are optional. Only include fields you want to update.
Waste identification name or invoice number Example: "RSU-2024-001-Updated"
Description of the waste Example: "Updated description"
Start date of the waste period Example: "2024-01-01"
End date of the waste period Example: "2024-06-30"
Waste quantity in the specified unit. Must be greater than 0. Example: 2000.0
Waste destination or treatment facility Example: "New waste treatment plant"
Distance to waste treatment center in kilometers Example: 30.0
UUID of the quantity unit Example: "61743a63-ff70-459c-9567-5eee8f7dfd5c"
UUID of the waste emission factor Example: "770e8400-e29b-41d4-a716-446655440000"
custom_emission_factor_id
UUID of a custom emission factor Example: "880e8400-e29b-41d4-a716-446655440000"
Response
Unique identifier (UUID) for the waste record
Waste identification name
Current status: uploaded, active, loading, or error
Updated CO2 equivalent emissions in kg CO2e
Biogenic CO2 emissions in kg CO2e
Timestamp when the record was last updated
Example
curl -X PATCH "https://api.dcycle.io/v1/wastes/550e8400-e29b-41d4-a716-446655440000" \
-H "x-api-key: ${ DCYCLE_API_KEY }" \
-H "x-organization-id: ${ DCYCLE_ORG_ID }" \
-H "Content-Type: application/json" \
-d '{
"base_quantity": 2000.0,
"description": "Updated municipal solid waste",
"destination": "New waste treatment plant"
}'
Successful Response
{
"id" : "550e8400-e29b-41d4-a716-446655440000" ,
"identification_name" : "RSU-2024-001" ,
"description" : "Updated municipal solid waste" ,
"start_date" : "2024-01-01" ,
"end_date" : "2024-03-31" ,
"base_quantity" : 2000.0 ,
"quantity" : 2000.0 ,
"percentage" : 1.0 ,
"destination" : "New waste treatment plant" ,
"total_km_to_waste_center" : 25.0 ,
"status" : "active" ,
"co2e" : 601.0 ,
"co2e_biomass" : 16.4 ,
"enabled" : true ,
"created_at" : "2024-11-24T10:30:00Z" ,
"updated_at" : "2024-11-24T15:45:00Z"
}
Common Errors
404 Not Found
Cause: Waste record not found in organization
{
"detail" : "Waste with id=UUID('...') not found" ,
"code" : "WASTE_NOT_FOUND"
}
Solution: Verify the waste ID is correct and belongs to your organization.
403 Forbidden
Cause: Waste doesn’t belong to your organization
{
"detail" : "Waste doesn't belong to organization" ,
"code" : "FORBIDDEN"
}
Solution: Verify the x-organization-id header matches the organization that owns this waste record.
422 Validation Error
Cause: Invalid values
{
"detail" : [
{
"loc" : [ "body" , "base_quantity" ],
"msg" : "ensure this value is greater than 0" ,
"type" : "value_error.number.not_gt"
}
]
}
Solution: Ensure numeric values are valid and within allowed ranges.
List Wastes Retrieve all waste records
Create Waste Add a new waste record
Facilities List facilities for your organization