Aller au contenu

Premiers pas

Getting started

Your first request to the Ladehase API in five minutes, with test devices and no hardware.

Cette page n'est pas encore disponible dans ta langue. Tu vois la version anglaise.

The Ladehase API is a REST API at https://api.ladehase.com/v1. Everything you can do in the dashboard you can also do through the API: manage locations and charge points, set tariffs, start and stop charging, analyse sessions, create access grants and receive webhooks.

What you need

  • An account in the dashboard. It is free.
  • An API key. Create it in the dashboard under «Developers». Start with a test key lh_test_….
  • curl or any programming language.

Create test devices

In test mode you don't need a real charging station. Create simulated charge points:

curl -X POST https://api.ladehase.com/v1/integrations/test \
  -H "Authorization: Bearer lh_test_…"

Then list the devices:

curl https://api.ladehase.com/v1/devices \
  -H "Authorization: Bearer lh_test_…"
{
  "object": "list",
  "data": [
    { "id": "dev_…", "object": "device", "name": "Testladepunkt 1", "livemode": false }
  ],
  "has_more": false
}

Start a charging session

Start a session without payment with POST /v1/sessions. This lets you test the flow without opening the payment page:

curl -X POST https://api.ladehase.com/v1/sessions \
  -H "Authorization: Bearer lh_test_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c2a1e-first-session" \
  -d '{ "device_id": "dev_…" }'

Then plug in a simulated car:

curl -X POST https://api.ladehase.com/v1/devices/dev_…/simulate \
  -H "Authorization: Bearer lh_test_…" \
  -H "Content-Type: application/json" \
  -d '{ "action": "plug", "vehicle_need_wh": 12000 }'

The session moves to charging. GET /v1/sessions/ses_… shows energy and the running amount. Stop it with POST /v1/sessions/ses_…/stop.

API principles

  • Units: amounts are integers in Rappen (1250 = CHF 12.50), energy in watt hours (12400 = 12.4 kWh), energy prices in hundredths of a Rappen per kWh (4500 = 0.45 CHF/kWh). See Tariffs.
  • IDs have a prefix: ses_ for sessions, dev_ for devices, loc_ for locations and so on.
  • Lists return object, data and has_more. Paginate with limit (max 100) and starting_after.
  • Timestamps are ISO 8601 in UTC.
  • Errors follow RFC 9457 (Problem Details). See Errors.
  • Idempotent: write requests accept an Idempotency-Key header. The same request with the same key takes effect only once within 24 hours.

Next steps

Une erreur ? Écris à developer@ladehase.com.