Skip to main content
GET
/
v1
/
historical-emissions
List Historical Emissions
const options = {
  method: 'GET',
  headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};

fetch('https://api.dcycle.io/v1/historical-emissions', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
import requests

url = "https://api.dcycle.io/v1/historical-emissions"

headers = {
    "x-api-key": "<x-api-key>",
    "x-organization-id": "<x-organization-id>"
}

response = requests.get(url, headers=headers)

print(response.text)
curl --request GET \
  --url https://api.dcycle.io/v1/historical-emissions \
  --header 'x-api-key: <x-api-key>' \
  --header 'x-organization-id: <x-organization-id>'
{
  "items": {
    "id": "<string>",
    "organization_id": "<string>",
    "start_date": "<string>",
    "end_date": "<string>",
    "scope": 123,
    "category": "<string>",
    "total_co2e": 123,
    "description": {},
    "ghg_gas": "<string>",
    "ghg_type": 123,
    "enabled": true,
    "co2e": {},
    "file_id": {},
    "created_at": {},
    "updated_at": {}
  },
  "total": 123
}

List Historical Emissions

Retrieve all historical emission entries for your organization, including the calculated CO2e from total impacts when available.

Request

Headers

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Response

items
array[object]
List of historical emission entries
total
integer
Total number of entries

Example

curl -X GET "https://api.dcycle.io/v1/historical-emissions" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os

headers = {
    "x-api-key": os.getenv("DCYCLE_API_KEY"),
    "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
}

response = requests.get(
    "https://api.dcycle.io/v1/historical-emissions",
    headers=headers,
)

data = response.json()
print(f"Total entries: {data['total']}")
for item in data["items"]:
    print(f"  [{item['category']}] {item['start_date']}{item['end_date']}: {item['total_co2e']} kg CO2e")
const axios = require('axios');

const headers = {
  'x-api-key': process.env.DCYCLE_API_KEY,
  'x-organization-id': process.env.DCYCLE_ORG_ID,
};

axios.get('https://api.dcycle.io/v1/historical-emissions', { headers })
  .then(response => {
    const { items, total } = response.data;
    console.log(`Total: ${total}`);
    items.forEach(i => console.log(`  [${i.category}] ${i.total_co2e} kg CO2e`));
  });

Successful Response

{
  "items": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "organization_id": "a8315ef3-dd50-43f8-b7ce-d839e68d51fa",
      "start_date": "2022-01-01",
      "end_date": "2022-12-31",
      "scope": 2,
      "category": "electricity",
      "total_co2e": 45200.5,
      "description": "2022 electricity consumption from utility bills",
      "ghg_gas": "co2e",
      "ghg_type": 0,
      "enabled": true,
      "co2e": 45200.5,
      "file_id": null,
      "file_url": null,
      "file_name": null,
      "created_at": "2024-03-15T10:30:00Z",
      "updated_at": null
    }
  ],
  "total": 1
}

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}

403 Forbidden

Cause: The authenticated user is not a member of the organization
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}

Create

Add a new historical emission entry

Emissions Summary

View calculated emissions across all sources