Skip to main content

Create invoices

This guide explains how to create and upload an invoice associated with an existing supply point. It assumes that both the user and the supply point (userId and houseId) have already been created.

How it works

To create an invoice, you need to send a POST request to the corresponding endpoint using the houseId. The API will return a signed URL, which you can then use to upload the PDF file.

Key considerations

  • File format: The invoice must be uploaded in PDF format.
  • Dates: The startDate and endDate fields should accurately reflect the billing period.
  • Signed URL expiration: The upload link is temporary, so make sure to upload the PDF file immediately after receiving it.

Example usage

Here is the example of how to use cURL to upload an invoice:

Request to upload an invoice
curl --request POST \
--url https://connect.clever.gy/houses/houseId/invoices \
--header 'accept: application/json' \
--header 'clevergy-api-key: BIzaSyDwdq8UxE8kfi3sdcnwknccK8dlBE1ec' \
--header 'content-type: application/json' \
--data '{
"startDate": "2022-12-31",
"endDate": "2022-12-31",
"totalCost": "0.883",
"energyConsumptionP1": "0.883",
"energyConsumptionP2": "0.883",
"energyConsumptionP3": "0.883",
"totalEnergyConsumption": "0.883",
"energyCost": "0.883",
"powerCost": "0.883",
"otherCost": "0.883",
"discountCost": "0.883",
"taxCost": "0.883",
"exportSaving": "-0.25",
"serviceCost": "0.25",
"virtualWallet": "0.25"
}'

Response

The API response will include a URL for you to upload the file:

Response
{
"url": "https://signed_url_to_put_the_object"
}

Please, pay attention to the allowed format. In the case of the invoice, it must be in PDF format.

Endpoints needed

createHouseInvoice