Invoices API
The Invoices API allows you to retrieve, update, and delete invoice records for tracking Scope 1 (direct emissions) and Scope 2 (indirect emissions from purchased energy) emissions. Invoices track energy consumption from various sources including electricity, natural gas, fuel deliveries, and water.GHG Protocol Scope 1 & 2Invoices cover emissions from energy consumption at your facilities:
- Scope 1: Direct emissions from fuel combustion (natural gas, fuel deliveries)
- Scope 2: Indirect emissions from purchased electricity
Key Features
- Invoice Management: Retrieve and manage invoice records
- Multiple Invoice Types: Support for electricity, heat (natural gas, fuel delivery), and water
- Facility Association: Link invoices to specific facilities for accurate emissions allocation
- Filtering & Pagination: Efficiently query large invoice datasets
- CO2e Tracking: View calculated emissions for each invoice
Authentication
All endpoints require authentication using either:- API Key: Include in
x-api-keyheader - JWT Token: Include in
Authorizationheader asBearer {JWT_TOKEN}
Headers
All requests must include:Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faYour API key for authenticationExample:
sk_live_1234567890abcdefAvailable Endpoints
List Invoices
Retrieve all invoices with filtering and pagination
Get Invoice
Get a specific invoice by ID
Update Invoice
Modify invoice details
Delete Invoice
Remove an invoice from your organization
Data Model
Invoice Object
The invoice object contains detailed information about an energy or utility invoice:Invoice Attributes
| Field | Type | Description |
|---|---|---|
id | UUID | Unique identifier for the invoice |
type | string | Invoice type: heat, electricity, water, recharge |
status | string | Invoice status (see Status Types) |
quantity | float | Consumption amount |
base_quantity | float | Base quantity before facility allocation |
unit_id | UUID | Unit of measurement |
start_date | datetime | Billing period start date |
end_date | datetime | Billing period end date |
invoice_id | string | Invoice number from the utility provider |
facility_id | UUID | Associated facility |
facility_fuel_id | UUID | Fuel type (for combustion invoices) |
supplier_id | UUID | Energy supplier |
custom_emission_factor_id | UUID | Custom emission factor (if applicable) |
co2e | float | Calculated CO2 equivalent emissions (kg) |
co2e_biomass | float | CO2e from biomass sources (kg) |
cups | string | CUPS code (for Spanish electricity) |
file_id | UUID | Linked file/document ID |
file_url | string | URL to download linked file |
uploaded_by | UUID | User who uploaded the invoice |
percentage | float | Facility allocation percentage (0-1) |
enabled | boolean | Whether invoice is enabled |
created_at | datetime | When the invoice was created |
updated_at | datetime | When the invoice was last updated |
Invoice Types
| Type | Description | GHG Scope |
|---|---|---|
heat | Natural gas and fuel delivery invoices | Scope 1 |
electricity | Electricity consumption invoices | Scope 2 |
water | Water consumption invoices | Scope 3 (if applicable) |
recharge | Electric vehicle recharging | Scope 2 |
Status Types
| Status | Description |
|---|---|
uploaded | Invoice uploaded, awaiting processing |
loading | Invoice being processed |
active | Invoice active and included in calculations |
inactive | Invoice inactive (excluded from calculations) |
review | Invoice under review |
error | Error occurred during processing |
CO2e Calculation
Emissions are calculated based on invoice type and associated emission factors:Electricity (Scope 2)
Heat/Combustion (Scope 1)
Error Handling
Common HTTP Status Codes
| Status | Meaning | Solution |
|---|---|---|
| 200 | Success | - |
| 204 | No Content (delete successful) | - |
| 400 | Bad Request | Check request parameters and format |
| 401 | Unauthorized | Verify API key |
| 403 | Forbidden | Invoice doesn’t belong to your organization |
| 404 | Not Found | Check resource ID |
| 422 | Validation Error | Review error details in response |
| 500 | Server Error | Contact support if persists |

