Skip to main content
PUT
Replace Invoice
← Invoices API Replaces an invoice and its split across facilities (facility_percentages) with the body you send. Send every field: one left out is cleared, except supplier_id, file_url, self_consumption, toc, base_total_spend, currency_unit_id and heat_cooling_type, which keep their stored value when left out. To change only some fields, use Update Invoice (PATCH). This is also the route that takes a file_url, to keep the invoice’s PDF with it (Invoices with a PDF).

How it works

  1. The invoice and its split are replaced together. An invoice split across facilities is a group of rows, one per facility. A facility that stays in the split keeps its row and its id; a facility added gets a new row, and one left out is deleted with its emissions.
  2. Swapping one facility for another moves its row in place. When exactly one facility leaves the split and another enters it, the row keeps its id, its comments, its project assignments and its custom-column values, and its emissions are calculated again under the new facility. Any other change of facilities deletes the rows left out and creates new ones, with new ids.
  3. The row can move to another organization: a facility of the invoice’s organization or of an organization below it is accepted. The row’s custom-column values go to that organization’s invoice columns (a column it lacks is created there). The move is refused before anything is written when the invoice would lose data on the way (see Errors).
  4. The emissions are calculated in the request, and the response carries them. A row missing a field its calculation needs ends in status: review, and one with no emission factor to calculate with in status: error; neither carries co2e.

Request

Headers

string
required
Your API key for authentication
string
required
Your organization UUID

Path Parameters

UUID
required
The invoice to replace. For an invoice split across facilities, any of its rows.

Body

string
required
Invoice type: electricity, heat, water, recharge, process or district_heat_and_steam.
number
required
Total consumption of the invoice, before the split.
UUID
required
Unit of base_quantity.
UUID
required
One of the facilities of facility_percentages: the response is its row.
date
required
Start of the invoice period, YYYY-MM-DD.
date
required
End of the invoice period, on or after start_date. A date you change follows the activity dates rule.
array
required
The split across facilities: one entry per facility, with organization_id (the facility’s organization), facility_id and percentage (more than 0 and at most 1, up to 4 decimals). The percentages add up to 1 at most; under 1, the rest of the invoice is not counted.
string
The invoice’s file: a URL Dcycle gave you (for example from the upload of the file), the one the invoice already has, or the file itself as data:<mime type>;base64,<content>, with its name in file_name. Left out, or null, the invoice keeps its file. See Invoices with a PDF.
string
The name of a file_url sent as data:, up to 255 characters (e.g. invoice-2026-09.pdf).
UUID
The invoice’s supplier, as in Create Invoice. Left out, the invoice keeps its supplier; null removes it.
string
The invoice’s number on the bill (not the id in the path).
UUID
A record of your custom emission factor databases to calculate with, instead of the default factor.
string
For water: the supply point (contract).
string
For water: the meter’s number.
number
Total spend of the invoice before the split, in currency_unit_id. It does not change the emissions.
UUID
The fiat-currency unit of base_total_spend, from GET /v2/units.
boolean
For electricity: the electricity comes from your own generation (for example photovoltaic panels).
string
For district_heat_and_steam: heat (district heating, also when it is empty) or cooling (district cooling).
stationary_fuel_id, refrigerant_fuel_id, custom_emission_factor_id, cups and toc mean what they mean in Create Invoice.

Response

200 with the row of facility_id: id, type, status, facility_id, supplier_id, uploaded_by, invoice_id, cups, water_meter_number, water_supply_point, enabled, self_consumption, heat_cooling_type, co2e (that row’s share, in kg CO₂e) and co2e_biomass. To read the other rows, use List Invoices.

Example

Successful Response

Errors

Errors keep the {"code": "...", "detail": "..."} shape of the v1 routes. A body that does not match the schema, or a changed date that breaks the activity dates rule, answers 422 with {"detail": [...]}, one entry per problem.

Update Invoice

Change some fields of an invoice

Invoices with a PDF

Keep the PDF with the invoice