Skip to content

OCPP for Developers

v2.0.1 / 2.1

OCPP is JSON-RPC over a single WebSocket that the charging station opens to your Charging Station Management System (CSMS). Once the socket is up, either side can send requests, so your backend is both a server for the station’s reports and a client issuing commands down the same pipe. Every charging session is a state machine the station drives with a handful of messages; your job is to persist those events in order and answer them fast.

VersionStatusSubprotocol
1.6JLarge installed baseocpp1.6
2.0.1IEC 63584 (2024)ocpp2.0.1
2.1IEC 63584-210:2025ocpp2.1

2.0.1 is a redesign, not an upgrade of 1.6: transactions, device management and security all changed, so a 1.6 handler does not carry over. 2.1 was released in January 2025, builds on 2.0.1 and stays compatible with it — every 2.0.1 message still exists in 2.1. The version is negotiated in the WebSocket handshake.

GET /ocpp/CS-0042 HTTP/1.1
Upgrade: websocket
Sec-WebSocket-Protocol: ocpp2.0.1, ocpp1.6

Gotcha: One CSMS endpoint often serves 1.6 and 2.0.1 stations. Dispatch on the negotiated subprotocol per connection, never on a config flag, or a mixed fleet silently mis-parses half its traffic.

Type idFrameShape
2CALL[2, id, action, payload]
3CALLRESULT[3, id, payload]
4CALLERROR[4, id, code, text, details]

Every message is a JSON array. The message id is chosen by the sender and echoed in the reply — that is the only link between a request and its response, because a CALLRESULT carries no action name. Payload validation failures go back as a CALLERROR with codes such as FormatViolation, TypeConstraintViolation or NotImplemented.

[2, "19223201", "Heartbeat", {}]
[3, "19223201",
{"currentTime": "2026-11-02T10:15:00Z"}]

Tip: Keep the pending-request map keyed by message id per connection. A CALLRESULT is meaningless without it, since you must know which action it answers to validate its payload.

ProfileTransportStation proves identity by
1Plain WebSocketHTTP Basic password
2TLSHTTP Basic password
3TLSClient certificate

The station’s identity is the last segment of the connection URL, so the URL alone tells you which charger is calling before any message arrives. OCA certification for 2.0.1 requires Security Profile 2; profile 3 is the optional Advanced Security certification profile. The OCA Security Operations Guide requires a Basic password of at least 16 characters and recommends a unique random password per station.

wss://csms.example.com/ocpp/CS-0042
Authorization: Basic <base64 credentials>

Warning: Profile 1 sends the password unencrypted, and the OCA guidance is that a station shall not use it on untrusted networks. Treat it as a lab-only setting, never a production default.

MessageDirectionPurpose
BootNotificationStation to CSMSRegister after start
HeartbeatStation to CSMSLiveness, clock sync
StatusNotificationStation to CSMSConnector state

The first message after connecting is BootNotification. Your response’s status is Accepted, Pending or Rejected, and its interval sets the heartbeat period in seconds. StatusNotification reports each connector as Available, Occupied, Reserved, Unavailable or Faulted.

[2, "1", "BootNotification", {
"reason": "PowerUp",
"chargingStation": {
"model": "AC-22",
"vendorName": "Acme"
}
}]
[3, "1", {
"currentTime": "2026-11-02T10:00:00Z",
"interval": 300,
"status": "Accepted"
}]

Tip: Answer BootNotification immediately. If the station needs configuring first, reply Pending, push your settings, and accept it afterwards — rather than holding the boot request open while you do the work.

idToken.typeTypical source
ISO14443RFID card UID
eMAIDISO 15118 contract (Plug and Charge)
CentralRemote start from an app
NoAuthorizationFree-vend charger

Authorize asks whether a token may charge. The answer is idTokenInfo.status: Accepted, Blocked, Expired, Invalid, NoCredit, ConcurrentTx and a few location-specific values. The optional cacheExpiryDateTime controls how long the station may trust the result offline.

[2, "7", "Authorize", {
"idToken": {
"idToken": "04A2B3C4D5E6F7",
"type": "ISO14443"
}
}]
eventTypeSent when
StartedTransaction begins
UpdatedState change or meter sample
EndedTransaction ends, with stoppedReason

2.0.1 replaces 1.6’s StartTransaction, StopTransaction and MeterValues with one message. The station generates transactionId, unlike 1.6 where the CSMS assigned it in the StartTransaction response. Every event carries triggerReason, a seqNo and, while charging, chargingState such as Charging or SuspendedEV.

[2, "42", "TransactionEvent", {
"eventType": "Updated",
"timestamp": "2026-11-02T10:20:00Z",
"triggerReason": "MeterValuePeriodic",
"seqNo": 3,
"transactionInfo": {
"transactionId": "tx-8f1c",
"chargingState": "Charging"
}
}]

Gotcha: Events queued while the station was offline arrive late, in a burst, with offline: true. Order by seqNo and the event timestamp, not by arrival, or an Ended can land before its last Updated and your billing reads the wrong final meter value.

chargingProfilePurposeScope
ChargingStationMaxProfileWhole-station ceiling
TxDefaultProfileDefault for new transactions
TxProfileOne running transaction
ChargingStationExternalConstraintsSet by an external system

SetChargingProfile sends a schedule of chargingSchedulePeriod entries, each a startPeriod in seconds and a limit in the chargingRateUnit (W or A). Profiles of the same purpose stack: the highest stackLevel valid at a given time wins.

{"evseId": 1, "chargingProfile": {
"id": 10, "stackLevel": 0,
"chargingProfilePurpose": "TxDefaultProfile",
"chargingProfileKind": "Absolute",
"chargingSchedule": [{
"id": 1, "chargingRateUnit": "A",
"chargingSchedulePeriod": [
{"startPeriod": 0, "limit": 16},
{"startPeriod": 3600, "limit": 32}
]}]}}

Gotcha: A limit in A is per phase. 16 A on three phases at 230 V is about 11 kW, not 3.7 kW — check numberPhases before you convert a grid budget in watts into an amps schedule.

MessagePurpose
UpdateFirmwareDownload and install a signed image
FirmwareStatusNotificationProgress: Downloading … Installed
GetLogUpload DiagnosticsLog or SecurityLog
LogStatusNotificationUpload progress

Both operations are asynchronous: the CSMS request only starts the job, carrying a requestId, and the station reports progress in separate notifications tagged with the same id. UpdateFirmware requires a download location and a retrieveDateTime, and accepts a signingCertificate and signature so the station can verify the image.

[2, "88", "UpdateFirmware", {
"requestId": 501,
"firmware": {
"location": "https://fw.example.com/v3.bin",
"retrieveDateTime": "2026-11-03T02:00:00Z"
}
}]
AreaNew in 2.1
DER controlSetDERControl, NotifyDERAlarm
V2XoperationMode, dischargeLimit in periods
Charging profilesPriorityCharging, LocalGeneration, Dynamic
Tariffs and paymentSetDefaultTariff, NotifySettlement
Battery swapBatterySwap, RequestBatterySwap

2.1 adds ISO 15118-20 bidirectional power transfer, so the EV can feed energy back, plus DER control: SetDERControl carries grid-code curves such as VoltVar, FreqDroop or FixedPFInject, and the station reports grid faults back with NotifyDERAlarm. Certification is run by the OCA: for 2.0.1, Core is mandatory and Advanced Security, Smart Charging, ISO 15118 Support and Local Authorization are optional profiles. Check the OCA site for the current 2.1 certification scope.

[2, "93", "NotifyDERAlarm", {
"controlType": "HVMustTrip",
"gridEventFault": "OverVoltage",
"timestamp": "2026-11-02T13:05:00Z"
}]

Note: A 2.1 CSMS still speaks to 2.0.1 stations; negotiate ocpp2.1 first and fall back. New actions such as SetDERControl exist only on ocpp2.1 connections.