Skip to content

Back to the home page · Thai version

API and webhooks for developers

Coming soon This API is not open on the live system yet. Today it runs only in our internal test mode, with simulated chargers. This page describes what is already built in the code. Details may change before it opens.

Draft · every example uses placeholder values, no real keys or secrets

Overview

A per-account (tenant) API to list stations and charging sessions, receive signed webhooks, and try starting and stopping a session on a simulated (sandbox) charger.

ItemStatus
List stations and sessions with an API keyBuilt (test mode)
Webhooks signed with HMAC-SHA256, with automatic retriesBuilt (test mode)
Sandbox chargers to try starting and stopping a sessionBuilt (test mode)
The API and API keys on the live systemComing soon
Commanding real chargers through the API (start, stop, unlock, reset)Coming soon
Webhooks from real chargersComing soon
Webhooks to your public URL (test mode delivers only to a receiver on the same machine)Coming soon

Authentication

Errors come back as {"error":{"code":"…","message":"…"}}

HTTP statusMeaning
401No key, a wrong key, or a revoked key
403 insufficient_scopeThe key lacks the scope this path needs
404Not found, or it belongs to another account
429 too_many_bad_keysToo many wrong keys; see the Retry-After header for how long to wait

Endpoints

Every path starts with /api/v1

Method and pathScopeWhat it does
GET /api/v1/stationsstations:readThe account's stations
GET /api/v1/stations/{id}stations:readOne station
GET /api/v1/sessionssessions:readCharging sessions
GET /api/v1/webhooks/endpointswebhooks:manageWebhook endpoints
POST /api/v1/webhooks/endpointswebhooks:manageAdd an endpoint (the secret is shown once)
POST /api/v1/webhooks/endpoints/{id}/disable · /enable · /revokewebhooks:manageDisable, enable or permanently revoke an endpoint
POST /api/v1/webhooks/endpoints/{id}/testwebhooks:manageSend a test event
GET /api/v1/webhooks/deliverieswebhooks:manageWebhook delivery history
POST /api/v1/webhooks/deliveries/{id}/redeliverwebhooks:manageRe-deliver by hand (same event id)
GET /api/v1/sandbox/chargers · POST /api/v1/sandbox/chargerssandbox:manageList and create sandbox chargers
GET /api/v1/sandbox/chargers/{id} · POST …/{id}/deletesandbox:manageRead or delete a sandbox charger
POST /api/v1/sandbox/chargers/{id}/sessions/start · /stopsandbox:manageStart or stop a session on a sandbox charger

Session fields: id, charger_id, connector, sandbox, status, transaction_id, started_at, stopped_at, wh (energy in watt-hours) · Station fields: id, name, sandbox, status

Example: try it with a sandbox charger

Every value in the example is a placeholder. API_BASE_URL is the API address, which is not open on the live system yet (coming soon).

export EVEASY_API_KEY='YOUR_API_KEY'
export BASE='https://API_BASE_URL'

# 1) Create a sandbox charger (name: 1-60 characters)
curl -s -X POST "$BASE/api/v1/sandbox/chargers" \
  -H "Authorization: Bearer $EVEASY_API_KEY" -H 'Content-Type: application/json' \
  -d '{"name":"demo charger"}'
# -> 201 {"data":{"id":"SBX-ABCDE12345",...}}
#    and a sandbox.charger.created webhook

# 2) Start a session (sandbox chargers have one connector: connector = 1)
curl -s -X POST "$BASE/api/v1/sandbox/chargers/SBX-ABCDE12345/sessions/start" \
  -H "Authorization: Bearer $EVEASY_API_KEY" -H 'Content-Type: application/json' \
  -d '{"connector":1}'
# -> 201 {"data":{"id":"sbx-13","status":"active",...}}
#    and a session.started webhook

# 3) Stop the session, then list sessions
curl -s -X POST "$BASE/api/v1/sandbox/chargers/SBX-ABCDE12345/sessions/stop" \
  -H "Authorization: Bearer $EVEASY_API_KEY" -H 'Content-Type: application/json' \
  -d '{"connector":1}'
curl -s "$BASE/api/v1/sessions" -H "Authorization: Bearer $EVEASY_API_KEY"

Webhooks

EventSent when
session.startedA session starts on a sandbox charger
session.stoppedA session stops on a sandbox charger
sandbox.charger.createdA sandbox charger is created
sandbox.charger.deletedA sandbox charger is deleted
webhook.testYou send a test event

Today every event comes from a sandbox charger or a test ("sandbox": true). Real chargers do not send webhooks yet. Coming soon

POST /hook
Content-Type: application/json
EVeasy-Event-Id: evt_EXAMPLE0000000000000000
EVeasy-Event-Type: session.started
EVeasy-Delivery-Attempt: 1
EVeasy-Signature: t=1763258400,v1=<64 hex>

{"id":"evt_EXAMPLE0000000000000000","type":"session.started","created":1763258400,"sandbox":true,"data":{...}}

Verify the signature

  1. Use the raw body exactly as received, before parsing JSON
  2. v1 = hex of HMAC-SHA256(secret, "<t>." + body)
  3. Reject if t is more than 300 seconds from now
  4. Compare in constant time
  5. Dedupe on the event id (re-deliveries keep the same id)

Node 18 or later, node:crypto only

import crypto from 'node:crypto';

export function verifyEvEasySignature(rawBody, header, secret, toleranceS = 300, now = Math.floor(Date.now() / 1000)) {
  if (typeof header !== 'string') return false;
  let t = null; const v1 = [];
  for (const part of header.split(',')) {
    const i = part.indexOf('=');
    if (i < 1) return false;
    const k = part.slice(0, i).trim(), v = part.slice(i + 1).trim();
    if (k === 't' && /^[0-9]{1,12}$/.test(v)) t = Number(v);
    else if (k === 'v1' && /^[0-9a-f]{64}$/.test(v)) v1.push(v);
  }
  if (t === null || v1.length === 0) return false;
  if (Math.abs(now - t) > toleranceS) return false;
  const want = crypto.createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest();
  let ok = false;
  for (const sig of v1) {
    if (crypto.timingSafeEqual(Buffer.from(sig, 'hex'), want)) ok = true;
  }
  return ok;
}

Python 3.8 or later, standard library only

import hashlib, hmac, re, time

def verify_eveasy_signature(raw_body: bytes, header: str, secret: str, tolerance_s: int = 300, now: int = None) -> bool:
    if not isinstance(header, str):
        return False
    now = int(time.time()) if now is None else now
    t, v1 = None, []
    for part in header.split(","):
        k, sep, v = part.partition("=")
        if not sep or not k.strip():
            return False
        k, v = k.strip(), v.strip()
        if k == "t" and re.fullmatch(r"[0-9]{1,12}", v):
            t = int(v)
        elif k == "v1" and re.fullmatch(r"[0-9a-f]{64}", v):
            v1.append(v)
    if t is None or not v1:
        return False
    if abs(now - t) > tolerance_s:
        return False
    want = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    ok = False
    for sig in v1:
        if hmac.compare_digest(sig, want):
            ok = True
    return ok

Keep the webhook secret (it starts with whsec_) in an environment variable such as EVEASY_WEBHOOK_SECRET, not in your code.

Retries

Limits

Glossary

TermMeaning
OCPPThe protocol a charger uses to talk to the back office
ConnectorThe plug that goes into the car
SessionOne charging session
WhWatt-hour. The API returns energy in the wh field
Tenant (account)One station owner's data space
SandboxSimulated chargers for testing
WebhookEV Easy sends events to your URL

Questions about the API: contact@eveasythailand.com