Hands-on15 min
Hands-on: Build a Carbon Audit Trail
🛡️ Module 4: Carbon Attestation & Compliance
Hands-on: Build a Carbon Audit Trail
Open your terminal. You are going to create carbon records, verify the hash chain, and generate a Scope 2 report.
Setup
export EAT_KEY="eat_test_YOUR_KEY_HERE"Exercise 1: Create 3 Carbon Records
# Record 1: Morning reading
curl -X POST -H "Authorization: $EAT_KEY" \
-H "Content-Type: application/json" \
-d '{"meter_id": "lab-meter-001", "facility_id": "00000000-0000-0000-0000-000000000001", "timestamp": "2026-02-27T08:00:00Z", "kwh": 500}' \
https://app.energyatit.com/api/v1/carbon/record | python3 -m json.tool
# Record 2: Midday reading
curl -X POST -H "Authorization: $EAT_KEY" \
-H "Content-Type: application/json" \
-d '{"meter_id": "lab-meter-001", "facility_id": "00000000-0000-0000-0000-000000000001", "timestamp": "2026-02-27T12:00:00Z", "kwh": 750}' \
https://app.energyatit.com/api/v1/carbon/record | python3 -m json.tool
# Record 3: Evening reading
curl -X POST -H "Authorization: $EAT_KEY" \
-H "Content-Type: application/json" \
-d '{"meter_id": "lab-meter-001", "facility_id": "00000000-0000-0000-0000-000000000001", "timestamp": "2026-02-27T18:00:00Z", "kwh": 600}' \
https://app.energyatit.com/api/v1/carbon/record | python3 -m json.tool# Record 1: Morning reading
curl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"meter_id": "lab-meter-001", "facility_id": "00000000-0000-0000-0000-000000000001", "timestamp": "2026-02-27T08:00:00Z", "kwh": 500}" "https://app.energyatit.com/api/v1/carbon/record" | ConvertFrom-Json | ConvertTo-Json -Depth 10
# Record 2: Midday reading
curl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"meter_id": "lab-meter-001", "facility_id": "00000000-0000-0000-0000-000000000001", "timestamp": "2026-02-27T12:00:00Z", "kwh": 750}" "https://app.energyatit.com/api/v1/carbon/record" | ConvertFrom-Json | ConvertTo-Json -Depth 10
# Record 3: Evening reading
curl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"meter_id": "lab-meter-001", "facility_id": "00000000-0000-0000-0000-000000000001", "timestamp": "2026-02-27T18:00:00Z", "kwh": 600}" "https://app.energyatit.com/api/v1/carbon/record" | ConvertFrom-Json | ConvertTo-Json -Depth 10Exercise 2: Verify the Hash Chain
curl -H "Authorization: $EAT_KEY" \
https://app.energyatit.com/api/v1/carbon/verify/lab-meter-001 | python3 -m json.toolcurl.exe -H "Authorization: $env:EAT_KEY" "https://app.energyatit.com/api/v1/carbon/verify/lab-meter-001" | ConvertFrom-Json | ConvertTo-Json -Depth 10Expected: "valid": true with 3 records checked.
Exercise 3: Get Carbon Attestation Summary
curl -H "Authorization: $EAT_KEY" \
"https://app.energyatit.com/api/v1/carbon/records/00000000-0000-0000-0000-000000000001" | python3 -m json.toolcurl.exe -H "Authorization: $env:EAT_KEY" "https://app.energyatit.com/api/v1/carbon/records/00000000-0000-0000-0000-000000000001" | ConvertFrom-Json | ConvertTo-Json -Depth 10Exercise 4: Generate a Carbon Certificate
curl -X POST -H "Authorization: $EAT_KEY" \
-H "Content-Type: application/json" \
-d '{"facility_id": "00000000-0000-0000-0000-000000000001", "start": "2026-02-01", "end": "2026-02-28"}' \
https://app.energyatit.com/api/v1/carbon/certificate | python3 -m json.toolcurl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"facility_id": "00000000-0000-0000-0000-000000000001", "start": "2026-02-01", "end": "2026-02-28"}" "https://app.energyatit.com/api/v1/carbon/certificate" | ConvertFrom-Json | ConvertTo-Json -Depth 10Verification
Lab complete if: 3 records created, hash chain valid, certificate generated.
Open Hands-on Lab
Complete the exercise in the Developer Hub.
Log in to track your progress and earn certifications.