Skip to main content
DELETE
https://api.dcycle.io
/
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));

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

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: ff4adcc7-8172-45fe-9cf1-e90a6de53aa9
x-user-id
string
required
Your user UUIDExample: a1b2c3d4-e5f6-7890-abcd-ef1234567890

Path Parameters

id
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}"

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

{
  "detail": "Custom emission group not found",
  "code": "NOT_FOUND"
}
Solution: The group may have already been deleted.

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
    )