Fahrtenbuch

Expenses

List vehicle expenses

GET
/expenses

Nur verfügbar, wenn features.expenses in /config/services true ist (sonst 404 FEATURE_DISABLED). Tank-/Ladevorgänge und sonstige Fahrzeugkosten des angemeldeten Benutzers (nur eigene Fahrzeuge), neueste zuerst.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Query Parameters

vehicleId?string
Formatuuid
from?string
Formatdate
to?string
Formatdate
category?string
Value in"fuel""charging""insurance""tax""maintenance""repair""tires""leasing""financing""parking""toll""cleaning""inspection""other"

Response Body

Kosteneinträge

application/json
  1. response
[index: integer]?
Example Request
curl -X GET 'https://example.com/api/v1/expenses'
Example Response200
[  {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",    "vehicleName": "string",    "category": "fuel",    "date": "2019-08-24",    "amount": 0,    "amountCents": 0,    "currency": "string",    "odometerKm": 0,    "quantity": 0,    "quantityUnit": "string",    "pricePerUnit": 0,    "fuelType": "string",    "fullTank": true,    "periodStart": "2019-08-24",    "periodEnd": "2019-08-24",    "tripId": "ab93ac19-a7bf-4885-87b6-6dcba80ee2d5",    "vendor": "string",    "notes": "string",    "source": "manual",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }]

Create vehicle expense

POST
/expenses

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Request Body

application/json
  1. body

Bei POST sind vehicleId, category, date und amount Pflicht. Tankfelder gelten nur für fuel/charging.

vehicleId?string
Formatuuid
category?ExpenseCategory
Value in"fuel""charging""insurance""tax""maintenance""repair""tires""leasing""financing""parking""toll""cleaning""inspection""other"
date?string
Formatdate
amount?number

Bruttobetrag in der angegebenen Währung

Range0 <= value
currency?string
Match^[A-Z]{3}$
Default"EUR"
odometerKm?|
Range0 <= value
quantity?|
Range0 < value
quantityUnit?|

Standard l (fuel) bzw. kwh (charging)

Value in"l""kwh""kg"null
fuelType?|
Value in"petrol""diesel""lpg""cng""electric""hydrogen""other"null
fullTank?boolean
Defaultfalse
periodStart?|
Formatdate
periodEnd?|
Formatdate
tripId?|
Formatuuid
vendor?|
Lengthlength <= 200
notes?|
Lengthlength <= 2000

Response Body

Kosteneintrag angelegt

application/json
  1. response
id?string
Formatuuid
vehicleId?string
Formatuuid
vehicleName?string
category?ExpenseCategory
Value in"fuel""charging""insurance""tax""maintenance""repair""tires""leasing""financing""parking""toll""cleaning""inspection""other"
date?string
Formatdate
amount?number
amountCents?integer
currency?string
odometerKm?number|null
quantity?number|null
quantityUnit?string|null
pricePerUnit?number|null
fuelType?string|null
fullTank?boolean
periodStart?|
Formatdate
periodEnd?|
Formatdate
tripId?|
Formatuuid
vendor?string|null
notes?string|null
source?string
Value in"manual""csv_import"
createdAt?string
Formatdate-time
updatedAt?string
Formatdate-time
Example Request
curl -X POST 'https://example.com/api/v1/expenses' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",  "vehicleName": "string",  "category": "fuel",  "date": "2019-08-24",  "amount": 0,  "amountCents": 0,  "currency": "string",  "odometerKm": 0,  "quantity": 0,  "quantityUnit": "string",  "pricePerUnit": 0,  "fuelType": "string",  "fullTank": true,  "periodStart": "2019-08-24",  "periodEnd": "2019-08-24",  "tripId": "ab93ac19-a7bf-4885-87b6-6dcba80ee2d5",  "vendor": "string",  "notes": "string",  "source": "manual",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}
GET
/expenses/summary

Gesamtkosten je Kategorie und Währung, Kosten pro km, Kostenanteil je Fahrtart (nach gefahrenen km), Energiemengen und Durchschnittsverbrauch (Volltank-Methode). Kosten mit Leistungszeitraum werden tagesgenau anteilig verteilt. Standardzeitraum ist das aktuelle Kalenderjahr in der Kontozeitzone.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Query Parameters

vehicleId*string
Formatuuid
from?string
Formatdate
to?string
Formatdate

Response Body

Kostenauswertung

application/json
  1. response
vehicleId?string
Formatuuid
from?string
Formatdate
to?string
Formatdate
timeZone?string
distance?
costs?array<>
energy?array<>
consumption?array<>
Example Request
curl -X GET 'https://example.com/api/v1/expenses/summary?vehicleId=497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response200
{  "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",  "from": "2019-08-24",  "to": "2019-08-24",  "timeZone": "string",  "distance": {    "totalKm": 0,    "tripCount": 0,    "byTripType": {      "property1": 0,      "property2": 0    },    "shares": {      "property1": 0,      "property2": 0    }  },  "costs": [    {      "currency": "string",      "total": 0,      "costPerKm": 0,      "byCategory": [        {          "category": "fuel",          "amount": 0,          "entries": 0        }      ],      "byTripType": {        "property1": 0,        "property2": 0      }    }  ],  "energy": [    {      "unit": "string",      "currency": "string",      "quantity": 0,      "amount": 0,      "entries": 0,      "averagePricePerUnit": 0    }  ],  "consumption": [    {      "unit": "string",      "quantity": 0,      "distanceKm": 0,      "intervals": 0,      "per100Km": 0    }  ]}
POST
/expenses/import/preview

Liest eine CSV-Datei (z. B. Spritmonitor-Export von Tankungen oder Kosten, deutsch oder englisch) und liefert erkannte Spaltenzuordnung, Formate, Zählwerte, Fehler/Hinweise und eine Vorschau. Es wird nichts gespeichert. Bereits vorhandene Einträge werden als Duplikate erkannt.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Request Body

application/json
  1. body
vehicleId*string
Formatuuid
content*string

CSV-Datei Base64-kodiert (max. 3 MB). UTF-8 oder Windows-1252.

Formatbyte
mapping?

Optionale Spaltenzuordnung Feld → Spaltenindex (0-basiert). Ohne Angabe wird sie aus der Kopfzeile erkannt.

kind?string

Tankungen oder sonstige Kosten

Value in"fuel""costs"
energy?string
Default"fuel_l"
Value in"fuel_l""fuel_kg""charging_kwh"
dateFormat?string
Value in"DD.MM.YYYY""YYYY-MM-DD""DD/MM/YYYY""MM/DD/YYYY"
decimalSeparator?string
Value in",""."
currency?string

Währung, falls die Datei keine enthält

Match^[A-Z]{3}$

Response Body

Importvorschau

application/json
  1. response
source?string
Value in"spritmonitor""generic"
encoding?string
delimiter?string
headers?array<string>
sampleRows?array<array<string>>
mapping?
options?
missingRequired?array<string>
counts?
dateRange?|null
errors?array<>
warnings?array<>
preview?array<>
Example Request
curl -X POST 'https://example.com/api/v1/expenses/import/preview' \  -H 'Content-Type: application/json' \  -d '{  "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",  "content": "string"}'
Example Response
{  "source": "spritmonitor",  "encoding": "string",  "delimiter": "string",  "headers": [    "string"  ],  "sampleRows": [    [      "string"    ]  ],  "mapping": {    "property1": 0,    "property2": 0  },  "options": {},  "missingRequired": [    "string"  ],  "counts": {    "rows": 0,    "valid": 0,    "new": 0,    "duplicates": 0,    "errors": 0,    "warnings": 0,    "fullTanks": 0  },  "dateRange": {},  "errors": [    {      "line": 0,      "message": "string"    }  ],  "warnings": [    {      "line": 0,      "message": "string"    }  ],  "preview": [    {}  ]}
POST
/expenses/import

Importiert alle gültigen, noch nicht vorhandenen Zeilen in einer Transaktion (Quelle csv_import). Fehlerhafte Zeilen werden übersprungen und gemeldet.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Request Body

application/json
  1. body
vehicleId*string
Formatuuid
content*string

CSV-Datei Base64-kodiert (max. 3 MB). UTF-8 oder Windows-1252.

Formatbyte
mapping?

Optionale Spaltenzuordnung Feld → Spaltenindex (0-basiert). Ohne Angabe wird sie aus der Kopfzeile erkannt.

kind?string

Tankungen oder sonstige Kosten

Value in"fuel""costs"
energy?string
Default"fuel_l"
Value in"fuel_l""fuel_kg""charging_kwh"
dateFormat?string
Value in"DD.MM.YYYY""YYYY-MM-DD""DD/MM/YYYY""MM/DD/YYYY"
decimalSeparator?string
Value in",""."
currency?string

Währung, falls die Datei keine enthält

Match^[A-Z]{3}$

Response Body

Import abgeschlossen

application/json
  1. response
imported?integer
duplicates?integer
errors?array<>
warnings?array<>
Example Request
curl -X POST 'https://example.com/api/v1/expenses/import' \  -H 'Content-Type: application/json' \  -d '{  "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",  "content": "string"}'
Example Response
{  "imported": 0,  "duplicates": 0,  "errors": [    {      "line": 0,      "message": "string"    }  ],  "warnings": [    {      "line": 0,      "message": "string"    }  ]}

Get vehicle expense

GET
/expenses/{id}

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Path Parameters

id*string
Formatuuid

Response Body

Kosteneintrag

application/json
  1. response
id?string
Formatuuid
vehicleId?string
Formatuuid
vehicleName?string
category?ExpenseCategory
Value in"fuel""charging""insurance""tax""maintenance""repair""tires""leasing""financing""parking""toll""cleaning""inspection""other"
date?string
Formatdate
amount?number
amountCents?integer
currency?string
odometerKm?number|null
quantity?number|null
quantityUnit?string|null
pricePerUnit?number|null
fuelType?string|null
fullTank?boolean
periodStart?|
Formatdate
periodEnd?|
Formatdate
tripId?|
Formatuuid
vendor?string|null
notes?string|null
source?string
Value in"manual""csv_import"
createdAt?string
Formatdate-time
updatedAt?string
Formatdate-time
Example Request
curl -X GET 'https://example.com/api/v1/expenses/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",  "vehicleName": "string",  "category": "fuel",  "date": "2019-08-24",  "amount": 0,  "amountCents": 0,  "currency": "string",  "odometerKm": 0,  "quantity": 0,  "quantityUnit": "string",  "pricePerUnit": 0,  "fuelType": "string",  "fullTank": true,  "periodStart": "2019-08-24",  "periodEnd": "2019-08-24",  "tripId": "ab93ac19-a7bf-4885-87b6-6dcba80ee2d5",  "vendor": "string",  "notes": "string",  "source": "manual",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}

Update vehicle expense

PATCH
/expenses/{id}

Teil-Update; nicht übergebene Felder bleiben unverändert.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Path Parameters

id*string
Formatuuid

Request Body

application/json
  1. body

Bei POST sind vehicleId, category, date und amount Pflicht. Tankfelder gelten nur für fuel/charging.

vehicleId?string
Formatuuid
category?ExpenseCategory
Value in"fuel""charging""insurance""tax""maintenance""repair""tires""leasing""financing""parking""toll""cleaning""inspection""other"
date?string
Formatdate
amount?number

Bruttobetrag in der angegebenen Währung

Range0 <= value
currency?string
Match^[A-Z]{3}$
Default"EUR"
odometerKm?|
Range0 <= value
quantity?|
Range0 < value
quantityUnit?|

Standard l (fuel) bzw. kwh (charging)

Value in"l""kwh""kg"null
fuelType?|
Value in"petrol""diesel""lpg""cng""electric""hydrogen""other"null
fullTank?boolean
Defaultfalse
periodStart?|
Formatdate
periodEnd?|
Formatdate
tripId?|
Formatuuid
vendor?|
Lengthlength <= 200
notes?|
Lengthlength <= 2000

Response Body

Kosteneintrag aktualisiert

application/json
  1. response
id?string
Formatuuid
vehicleId?string
Formatuuid
vehicleName?string
category?ExpenseCategory
Value in"fuel""charging""insurance""tax""maintenance""repair""tires""leasing""financing""parking""toll""cleaning""inspection""other"
date?string
Formatdate
amount?number
amountCents?integer
currency?string
odometerKm?number|null
quantity?number|null
quantityUnit?string|null
pricePerUnit?number|null
fuelType?string|null
fullTank?boolean
periodStart?|
Formatdate
periodEnd?|
Formatdate
tripId?|
Formatuuid
vendor?string|null
notes?string|null
source?string
Value in"manual""csv_import"
createdAt?string
Formatdate-time
updatedAt?string
Formatdate-time
Example Request
curl -X PATCH 'https://example.com/api/v1/expenses/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "vehicleId": "c406adf4-e700-4483-ad7a-e7447a2941cb",  "vehicleName": "string",  "category": "fuel",  "date": "2019-08-24",  "amount": 0,  "amountCents": 0,  "currency": "string",  "odometerKm": 0,  "quantity": 0,  "quantityUnit": "string",  "pricePerUnit": 0,  "fuelType": "string",  "fullTank": true,  "periodStart": "2019-08-24",  "periodEnd": "2019-08-24",  "tripId": "ab93ac19-a7bf-4885-87b6-6dcba80ee2d5",  "vendor": "string",  "notes": "string",  "source": "manual",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}

Delete vehicle expense

DELETE
/expenses/{id}

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Path Parameters

id*string
Formatuuid

Response Body

Gelöscht

Example Request
curl -X DELETE 'https://example.com/api/v1/expenses/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
Empty