Vai al contenuto
Riferimento API

Tarife

8 endpoint

Le descrizioni degli endpoint provengono direttamente dall'API e sono in tedesco.

Tarife auflisten

get/v1/tariffs

Aktive Tarife mit aktueller Version.

Risposta 200TariffList

NomeTipoDescrizione
objectobbligatorio"list"
dataobbligatorioTariff[]
has_moreobbligatorioboolean

Errori possibili

  • 400 Anfrage ungültig
  • 401 Nicht angemeldet
  • 403 Berechtigung fehlt
  • 404 Nicht gefunden
  • 409 Zustand passt nicht
  • 429 Zu viele Anfragen
Esempio
curl -X GET https://api.ladehase.com/v1/tariffs \n  -H "Authorization: Bearer lh_test_…"
Risposta 200
{
  "object": "list",
  "data": [
    {
      "id": "trf_5e2a8b1c9d0f3e7a",
      "object": "tariff",
      "name": "string",
      "description": "string",
      "version": 0,
      "version_id": "string",
      "rules": {},
      "archived": true,
      "created_at": "string",
      "updated_at": "string"
    }
  ],
  "has_more": true
}

Tarif anlegen

post/v1/tariffs

Tarifregeln: `energyPrice` in Hundertstel-Rappen pro kWh (4500 = 45 Rappen), `startFee` und `serviceFee` in Rappen, `timeWindows` für zeitabhängige Preise, `idleFee` für die Standzeitgebühr, `maxAmount` als Höchstbetrag. Preise inkl. MWST.

Parametri

NomePosizioneTipo
idempotency-keyfacoltativoWiederholbare Anfragen ohne doppelte Wirkung (24 Stunden)Intestazionestring

Richiesta

NomeTipoDescrizione
nameobbligatoriostring
descriptionfacoltativostring | null
rulesobbligatorioobject

Risposta 201Tariff

NomeTipoDescrizione
idobbligatoriostringID mit Präfix «trf_»
objectobbligatorio"tariff"
nameobbligatoriostring
descriptionobbligatoriostring | null
versionobbligatoriointeger
version_idobbligatoriostring | null
rulesobbligatorioobject | nullTarifregeln, siehe TariffRules
archivedobbligatorioboolean
created_atobbligatoriostring
updated_atobbligatoriostring

Errori possibili

  • 400 Anfrage ungültig
  • 401 Nicht angemeldet
  • 403 Berechtigung fehlt
  • 404 Nicht gefunden
  • 409 Zustand passt nicht
  • 429 Zu viele Anfragen
Esempio
curl -X POST https://api.ladehase.com/v1/tariffs \n  -H "Authorization: Bearer lh_test_…" \n  -H "Content-Type: application/json" \n  -d '{"name":"string","description":"string","rules":{"currency":"CHF","energyPrice":0,"startFee":0,"serviceFee":0,"timeWindows":[],"idleFee":{"pricePerMinute":0,"graceMinutes":0,"trigger":"after_charging","maxAmount":0,"quietHours":{"from":"string","to":"string"}},"maxAmount":0,"timeZone":"Europe/Zurich"}}'
Risposta 201
{
  "id": "trf_5e2a8b1c9d0f3e7a",
  "object": "tariff",
  "name": "string",
  "description": "string",
  "version": 0,
  "version_id": "string",
  "rules": {},
  "archived": true,
  "created_at": "string",
  "updated_at": "string"
}

Tarif abrufen

get/v1/tariffs/{id}

Ein Tarif mit Regeln der aktuellen Version.

Parametri

NomePosizioneTipo
idobbligatorioPercorsostring

Risposta 200Tariff

NomeTipoDescrizione
idobbligatoriostringID mit Präfix «trf_»
objectobbligatorio"tariff"
nameobbligatoriostring
descriptionobbligatoriostring | null
versionobbligatoriointeger
version_idobbligatoriostring | null
rulesobbligatorioobject | nullTarifregeln, siehe TariffRules
archivedobbligatorioboolean
created_atobbligatoriostring
updated_atobbligatoriostring

Errori possibili

  • 400 Anfrage ungültig
  • 401 Nicht angemeldet
  • 403 Berechtigung fehlt
  • 404 Nicht gefunden
  • 409 Zustand passt nicht
  • 429 Zu viele Anfragen
Esempio
curl -X GET https://api.ladehase.com/v1/tariffs/{id} \n  -H "Authorization: Bearer lh_test_…"
Risposta 200
{
  "id": "trf_5e2a8b1c9d0f3e7a",
  "object": "tariff",
  "name": "string",
  "description": "string",
  "version": 0,
  "version_id": "string",
  "rules": {},
  "archived": true,
  "created_at": "string",
  "updated_at": "string"
}

Tarif ändern

patch/v1/tariffs/{id}

Neue Regeln ergeben eine neue Version. Laufende Ladungen behalten ihre Version.

Parametri

NomePosizioneTipo
idobbligatorioPercorsostring

Richiesta

NomeTipoDescrizione
namefacoltativostring
descriptionfacoltativostring | null
rulesfacoltativoobject

Risposta 200Tariff

NomeTipoDescrizione
idobbligatoriostringID mit Präfix «trf_»
objectobbligatorio"tariff"
nameobbligatoriostring
descriptionobbligatoriostring | null
versionobbligatoriointeger
version_idobbligatoriostring | null
rulesobbligatorioobject | nullTarifregeln, siehe TariffRules
archivedobbligatorioboolean
created_atobbligatoriostring
updated_atobbligatoriostring

Errori possibili

  • 400 Anfrage ungültig
  • 401 Nicht angemeldet
  • 403 Berechtigung fehlt
  • 404 Nicht gefunden
  • 409 Zustand passt nicht
  • 429 Zu viele Anfragen
Esempio
curl -X PATCH https://api.ladehase.com/v1/tariffs/{id} \n  -H "Authorization: Bearer lh_test_…" \n  -H "Content-Type: application/json" \n  -d '{"name":"string","description":"string","rules":{"currency":"CHF","energyPrice":0,"startFee":0,"serviceFee":0,"timeWindows":[],"idleFee":{"pricePerMinute":0,"graceMinutes":0,"trigger":"after_charging","maxAmount":0,"quietHours":{"from":"string","to":"string"}},"maxAmount":0,"timeZone":"Europe/Zurich"}}'
Risposta 200
{
  "id": "trf_5e2a8b1c9d0f3e7a",
  "object": "tariff",
  "name": "string",
  "description": "string",
  "version": 0,
  "version_id": "string",
  "rules": {},
  "archived": true,
  "created_at": "string",
  "updated_at": "string"
}

Tarif archivieren

delete/v1/tariffs/{id}

Nur Tarife ohne aktive Geräte.

Parametri

NomePosizioneTipo
idobbligatorioPercorsostring

Risposta 200Tariff

NomeTipoDescrizione
idobbligatoriostringID mit Präfix «trf_»
objectobbligatorio"tariff"
nameobbligatoriostring
descriptionobbligatoriostring | null
versionobbligatoriointeger
version_idobbligatoriostring | null
rulesobbligatorioobject | nullTarifregeln, siehe TariffRules
archivedobbligatorioboolean
created_atobbligatoriostring
updated_atobbligatoriostring

Errori possibili

  • 400 Anfrage ungültig
  • 401 Nicht angemeldet
  • 403 Berechtigung fehlt
  • 404 Nicht gefunden
  • 409 Zustand passt nicht
  • 429 Zu viele Anfragen
Esempio
curl -X DELETE https://api.ladehase.com/v1/tariffs/{id} \n  -H "Authorization: Bearer lh_test_…"
Risposta 200
{
  "id": "trf_5e2a8b1c9d0f3e7a",
  "object": "tariff",
  "name": "string",
  "description": "string",
  "version": 0,
  "version_id": "string",
  "rules": {},
  "archived": true,
  "created_at": "string",
  "updated_at": "string"
}

Versionen auflisten

get/v1/tariffs/{id}/versions

Alle Versionen eines Tarifs.

Parametri

NomePosizioneTipo
idobbligatorioPercorsostring

Risposta 200Object

Errori possibili

  • 400 Anfrage ungültig
  • 401 Nicht angemeldet
  • 403 Berechtigung fehlt
  • 404 Nicht gefunden
  • 409 Zustand passt nicht
  • 429 Zu viele Anfragen
Esempio
curl -X GET https://api.ladehase.com/v1/tariffs/{id}/versions \n  -H "Authorization: Bearer lh_test_…"
Risposta 200
{}

Tarifvorschau

post/v1/tariffs/{id}/preview

Beispielbeträge, etwa «So viel kostet eine Ladung mit 20 kWh». Mit `rules` im Body lässt sich ein Entwurf berechnen.

Parametri

NomePosizioneTipo
idobbligatorioPercorsostring
idempotency-keyfacoltativoWiederholbare Anfragen ohne doppelte Wirkung (24 Stunden)Intestazionestring

Richiesta

NomeTipoDescrizione
rulesfacoltativoobject
energy_whfacoltativointeger[]
power_wfacoltativointeger
idle_minutesfacoltativointeger
start_atfacoltativostring (date-time)

Risposta 200Object

Errori possibili

  • 400 Anfrage ungültig
  • 401 Nicht angemeldet
  • 403 Berechtigung fehlt
  • 404 Nicht gefunden
  • 409 Zustand passt nicht
  • 429 Zu viele Anfragen
Esempio
curl -X POST https://api.ladehase.com/v1/tariffs/{id}/preview \n  -H "Authorization: Bearer lh_test_…" \n  -H "Content-Type: application/json" \n  -d '{"rules":{"currency":"CHF","energyPrice":0,"startFee":0,"serviceFee":0,"timeWindows":[],"idleFee":{"pricePerMinute":0,"graceMinutes":0,"trigger":"after_charging","maxAmount":0,"quietHours":{"from":"string","to":"string"}},"maxAmount":0,"timeZone":"Europe/Zurich"},"energy_wh":[10000,20000,40000],"power_w":11000,"idle_minutes":0,"start_at":"2026-10-25T08:30:00.000Z"}'
Risposta 200
{}

Vorschau für Entwurf

post/v1/tariffs/preview

Wie die Tarifvorschau, aber ohne gespeicherten Tarif (Regeln im Body).

Parametri

NomePosizioneTipo
idempotency-keyfacoltativoWiederholbare Anfragen ohne doppelte Wirkung (24 Stunden)Intestazionestring

Richiesta

NomeTipoDescrizione
rulesfacoltativoobject
energy_whfacoltativointeger[]
power_wfacoltativointeger
idle_minutesfacoltativointeger
start_atfacoltativostring (date-time)

Risposta 200Object

Errori possibili

  • 400 Anfrage ungültig
  • 401 Nicht angemeldet
  • 403 Berechtigung fehlt
  • 404 Nicht gefunden
  • 409 Zustand passt nicht
  • 429 Zu viele Anfragen
Esempio
curl -X POST https://api.ladehase.com/v1/tariffs/preview \n  -H "Authorization: Bearer lh_test_…" \n  -H "Content-Type: application/json" \n  -d '{"rules":{"currency":"CHF","energyPrice":0,"startFee":0,"serviceFee":0,"timeWindows":[],"idleFee":{"pricePerMinute":0,"graceMinutes":0,"trigger":"after_charging","maxAmount":0,"quietHours":{"from":"string","to":"string"}},"maxAmount":0,"timeZone":"Europe/Zurich"},"energy_wh":[10000,20000,40000],"power_w":11000,"idle_minutes":0,"start_at":"2026-10-25T08:30:00.000Z"}'
Risposta 200
{}