Delete Custom Emission Group
const options = {
method: 'DELETE',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'x-user-id': '<x-user-id>'
}
};
fetch('https://api.dcycle.io/api/v1/custom_emission_groups/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/api/v1/custom_emission_groups/{id}"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"x-user-id": "<x-user-id>"
}
response = requests.delete(url, headers=headers)
print(response.text)curl --request DELETE \
--url https://api.dcycle.io/api/v1/custom_emission_groups/{id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--header 'x-user-id: <x-user-id>'Delete Custom Emission Group
Remove a custom emission group and all its emission factors
DELETE
/
api
/
v1
/
custom_emission_groups
/
{id}
Delete Custom Emission Group
const options = {
method: 'DELETE',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'x-user-id': '<x-user-id>'
}
};
fetch('https://api.dcycle.io/api/v1/custom_emission_groups/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/api/v1/custom_emission_groups/{id}"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"x-user-id": "<x-user-id>"
}
response = requests.delete(url, headers=headers)
print(response.text)curl --request DELETE \
--url https://api.dcycle.io/api/v1/custom_emission_groups/{id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--header 'x-user-id: <x-user-id>'Delete Custom Emission Group
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.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
ff4adcc7-8172-45fe-9cf1-e90a6de53aa9string
required
Your user UUIDExample:
a1b2c3d4-e5f6-7890-abcd-ef1234567890Path Parameters
string
required
UUID of the Custom Emission Group to delete
Response
Returns HTTP 204 No Content on successful deletion.Example
curl -X DELETE "https://api.dcycle.io/api/v1/custom_emission_groups/group-uuid" \
-H "Authorization: Bearer ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "x-user-id: ${DCYCLE_USER_ID}"
import requests
import os
headers = {
"Authorization": f"Bearer {os.getenv('DCYCLE_API_KEY')}",
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"x-user-id": os.getenv("DCYCLE_USER_ID")
}
group_id = "group-uuid"
response = requests.delete(
f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}",
headers=headers
)
if response.status_code == 204:
print("✅ Custom emission group deleted successfully")
const axios = require('axios');
const headers = {
'Authorization': `Bearer ${process.env.DCYCLE_API_KEY}`,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'x-user-id': process.env.DCYCLE_USER_ID
};
const groupId = 'group-uuid';
axios.delete(
`https://api.dcycle.io/api/v1/custom_emission_groups/${groupId}`,
{ headers }
)
.then(response => {
if (response.status === 204) {
console.log('✅ Custom emission group deleted successfully');
}
})
.catch(error => console.error(error));
Use Cases
Safe Delete with Confirmation
Check group contents before deleting:# Get group details
group = requests.get(
f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}",
headers=headers
).json()
# Get factors in the group
factors = 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 delete
confirmed = True # Replace with actual user confirmation
if confirmed:
requests.delete(
f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}",
headers=headers
)
print("✅ Group deleted")
Delete Empty Groups
Clean up groups with no factors:groups = requests.get(
"https://api.dcycle.io/api/v1/custom_emission_groups",
headers=headers,
params={"page": 1, "size": 100}
).json()
for group in groups['items']:
# Check if group has factors
factors = requests.get(
f"https://api.dcycle.io/api/v1/custom_emission_factors/list/{group['id']}",
headers=headers,
params={"page": 1, "size": 1}
).json()
if factors['total'] == 0:
requests.delete(
f"https://api.dcycle.io/api/v1/custom_emission_groups/{group['id']}",
headers=headers
)
print(f"Deleted empty group: {group['name']}")
Common Errors
404 Not Found
Cause: Custom emission group not found{
"detail": "Custom emission group not found",
"code": "NOT_FOUND"
}
Best Practices
1. Audit Before Deletion
Always check what will be deleted:group = requests.get(
f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}",
headers=headers
).json()
factors = 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"Group: {group['name']}")
print(f"Category: {group['category']}")
print(f"Factors: {factors['total']}")
for factor in factors['items']:
print(f" - {factor['ef_name']}")
2. Consider Factor Deletion First
Delete individual factors instead of the entire group if some factors are still needed:# Delete specific factors instead of the whole group
factors_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
)
Related Endpoints
Get Group
View before deleting
List Factors
Check group contents
Was this page helpful?