> ## 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.

# Get Custom Emission Group

> Retrieve detailed information about a specific 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.
</Warning>

Retrieve complete details of a specific custom emission group by its ID, including metadata about the group.

<Note>
  This endpoint returns group metadata only. To get the group with all its emission factors included, use the [Organization Data](/api-docs/custom-emission-groups/organization-data) endpoint and filter by group ID.
</Note>

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `ff4adcc7-8172-45fe-9cf1-e90a6de53aa9`
</ParamField>

<ParamField header="x-user-id" type="string" required>
  Your user UUID

  **Example:** `a1b2c3d4-e5f6-7890-abcd-ef1234567890`
</ParamField>

### Path Parameters

<ParamField path="id" type="string" required>
  UUID of the Custom Emission Group

  **Example:** `"group-uuid-here"`
</ParamField>

## Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "group-uuid",
  "name": "Supplier ABC Materials 2024",
  "category": "purchases",
  "description": "EPD-verified emission factors for all materials from Supplier ABC",
  "group_start_date": "2024-01-01",
  "group_end_date": "2024-12-31",
  "ghg_type": 1,
  "group_uploaded_by": "procurement@company.com"
}
```

## Example

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

  ```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")
  }

  group_id = "group-uuid"

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

  group = response.json()
  print(f"Group: {group['name']}")
  print(f"Category: {group['category']}")
  print(f"GHG Type: {group['ghg_type']}")
  print(f"Valid: {group['group_start_date']} to {group['group_end_date']}")
  ```

  ```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
  };

  const groupId = 'group-uuid';

  axios.get(
    `https://api.dcycle.io/api/v1/custom_emission_groups/${groupId}`,
    { headers }
  )
  .then(response => {
    const group = response.data;
    console.log(`Group: ${group.name}`);
    console.log(`Category: ${group.category}`);
    console.log(`GHG Type: ${group.ghg_type}`);
    console.log(`Valid: ${group.group_start_date} to ${group.group_end_date}`);
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

## Use Cases

### Verify Group Details

Check group information before adding factors:

```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()

if group['category'] == 'purchases':
    print(f"✅ Correct category for adding purchase factors")
else:
    print(f"❌ Wrong category: {group['category']}")

ghg_type_name = {1: 'Fossil', 2: 'Biogenic', 3: 'Mixed'}[group['ghg_type']]
print(f"GHG Type: {ghg_type_name}")
```

### Display Group Information

Show group details in a UI:

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
async function displayGroupInfo(groupId) {
  const group = await axios.get(
    `https://api.dcycle.io/api/v1/custom_emission_groups/${groupId}`,
    { headers }
  ).then(res => res.data);

  document.getElementById('group-name').textContent = group.name;
  document.getElementById('group-desc').textContent = group.description;
  document.getElementById('group-category').textContent = group.category.toUpperCase();

  const ghgTypes = {1: 'Fossil', 2: 'Biogenic', 3: 'Mixed'};
  document.getElementById('group-ghg').textContent = ghgTypes[group.ghg_type];
}
```

### Audit Group Metadata

Check group validity and ownership:

```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

print(f"Group: {group['name']}")
print(f"Created by: {group.get('group_uploaded_by', 'Unknown')}")

if group['group_start_date'] and group['group_end_date']:
    start = date.fromisoformat(group['group_start_date'])
    end = date.fromisoformat(group['group_end_date'])
    today = date.today()

    if start <= today <= end:
        print(f"✅ Group is currently valid")
    elif today < start:
        print(f"⏳ Group not yet valid (starts {start})")
    else:
        print(f"❌ Group expired (ended {end})")
else:
    print(f"ℹ️ No validity period set")
```

## 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 using the list endpoint.

### 403 Forbidden

**Cause:** Insufficient permissions

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Insufficient permissions",
  "code": "FORBIDDEN"
}
```

**Solution:** Ensure the group belongs to your organization.

## Response Fields

<ResponseField name="id" type="string">
  Unique identifier for the group
</ResponseField>

<ResponseField name="name" type="string">
  Group name
</ResponseField>

<ResponseField name="category" type="string">
  Category type: `purchases`, `wastes`, or `energy`
</ResponseField>

<ResponseField name="description" type="string">
  Detailed description of the group
</ResponseField>

<ResponseField name="ghg_type" type="integer">
  GHG origin type: `1` (fossil), `2` (biogenic), or `3` (mixed)
</ResponseField>

<ResponseField name="group_start_date" type="date">
  Optional validity start date (YYYY-MM-DD)
</ResponseField>

<ResponseField name="group_end_date" type="date">
  Optional validity end date (YYYY-MM-DD)
</ResponseField>

<ResponseField name="group_uploaded_by" type="string">
  Optional reference to who created the group
</ResponseField>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Update Group" icon="pen" href="/api-docs/custom-emission-groups/update">
    Modify group metadata
  </Card>

  <Card title="Delete Group" icon="trash" href="/api-docs/custom-emission-groups/delete">
    Remove group
  </Card>

  <Card title="List Factors" icon="list" href="/api-docs/custom-emission-factors/list">
    View factors in group
  </Card>

  <Card title="Add Factor" icon="plus" href="/api-docs/custom-emission-factors/create">
    Add factor to group
  </Card>
</CardGroup>


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