Saltar al contenido principal
POST
/
api
/
v1
/
invoices
Insert or update an invoice
curl --request POST \
  --url https://www.manglai.io/api/v1/invoices \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "<string>",
  "type": "heat",
  "companyId": "<string>",
  "totalCost": 123,
  "currency": "<string>",
  "startDate": "2023-12-25",
  "endDate": "2023-12-25",
  "buildingId": "<string>",
  "cup": "<string>",
  "supplier": "<string>",
  "rawProvider": "<string>",
  "wasteType": "<string>",
  "wasteDisposalMethod": "<string>",
  "status": "valid",
  "lines": [
    {
      "quantity": 123,
      "unit": "<string>",
      "fuel": "<string>",
      "type": "<string>",
      "emissions": 123,
      "emissionFactor": 123,
      "gdo": "<string>",
      "prevGdo": "<string>",
      "regoId": "<string>",
      "renewablePercentage": 123,
      "emissionEntityId": "<string>"
    }
  ],
  "attachedFilePath": "<string>",
  "removedAt": "2023-12-25",
  "countryCode": "<string>",
  "externalId": "<string>",
  "splitPercentage": 123,
  "splitYear": 123,
  "splitId": "<string>",
  "wasValidated": true,
  "validation": {},
  "relationalId": "<string>",
  "companySplitOriginalValues": {
    "quantity": 123,
    "totalCost": 123,
    "configurationSnapshot": {}
  }
}
'
{
  "status": "ok",
  "invoice": {}
}

Autorizaciones

Authorization
string
header
requerido

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Cuerpo

application/json

Invoice data to be inserted or updated.

id
string
requerido

Unique identifier of the invoice.

type
enum<string>
requerido

Type of the invoice.

Opciones disponibles:
heat,
fuel,
electricity,
generated-energy,
process-emissions,
water,
wastes,
wastes-expenses,
others,
waste-water
companyId
string
requerido

Company associated with the invoice.

totalCost
number
requerido

Total cost of the invoice.

currency
string
requerido

Currency of the invoice (e.g., USD, EUR).

startDate
string<date>
requerido

Start date of the invoice period.

endDate
string<date>
requerido

End date of the invoice period.

buildingId
string

Building associated with the invoice.

cup
string

Unique identifier for the invoice (e.g., CUP code).

supplier
string

Supplier name.

rawProvider
string

Raw provider for the invoice.

wasteType
string

Waste type (⚠️ required only if type = waste).

wasteDisposalMethod
string

Waste disposal method (⚠️ required only if type = waste).

status
enum<string>

Invoice status.

Opciones disponibles:
valid,
draft
lines
object[]

Line items associated with the invoice.

attachedFilePath
string

Path to the attached file.

removedAt
string<date>

Date when the invoice was removed.

countryCode
string

ISO country code of the company (e.g., ES, FR).

externalId
string

External identifier for the invoice.

splitPercentage
number

Percentage for splitting the invoice.

splitYear
number

Year associated with the split.

splitId
string

Identifier of the split.

wasValidated
boolean

Indicates if the invoice was validated.

validation
object

Validation data for the invoice.

relationalId
string

Relational ID for the invoice.

companySplitOriginalValues
object

Snapshot of values before splitting. ⚠️ Optional: only provided if the invoice was split.

Respuesta

Invoice successfully inserted or updated.

status
string
Ejemplo:

"ok"

invoice
object

The invoice object