Permanently delete a custom emission group and all emission factors within it. This action cannot be undone.
Deleting a custom emission group is permanent and will also delete all custom emission factors within the group. If any factors are in use by purchases, wastes, or energy records, this may affect historical data.
# Get group detailsgroup = requests.get( f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}", headers=headers).json()# Get factors in the groupfactors = requests.get( f"https://api.dcycle.io/api/v1/custom_emission_factors/list/{group_id}", headers=headers, params={"page": 1, "size": 100}).json()print(f"About to delete group: {group['name']}")print(f"This will also delete {factors['total']} emission factors")# Confirm and deleteconfirmed = True # Replace with actual user confirmationif confirmed: requests.delete( f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}", headers=headers ) print("✅ Group deleted")
Delete individual factors instead of the entire group if some factors are still needed:
Copy
# Delete specific factors instead of the whole groupfactors_to_delete = ["factor-id-1", "factor-id-2"]for factor_id in factors_to_delete: requests.delete( f"https://api.dcycle.io/api/v1/custom_emission_factors/{factor_id}", headers=headers )