> ## 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 metadata of an existing custom emission group

> [!WARNING]
>
> **Legacy API.** This page documents the previous version of the API. This particular
> operation has no documented equivalent in the current API yet, so this remains the
> documented way to do it. Prefer the current API for everything it already covers.

Update the name and description of an existing custom emission group.

> [!NOTE]
>
> 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 authentication

**Example:** `sk_live_1234567890abcdef`

**x-organization-id** `string` *required*

Your organization UUID

**Example:** `ff4adcc7-8172-45fe-9cf1-e90a6de53aa9`

**x-user-id** `string`

Optional and ignored: the request acts as the member who created the API key

**Example:** `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 group

**Example:** `"Supplier ABC Materials 2024 (Updated)"`

**description** `string`

Updated description

**Example:** `"EPD-verified emission factors, updated Q2 2024"`

## Response

Returns the complete updated group object.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "group-uuid",
  "name": "Supplier ABC Materials 2024 (Updated)",
  "category": "purchases",
  "description": "EPD-verified emission factors, updated Q2 2024",
  "ghg_type": 1
}
```

## Example

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
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"
  }'
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
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"),
    "Content-Type": "application/json"
}

group_id = "group-uuid"

update_data = {
    "name": "Supplier ABC Materials 2024 (Updated)",
    "description": "EPD-verified emission factors, updated Q2 2024"
}

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

updated_group = response.json()
print(f"✅ Updated: {updated_group['name']}")
```

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
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,
  'Content-Type': 'application/json'
};

const groupId = 'group-uuid';

const updateData = {
  name: 'Supplier ABC Materials 2024 (Updated)',
  description: 'EPD-verified emission factors, updated Q2 2024'
};

axios.patch(
  `https://api.dcycle.io/api/v1/custom_emission_groups/${groupId}`,
  updateData,
  { headers }
)
.then(response => {
  const updatedGroup = response.data;
  console.log(`✅ Updated: ${updatedGroup.name}`);
})
.catch(error => console.error(error));
```

## Use Cases

### Update Description with Audit Trail

Add documentation updates to description:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
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:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
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

**Cause:** Custom emission group not found

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Custom emission group not found",
  "code": "NOT_FOUND"
}
```

**Solution:** Verify the group ID exists.

## Related Endpoints

> [card] [Get Group](https://code.dcycle.io/api-docs/custom-emission-groups/get)
>
> View current values

> [card] [Delete Group](https://code.dcycle.io/api-docs/custom-emission-groups/delete)
>
> Remove group


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.