Skip to main content
POST
Create Records From File Reading
← Files This endpoint converts the parsed readings of ONE file into downstream business records:
  • water, electricity, gas, fuel delivery, or recharge invoices
  • waste records
Facility linking happens here. You provide the target facilities and allocation percentages, and the created invoices or wastes are stored with those facility IDs. Saving replaces every record previously created from the file, so the request carries every reading of the file. Today a file has one reading, so that is one item; see Files with several readings.

Request

Headers

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

Body

object[]
required
The readings of one file: all of them, each once. At least one item.
string
required
File reading UUID returned in reading.id (or classifications[].reading.id) from GET /v1/files/readings.
integer[]
Positions (from 0) of the items of this reading’s content.items to leave out.
string
Supplier for the records of this reading. Same meaning as the top-level supplier_id, which it overrides.
string
Fuel for the records of a stationary combustion reading.
string
Gas for the records of a recharges reading.
string
Custom emission factor for the records of this reading.
object[]
Facilities for the records of this reading, with the shape of the top-level facilities, which it overrides.
object[]
required
Facilities to link to the created records.
string
required
Facility UUID.
number
required
Allocation percentage as a decimal between 0 and 1. The total must be less than or equal to 1.0.
string
Optional project UUID. When present, created invoices are also linked to that project.Retrieve available options from GET /v1/projects/extended
string
Optional supplier UUID. Only used for electricity readings. When provided, it overrides the supplier_id extracted from the file reading content. Required when any target facility is located in Spain and the reading did not resolve a supplier automatically.Retrieve available options from GET /api/v1/suppliers — electricity retailers

Response

Returns an array of the created records (HTTP 201), in the order of the file’s classifications. The exact shape depends on the category of each reading — invoices for energy categories, waste records for document::wastes.

Files with several readings

Every file has one classification and one reading today, and no endpoint creates a second one yet. This section describes the contract a file that bills several services (water and gas on one invoice) will follow, so an integration written now keeps working.
  • Send all the readings of the file in file_readings. A request that leaves one out is refused with 409 FILE_READINGS_INCOMPLETE and nothing is deleted or created.
  • Every reading must be read successfully: 409 FILE_READINGS_NOT_READY otherwise.
  • With more than one reading, the supplier, fuel and custom emission factor go on each reading. The top-level supplier_id is refused with 422 REVIEW_DECISIONS_MUST_BE_PER_READING, because it cannot say which reading it is for. The top-level facilities still applies to every reading that sends none of its own.
  • The readings of two different files in one request are refused with 400 MULTIPLE_FILES_NOT_SUPPORTED.
  • The records of all the readings are created together or not at all.

Example

Behavior by Category

  • invoice::water creates water invoices
  • invoice::electricity creates electricity invoices
  • invoice::stationary_combustion (and invoice::gas / invoice::fuel_delivery, its labels before the merge) creates combustion invoices, one per fuel line, with each line’s fuel
  • invoice::recharges creates recharge invoices
  • document::wastes creates waste records
The endpoint determines the category of each reading from its own classification, not from the request body.

Common Errors

401 Unauthorized

Cause: Missing or invalid API key

403 Forbidden

Cause: The authenticated user is not a member of the organization

400 Bad Request

Cause: The readings belong to more than one file

409 Conflict

Cause: The request does not carry exactly the readings the file has now. Either one is missing, or one no longer exists: reprocessing a file deletes its readings, so a save that arrives after a reprocess is refused instead of creating records from a reading that is gone. Fetch the readings again and resend.
Cause: A classification of the file is still being read, or its reading failed

422 Unprocessable Entity

Cause: A top-level supplier_id (or fuel, or custom emission factor) with more than one reading
Cause: Missing required fields (file_readings, facilities), an empty or repeated file_readings, or invalid allocation percentages
  • This endpoint requires a successful file reading with content.items.
  • For Spain electricity facilities, supplier information may still be required depending on the extracted reading.
  • After records are created, the file will appear as linked=true in GET /v1/files/readings.

List File Readings

Retrieve readings to get file reading IDs

Update Reading

Edit extracted content before creating records

Upload Files

Upload new files via presigned S3 URLs

List Invoices

View invoices created from file readings