Skip to main content
PATCH
/
api
/
v1
/
custom_emission_groups
/
{id}
Update Custom Emission Group
const options = {
  method: 'PATCH',
  headers: {
    'x-api-key': '<x-api-key>',
    'x-organization-id': '<x-organization-id>',
    'x-user-id': '<x-user-id>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({name: '<string>', description: '<string>'})
};

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));

Documentation Index

Fetch the complete documentation index at: https://code.dcycle.io/llms.txt

Use this file to discover all available pages before exploring further.

Update Custom Emission Group

Update the name and description of an existing custom emission group.
You can only update the name and description fields. To change category or ghg_type, delete the group and create a new one.

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 update

Body Parameters

All fields are optional - only include the fields you want to update.
name
string
Updated name for the groupExample: "Supplier ABC Materials 2024 (Updated)"
description
string
Updated descriptionExample: "EPD-verified emission factors, updated Q2 2024"

Response

Returns the complete updated group object.
{
  "id": "group-uuid",
  "name": "Supplier ABC Materials 2024 (Updated)",
  "category": "purchases",
  "description": "EPD-verified emission factors, updated Q2 2024",
  "ghg_type": 1
}

Example

curl -X PATCH "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}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Supplier ABC Materials 2024 (Updated)",
    "description": "EPD-verified emission factors, updated Q2 2024"
  }'

Use Cases

Update Description with Audit Trail

Add documentation updates to description:
group = requests.get(
    f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}",
    headers=headers
).json()

from datetime import date

updated_description = f"{group['description']} | Updated {date.today().isoformat()} by procurement team"

requests.patch(
    f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}",
    headers=headers,
    json={"description": updated_description}
)

Rename Group

Update group name to reflect changes:
requests.patch(
    f"https://api.dcycle.io/api/v1/custom_emission_groups/{group_id}",
    headers=headers,
    json={
        "name": "Supplier ABC Materials 2024-2025",
        "description": "Extended validity period for 2024-2025"
    }
)

Common Errors

404 Not Found

{
  "detail": "Custom emission group not found",
  "code": "NOT_FOUND"
}
Solution: Verify the group ID exists.

Get Group

View current values

Delete Group

Remove group