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

> Retrieve detailed information about a specific custom emission factor

# Get Custom Emission Factor

Retrieve complete details of a specific custom emission factor by its ID, including all emission values and associated unit information.

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

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

## Response

Returns the custom emission factor object with complete details including the unit object.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "factor-uuid",
  "factor_id": "factor-uuid",
  "ef_name": "Recycled Aluminum - Supplier ABC",
  "unit_id": "kg-unit-uuid",
  "unit": {
    "id": "kg-unit-uuid",
    "name": "kilogram",
    "abbreviation": "kg",
    "type": "mass"
  },
  "factor_uploaded_by": "sustainability@company.com",
  "tag": "advanced",
  "uncertainty_grade": 15.0,
  "factor_start_date": "2024-01-01",
  "factor_end_date": "2024-12-31",
  "additional_docs": "EPD No. ABC-2024-001",
  "emission_factor_values": [
    {
      "gas_type": "CO2",
      "value": 2.15
    },
    {
      "gas_type": "CH4",
      "value": 0.008
    },
    {
      "gas_type": "N2O",
      "value": 0.002
    }
  ],
  "recycled": true,
  "renewable_percentage": null,
  "hazardous": null,
  "low_code": null,
  "rd_code": null
}
```

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl "https://api.dcycle.io/api/v1/custom_emission_factors/factor-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")
  }

  factor_id = "factor-uuid"

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

  factor = response.json()
  print(f"{factor['ef_name']}")
  print(f"Unit: {factor['unit']['abbreviation']}")
  print(f"Uncertainty: {factor['uncertainty_grade']}%")

  # Calculate total CO2e
  co2_value = next((v['value'] for v in factor['emission_factor_values'] if v['gas_type'] == 'CO2'), 0)
  print(f"CO2 emission: {co2_value} kg CO2/{factor['unit']['abbreviation']}")
  ```

  ```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 factorId = 'factor-uuid';

  axios.get(
    `https://api.dcycle.io/api/v1/custom_emission_factors/${factorId}`,
    { headers }
  )
  .then(response => {
    const factor = response.data;
    console.log(factor.ef_name);
    console.log(`Unit: ${factor.unit.abbreviation}`);
    console.log(`Uncertainty: ${factor.uncertainty_grade}%`);

    const co2Value = factor.emission_factor_values.find(v => v.gas_type === 'CO2')?.value || 0;
    console.log(`CO2 emission: ${co2Value} kg CO2/${factor.unit.abbreviation}`);
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

## Use Cases

### Audit and Verification

Retrieve factor details for compliance audits:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
factor = requests.get(
    f"https://api.dcycle.io/api/v1/custom_emission_factors/{factor_id}",
    headers=headers
).json()

print(f"Factor: {factor['ef_name']}")
print(f"Source: {factor['additional_docs']}")
print(f"Uploaded by: {factor['factor_uploaded_by']}")
print(f"Valid: {factor['factor_start_date']} to {factor['factor_end_date']}")
```

### Display in UI

Show factor details to users:

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const factor = await axios.get(
  `https://api.dcycle.io/api/v1/custom_emission_factors/${factorId}`,
  { headers }
).then(res => res.data);

// Display in UI
document.getElementById('factor-name').textContent = factor.ef_name;
document.getElementById('factor-unit').textContent = factor.unit.name;
document.getElementById('factor-uncertainty').textContent = `${factor.uncertainty_grade}%`;
```

## Common Errors

### 404 Not Found

**Cause:** Custom emission factor not found

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

**Solution:** Verify the factor ID exists using the list endpoint.

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Update Factor" icon="pen" href="/api-docs/custom-emission-factors/update">
    Modify factor values
  </Card>

  <Card title="Delete Factor" icon="trash" href="/api-docs/custom-emission-factors/delete">
    Remove factor
  </Card>

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

  <Card title="Overview" icon="book" href="/api-docs/custom-emission-factors/overview">
    Learn about custom factors
  </Card>
</CardGroup>
