{
  "components": {
    "examples": {
      "AccessRevokedError": {
        "summary": "Owner revoked delegated access.",
        "value": {
          "error": {
            "code": "access_revoked",
            "message": "The owner revoked access for this integration.",
            "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
          }
        }
      },
      "ChargerExample": {
        "summary": "Commissioned NL charge point with BAG site and MID.",
        "value": {
          "chargerId": "CP-ROLEC-NL-009871",
          "firmwareVersion": "2.14.3",
          "history": [
            {
              "occurredAt": "2026-02-15T10:00:00Z",
              "type": "controller_installed",
              "unitSerial": "RC-EVO2-2026-004512"
            },
            {
              "address": {
                "bagId": "0213200000012345",
                "country": "NL",
                "houseLetter": "A",
                "houseNumber": "12",
                "place": "Brummen",
                "postcode": "6971AB",
                "street": "Stationsstraat"
              },
              "occurredAt": "2026-02-15T10:00:00Z",
              "type": "installation_address_set"
            }
          ],
          "installationAddress": {
            "address": {
              "bagId": "0213200000012345",
              "country": "NL",
              "houseLetter": "A",
              "houseNumber": "12",
              "place": "Brummen",
              "postcode": "6971AB",
              "street": "Stationsstraat"
            },
            "setAt": "2026-02-15T10:00:00Z"
          },
          "midMeterPresent": true,
          "midMeterSerial": "MID-NL-887766554433",
          "model": "EVO II 7.4kW",
          "partNumber": "EVO2-7K-MID-NL",
          "serialNumber": "RC-EVO2-2026-004512"
        }
      },
      "ChargerListExample": {
        "summary": "First page of chargers for a grant.",
        "value": {
          "chargers": [
            {
              "chargerId": "CP-ROLEC-NL-009871",
              "firmwareVersion": "2.14.3",
              "history": [
                {
                  "occurredAt": "2026-02-15T10:00:00Z",
                  "type": "controller_installed",
                  "unitSerial": "RC-EVO2-2026-004512"
                },
                {
                  "address": {
                    "bagId": "0213200000012345",
                    "country": "NL",
                    "houseLetter": "A",
                    "houseNumber": "12",
                    "place": "Brummen",
                    "postcode": "6971AB",
                    "street": "Stationsstraat"
                  },
                  "occurredAt": "2026-02-15T10:00:00Z",
                  "type": "installation_address_set"
                }
              ],
              "installationAddress": {
                "address": {
                  "bagId": "0213200000012345",
                  "country": "NL",
                  "houseLetter": "A",
                  "houseNumber": "12",
                  "place": "Brummen",
                  "postcode": "6971AB",
                  "street": "Stationsstraat"
                },
                "setAt": "2026-02-15T10:00:00Z"
              },
              "midMeterPresent": true,
              "midMeterSerial": "MID-NL-887766554433",
              "model": "EVO II 7.4kW",
              "partNumber": "EVO2-7K-MID-NL",
              "serialNumber": "RC-EVO2-2026-004512"
            }
          ],
          "nextCursor": null
        }
      },
      "SessionListExample": {
        "summary": "Completed session with MID proof fields.",
        "value": {
          "nextCursor": null,
          "sessions": [
            {
              "chargerId": "CP-ROLEC-NL-009871",
              "clockReliable": true,
              "connectorId": 1,
              "endedAt": "2026-03-01T20:14:03Z",
              "energyDeliveredWh": 14250,
              "idTag": "04A2B1C3D4",
              "lastUpdatedAt": "2026-03-01T20:14:05Z",
              "measuringUnitSerial": "RC-EVO2-2026-004512",
              "meterEndWh": 1214650,
              "meterStartWh": 1200400,
              "midCertified": true,
              "ocmf": {
                "status": "not_supported"
              },
              "sessionId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
              "startedAt": "2026-03-01T18:02:11Z",
              "state": "completed"
            }
          ]
        }
      }
    },
    "parameters": {
      "ChargerId": {
        "description": "Stable Cloudflow charge point identifier (OCPP charge point id).",
        "examples": {
          "default": {
            "value": "CP-ROLEC-001234"
          }
        },
        "in": "path",
        "name": "chargerId",
        "required": true,
        "schema": {
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        }
      },
      "Cursor": {
        "description": "Opaque pagination cursor from a previous response `nextCursor`.",
        "in": "query",
        "name": "cursor",
        "required": false,
        "schema": {
          "maxLength": 512,
          "type": "string"
        }
      },
      "Limit": {
        "description": "Maximum number of items to return.",
        "in": "query",
        "name": "limit",
        "required": false,
        "schema": {
          "default": 50,
          "maximum": 100,
          "minimum": 1,
          "type": "integer"
        }
      },
      "SessionFrom": {
        "description": "Inclusive lower bound on session start time (UTC).",
        "examples": {
          "default": {
            "value": "2026-01-01T00:00:00Z"
          }
        },
        "in": "query",
        "name": "from",
        "required": false,
        "schema": {
          "format": "date-time",
          "type": "string"
        }
      },
      "SessionTo": {
        "description": "Inclusive upper bound on session start time (UTC).",
        "in": "query",
        "name": "to",
        "required": false,
        "schema": {
          "format": "date-time",
          "type": "string"
        }
      },
      "UpdatedSince": {
        "description": "Inclusive lower bound on session `lastUpdatedAt` (UTC).",
        "in": "query",
        "name": "updatedSince",
        "required": false,
        "schema": {
          "format": "date-time",
          "type": "string"
        }
      }
    },
    "responses": {
      "AccessRevoked": {
        "content": {
          "application/json": {
            "examples": {
              "revoked": {
                "value": {
                  "error": {
                    "code": "access_revoked",
                    "message": "The owner revoked access for this integration.",
                    "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
                  }
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Owner revoked delegated access; distinct from generic forbidden or outage."
      },
      "BadRequest": {
        "content": {
          "application/json": {
            "examples": {
              "invalid": {
                "value": {
                  "error": {
                    "code": "invalid_request",
                    "message": "The request is malformed or contains invalid parameters.",
                    "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
                  }
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Invalid query parameters or date range.",
        "headers": {
          "X-Trace-Id": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "ChargerNotFound": {
        "content": {
          "application/json": {
            "examples": {
              "default": {
                "value": {
                  "error": {
                    "code": "charger_not_found",
                    "message": "The requested charger could not be found.",
                    "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
                  }
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Charger not found or not in the owner grant."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Token valid but not permitted for this resource or scope."
      },
      "InternalError": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Unexpected server error."
      },
      "OAuthUnauthorized": {
        "content": {
          "application/json": {
            "examples": {
              "default": {
                "value": {
                  "error": {
                    "code": "unauthorized",
                    "message": "Missing or invalid access token.",
                    "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
                  }
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Missing, expired, or invalid OAuth access token."
      },
      "RateLimited": {
        "content": {
          "application/json": {
            "examples": {
              "default": {
                "value": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests for this owner grant.",
                    "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
                  }
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        },
        "description": "Poll interval exceeded (partner policy, typically 15 minutes per owner).",
        "headers": {
          "Retry-After": {
            "schema": {
              "description": "Seconds until the client should retry.",
              "type": "integer"
            }
          }
        }
      }
    },
    "schemas": {
      "BagAddress": {
        "additionalProperties": false,
        "description": "Dutch installation address in BAG-style discrete fields (Joulo \u00a74). Values are\nstored in Factory `chargepoint_sites`, populated from **Connect Server** NL\ncommission flows (capture) \u2014 not from Customer CRM exports.\n",
        "properties": {
          "bagId": {
            "description": "BAG nummeraanduiding identificatie (16 digits) when known.",
            "examples": [
              "0213200000012345"
            ],
            "pattern": "^[0-9]{16}$",
            "type": "string"
          },
          "country": {
            "default": "NL",
            "description": "ISO 3166-1 alpha-2 country code.",
            "examples": [
              "NL"
            ],
            "pattern": "^[A-Z]{2}$",
            "type": "string"
          },
          "houseLetter": {
            "description": "BAG huisletter when present.",
            "examples": [
              "A"
            ],
            "type": "string"
          },
          "houseNumber": {
            "description": "BAG huisnummer (numeric part as string).",
            "examples": [
              "12"
            ],
            "type": "string"
          },
          "houseNumberAddition": {
            "description": "BAG huisnummertoevoeging when present.",
            "examples": [
              "bis"
            ],
            "type": "string"
          },
          "place": {
            "description": "BAG woonplaats naam.",
            "examples": [
              "Brummen"
            ],
            "type": "string"
          },
          "postcode": {
            "description": "Dutch postcode \u2014 four digits and two capitals, no space.",
            "examples": [
              "6971AB"
            ],
            "pattern": "^[0-9]{4}[A-Z]{2}$",
            "type": "string"
          },
          "street": {
            "description": "BAG openbare ruimte naam.",
            "examples": [
              "Stationsstraat"
            ],
            "type": "string"
          }
        },
        "required": [
          "street",
          "houseNumber",
          "postcode",
          "place",
          "country"
        ],
        "type": "object"
      },
      "Charger": {
        "additionalProperties": false,
        "description": "Joulo \u00a74 charger list entry. Aggregated by `ere` from Factory (hardware, MID,\nunit history, site) for the current controller on this `chargerId`.\n",
        "properties": {
          "chargerId": {
            "description": "Stable Cloudflow / OCPP charge point identifier (unchanged when the physical\nunit is swapped). Joulo \"Charger ID, stable over time\".\n",
            "type": "string"
          },
          "firmwareVersion": {
            "description": "Firmware on the installed controller (Factory, updated from OCPP when available).\nJoulo preferred field.\n",
            "type": "string"
          },
          "history": {
            "description": "Charge-point lifecycle events in chronological order (`occurredAt` ascending).\nIncludes controller install/remove and BAG site changes from Factory (Connect ingest).\n",
            "items": {
              "$ref": "#/components/schemas/ChargerHistoryEvent"
            },
            "minItems": 1,
            "type": "array"
          },
          "installationAddress": {
            "$ref": "#/components/schemas/InstallationAddress"
          },
          "midMeterPresent": {
            "description": "In-housing MID-certified meter on the installed unit (Factory truth, set at\nbuild/commission \u2014 not inferred from OCPP alone).\n",
            "type": "boolean"
          },
          "midMeterSerial": {
            "description": "MID meter serial when `midMeterPresent` is true; **empty string** when false\n(Joulo required field, may be blank).\n",
            "type": "string"
          },
          "model": {
            "description": "Model or power variant (Factory `built_controllers.model`).",
            "minLength": 1,
            "type": "string"
          },
          "partNumber": {
            "description": "Hardware part number / MID variant when known (Factory `part_number`).",
            "type": "string"
          },
          "serialNumber": {
            "description": "Serial of the **currently installed** controller (Factory `built_controllers`).\nNever an owner nickname such as \"Home\".\n",
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "chargerId",
          "serialNumber",
          "model",
          "midMeterPresent",
          "midMeterSerial",
          "history",
          "installationAddress"
        ],
        "type": "object"
      },
      "ChargerHistoryEvent": {
        "description": "Typed charge-point history event. Consumers branch on `type` (enum value), not on\nJSON object keys.\n",
        "discriminator": {
          "mapping": {
            "controller_installed": "#/components/schemas/ControllerInstalledHistoryEvent",
            "controller_removed": "#/components/schemas/ControllerRemovedHistoryEvent",
            "installation_address_set": "#/components/schemas/InstallationAddressSetHistoryEvent"
          },
          "propertyName": "type"
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/ControllerInstalledHistoryEvent"
          },
          {
            "$ref": "#/components/schemas/ControllerRemovedHistoryEvent"
          },
          {
            "$ref": "#/components/schemas/InstallationAddressSetHistoryEvent"
          }
        ]
      },
      "ChargerHistoryEventBase": {
        "additionalProperties": false,
        "properties": {
          "occurredAt": {
            "description": "UTC time the event occurred.",
            "format": "date-time",
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/ChargerHistoryEventType"
          }
        },
        "required": [
          "type",
          "occurredAt"
        ],
        "type": "object"
      },
      "ChargerHistoryEventType": {
        "description": "Charge-point lifecycle event type (values, not object keys).",
        "enum": [
          "controller_installed",
          "controller_removed",
          "installation_address_set"
        ],
        "type": "string"
      },
      "ChargerListResponse": {
        "additionalProperties": false,
        "properties": {
          "chargers": {
            "items": {
              "$ref": "#/components/schemas/Charger"
            },
            "type": "array"
          },
          "nextCursor": {
            "description": "Pass as `cursor` to fetch the next page; null when no further pages.",
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "chargers"
        ],
        "type": "object"
      },
      "ControllerInstalledHistoryEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ChargerHistoryEventBase"
          },
          {
            "additionalProperties": false,
            "properties": {
              "type": {
                "const": "controller_installed"
              },
              "unitSerial": {
                "description": "Controller serial installed on this charger id.",
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "unitSerial"
            ],
            "type": "object"
          }
        ]
      },
      "ControllerRemovedHistoryEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ChargerHistoryEventBase"
          },
          {
            "additionalProperties": false,
            "properties": {
              "type": {
                "const": "controller_removed"
              },
              "unitSerial": {
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "unitSerial"
            ],
            "type": "object"
          }
        ]
      },
      "ErrorResponse": {
        "additionalProperties": false,
        "properties": {
          "error": {
            "additionalProperties": false,
            "properties": {
              "code": {
                "description": "Stable machine-readable error code.",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "forbidden",
                  "access_revoked",
                  "charger_not_found",
                  "rate_limited",
                  "internal_error"
                ],
                "type": "string"
              },
              "details": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "message": {
                "type": "string"
              },
              "traceId": {
                "pattern": "^[0-9a-f]{32}$",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "traceId"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "InstallationAddress": {
        "additionalProperties": false,
        "properties": {
          "address": {
            "$ref": "#/components/schemas/BagAddress"
          },
          "setAt": {
            "description": "UTC time this address became effective (Connect commission completion time,\npersisted as Factory `chargepoint_sites.set_at`).\n",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "address",
          "setAt"
        ],
        "type": "object"
      },
      "InstallationAddressSetHistoryEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ChargerHistoryEventBase"
          },
          {
            "additionalProperties": false,
            "properties": {
              "address": {
                "$ref": "#/components/schemas/BagAddress"
              },
              "type": {
                "const": "installation_address_set"
              }
            },
            "required": [
              "address"
            ],
            "type": "object"
          }
        ]
      },
      "OcmfInfo": {
        "additionalProperties": false,
        "properties": {
          "payload": {
            "description": "OCMF payload when signed (format TBD with meter vendor).",
            "type": "string"
          },
          "publicKey": {
            "description": "Meter public key material when OCMF is signed and available.",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/OcmfStatus"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "OcmfStatus": {
        "enum": [
          "signed",
          "pending",
          "not_supported"
        ],
        "type": "string"
      },
      "Session": {
        "additionalProperties": false,
        "description": "Joulo \u00a74 session record. Energy and registers from OCPP MID import register (Wh).\nUnit identity snapshotted at session start from Factory state for this `chargerId`.\n",
        "properties": {
          "chargerId": {
            "type": "string"
          },
          "clockReliable": {
            "description": "Whether timestamps for this session are considered trustworthy (charger clock / sample quality).",
            "type": "boolean"
          },
          "connectorId": {
            "description": "OCPP connector id.",
            "minimum": 1,
            "type": "integer"
          },
          "endedAt": {
            "description": "UTC session end; for `active` sessions, time of last known meter sample or start.",
            "format": "date-time",
            "type": "string"
          },
          "energyDeliveredWh": {
            "description": "Energy delivered to the vehicle from the MID register (Wh). Must equal\n`meterEndWh - meterStartWh` when both registers are present. Excludes\ncharger housekeeping draw.\n",
            "minimum": 0,
            "type": "integer"
          },
          "idTag": {
            "description": "OCPP idTag or charge-card reference when available.",
            "type": "string"
          },
          "lastUpdatedAt": {
            "description": "UTC time this session record last changed (corrections bump this, id stays).",
            "format": "date-time",
            "type": "string"
          },
          "measuringUnitSerial": {
            "description": "Serial of the unit that measured this session (fixed at session creation).",
            "type": "string"
          },
          "meterEndWh": {
            "description": "MID register reading at session end (Wh).",
            "minimum": 0,
            "type": "integer"
          },
          "meterStartWh": {
            "description": "MID `Energy.Active.Import.Register` at session start (Wh).",
            "minimum": 0,
            "type": "integer"
          },
          "midCertified": {
            "description": "Whether energy for this session came from a MID-certified meter in that unit.",
            "type": "boolean"
          },
          "ocmf": {
            "$ref": "#/components/schemas/OcmfInfo"
          },
          "sessionId": {
            "description": "Unique stable session identifier (survives corrections).",
            "format": "uuid",
            "type": "string"
          },
          "startedAt": {
            "description": "UTC session start.",
            "format": "date-time",
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/SessionState"
          }
        },
        "required": [
          "sessionId",
          "chargerId",
          "connectorId",
          "measuringUnitSerial",
          "midCertified",
          "startedAt",
          "endedAt",
          "energyDeliveredWh",
          "meterStartWh",
          "meterEndWh",
          "state",
          "lastUpdatedAt",
          "ocmf"
        ],
        "type": "object"
      },
      "SessionListResponse": {
        "additionalProperties": false,
        "properties": {
          "nextCursor": {
            "nullable": true,
            "type": "string"
          },
          "sessions": {
            "items": {
              "$ref": "#/components/schemas/Session"
            },
            "type": "array"
          }
        },
        "required": [
          "sessions"
        ],
        "type": "object"
      },
      "SessionState": {
        "enum": [
          "active",
          "completed",
          "aborted",
          "voided"
        ],
        "type": "string"
      },
      "EventType": {
        "type": "string",
        "enum": [
          "session.started",
          "meter.reading",
          "session.completed",
          "session.updated"
        ]
      },
      "MeterReading": {
        "type": "object",
        "additionalProperties": false,
        "description": "One MID import-register sample during a charging session. Energy is the register, in Wh, not a separate counter.",
        "required": [
          "chargerId",
          "sessionId",
          "connectorId",
          "measuredAt",
          "registerWh",
          "measuringUnitSerial",
          "midCertified"
        ],
        "properties": {
          "chargerId": {
            "type": "string"
          },
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "connectorId": {
            "type": "integer",
            "minimum": 1
          },
          "measuredAt": {
            "type": "string",
            "format": "date-time",
            "description": "UTC time of this register sample."
          },
          "registerWh": {
            "type": "integer",
            "minimum": 0,
            "description": "MID Energy.Active.Import.Register at measuredAt, in Wh."
          },
          "measuringUnitSerial": {
            "type": "string"
          },
          "midCertified": {
            "type": "boolean"
          }
        }
      },
      "SessionStartedEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "Session opened. meterStartWh is the MID register at start.",
        "required": [
          "eventId",
          "eventType",
          "createdAt",
          "data"
        ],
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable across retries. Use it to ignore duplicates."
          },
          "eventType": {
            "type": "string",
            "const": "session.started"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "$ref": "#/components/schemas/Session"
          }
        }
      },
      "MeterReadingEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "MID register sample during charging.",
        "required": [
          "eventId",
          "eventType",
          "createdAt",
          "data"
        ],
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable across retries. Use it to ignore duplicates."
          },
          "eventType": {
            "type": "string",
            "const": "meter.reading"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "$ref": "#/components/schemas/MeterReading"
          }
        }
      },
      "SessionCompletedEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "Session closed. meterStartWh and meterEndWh are the MID register. energyDeliveredWh is the difference.",
        "required": [
          "eventId",
          "eventType",
          "createdAt",
          "data"
        ],
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable across retries. Use it to ignore duplicates."
          },
          "eventType": {
            "type": "string",
            "const": "session.completed"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "$ref": "#/components/schemas/Session"
          }
        }
      },
      "SessionUpdatedEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "Correction, abort or void. sessionId is unchanged.",
        "required": [
          "eventId",
          "eventType",
          "createdAt",
          "data"
        ],
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable across retries. Use it to ignore duplicates."
          },
          "eventType": {
            "type": "string",
            "const": "session.updated"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "$ref": "#/components/schemas/Session"
          }
        }
      },
      "CreateWebhookRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "eventTypes"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Public HTTPS endpoint. HTTP and private addresses are rejected."
          },
          "eventTypes": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          }
        }
      },
      "Webhook": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "url",
          "eventTypes",
          "status",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateWebhookResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Webhook"
          },
          {
            "type": "object",
            "required": [
              "signingSecret"
            ],
            "properties": {
              "signingSecret": {
                "type": "string",
                "writeOnly": true,
                "description": "HMAC secret. Returned only on create or rotate."
              }
            }
          }
        ]
      },
      "RotateWebhookSecretResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "signingSecret",
          "rotatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "signingSecret": {
            "type": "string",
            "writeOnly": true
          },
          "rotatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "securitySchemes": {
      "ownerOAuth2": {
        "description": "Delegated OAuth 2.0 on behalf of a Rolec grant holder (for example a legal asset\nowner / financier). Partners obtain access and refresh tokens after consent.\nAuthorization endpoint must echo the partner `state` parameter on redirect.\n",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://auth.rolec-staging.app/oauth2/authorize",
            "scopes": {
              "ere.chargers:read": "List chargers and installation metadata for the grant.",
              "ere.sessions:read": "List session history for those chargers.",
              "ere.webhooks:manage": "Register and rotate webhook endpoints for this grant."
            },
            "tokenUrl": "https://auth.rolec-staging.app/oauth2/token"
          }
        },
        "type": "oauth2"
      }
    }
  },
  "info": {
    "contact": {
      "email": "partners@rolec.com",
      "name": "Rolec Cloudflow"
    },
    "description": "**Cloud API** for ERE registration partners (Joulo route). Sessions and chargers are read with OAuth. Events are pushed by signed webhook. Matches\n[Joulo manufacturer Cloud API \u00a74](https://developer.joulo.nl/manufacturers)\nfield requirements for charger list, session history, authentication behaviour,\nand error semantics. No end-customer CRM fields are exposed.\n\n## Who the API serves\n\nPartners call **`GET /chargers`** and **`GET /chargers/{chargerId}/sessions`**\nwith a delegated OAuth token. The grant may represent a **legal asset owner**\n(for example a financier) or another Claims-backed principal \u2014 not necessarily\nthe driver at the installation address. Authorisation is enforced via **Claims**\n(charge points linked to the grant) and **Auth** introspection.\n\n## Systems of record (Rolec)\n\n`ere` aggregates read models; it does not own master data.\n\n| Concern | System of record | Notes |\n| --- | --- | --- |\n| Charge point id (`chargerId`) | OCPP / connect commission | Stable when hardware is swapped |\n| Serial, model, part number, MID flags | **Factory** | Manufacturing + **`history`** events (`built_controllers`, `controller_unit_history`, site rows) |\n| Installation address (BAG) | **Factory** `chargepoint_sites` | Captured in **Connect Server**, ingested to Factory; exposed as `installation_address_set` **history** events plus current `installationAddress` |\n| Firmware (preferred) | Factory, refreshed from OCPP where available | |\n| Sessions (Wh, registers, connector, state) | OCPP **charge-events** lifecycle \u2192 `ere` projection | Per-session `measuringUnitSerial` / `midCertified` snapshotted at session start from Factory |\n| OAuth | Cloudflow **Auth** | Authorization code + PKCE + refresh |\n\nChargers missing required Factory data (serial, MID block, current BAG site) are\n**omitted from list responses** until commission/backfill completes \u2014 partners\nnever receive empty serial or address placeholders.\n\n## Authentication\n\nOAuth 2.0 authorization code with **PKCE** and **refresh tokens** after consent.\nScopes: `ere.chargers:read`, `ere.sessions:read` (read-only ERE registration).\n\nSite **load management** (Perific CT and CPMS) is coordinated via the Rolec\u2013Perific CPMS peer; it is\n**not** exposed on this API.\nAuthorization endpoint returns the partner **`state`**. Revoked grants yield\n**`403`** with `error.code = access_revoked`.\n\nPersonal API keys (Joulo-allowed alternative) are **out of scope** for v1 of this contract.\n\n## Session rules\n\n- All session **states** in one endpoint (`active`, `completed`, `aborted`, `voided`).\n- Corrections reuse **`sessionId`** and bump **`lastUpdatedAt`**.\n- **`measuringUnitSerial`** and **`midCertified`** fixed at session creation.\n- History floor: **`startedAt` \u2265 2026-01-01T00:00:00Z**.\n- **`energyDeliveredWh`** = vehicle energy from MID register (Wh); excludes charger housekeeping.\n- **OCMF**: object always present; `not_supported` until meter pipeline exists.\n\n## Events\n\nRolec pushes events to an HTTPS endpoint the partner registers. Delivery is a signed webhook, the same mechanism already used for Axle and Allstar.\n\n| Event | When | `data` |\n| --- | --- | --- |\n| `session.started` | A charging session opens | `Session`, state `active`, MID register at start |\n| `meter.reading` | A MID register sample during charging | `MeterReading` |\n| `session.completed` | The session closes | `Session`, MID register at start and end, energy delivered |\n| `session.updated` | The same session is corrected, aborted or voided | `Session`, same `sessionId`, later `lastUpdatedAt` |\n\nEnvelope is `eventId`, `eventType`, `createdAt`, `data`. `eventId` stays the same across retries.\n\nSignature: `X-Rolec-Webhook-Signature` = `sha256=` + hex(HMAC-SHA256(secret, `X-Rolec-Webhook-Timestamp` + `.` + raw body)). Also sent: `X-Rolec-Webhook-Id` (equals `eventId`) and `X-Rolec-Webhook-Timestamp` (UTC, per attempt). Reject timestamps older than 5 minutes.\n\nAny HTTP 2xx is success. Timeout, 429 and 5xx are retried. Other 4xx are not. Delivery is at least once. A missed event stays on `GET /chargers/{chargerId}/sessions`.\n\nRegister an endpoint with `POST /webhooks`. The signing secret is returned once, on create or rotate.\n\n## Pagination\n\nCursor pagination on chargers and sessions. List calls are limited to once per 15 minutes per grant. Webhook delivery is not part of that limit.\n",
    "license": {
      "name": "Proprietary"
    },
    "summary": "Delegated charger and session API with signed webhook events for Joulo.",
    "title": "Rolec ERE Cloud API",
    "version": "1.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/chargers": {
      "get": {
        "description": "Returns charge points available under the delegated grant that have **complete**\nFactory + site data (serial, MID block, current BAG `installationAddress`).\nIncomplete commissions are omitted until Connect \u2192 Factory ingest finishes.\n\nPagination uses opaque cursors ordered by `chargerId`.\n",
        "operationId": "listChargers",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "$ref": "#/components/examples/ChargerListExample"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ChargerListResponse"
                }
              }
            },
            "description": "Chargers returned successfully."
          },
          "401": {
            "$ref": "#/components/responses/OAuthUnauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "revoked": {
                    "$ref": "#/components/examples/AccessRevokedError"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Token valid but not allowed for this operation. When the owner revoked the\nintegration grant, the error code is `access_revoked` (not a generic outage).\n"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "ownerOAuth2": [
              "ere.chargers:read"
            ]
          }
        ],
        "summary": "List chargers for the authenticated owner grant",
        "tags": [
          "Chargers"
        ]
      }
    },
    "/chargers/{chargerId}": {
      "get": {
        "description": "Returns the charger when it is in the grant **and** commission data is complete.\nReturns **404** when unknown, not authorised, or not yet commission-complete.\n",
        "operationId": "getCharger",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "$ref": "#/components/examples/ChargerExample"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Charger"
                }
              }
            },
            "description": "Charger returned successfully."
          },
          "401": {
            "$ref": "#/components/responses/OAuthUnauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "revoked": {
                    "$ref": "#/components/examples/AccessRevokedError"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Token valid but not allowed for this operation. When the owner revoked the\nintegration grant, the error code is `access_revoked` (not a generic outage).\n"
          },
          "404": {
            "$ref": "#/components/responses/ChargerNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "ownerOAuth2": [
              "ere.chargers:read"
            ]
          }
        ],
        "summary": "Get one charger for the authenticated owner grant",
        "tags": [
          "Chargers"
        ]
      },
      "parameters": [
        {
          "$ref": "#/components/parameters/ChargerId"
        }
      ]
    },
    "/chargers/{chargerId}/sessions": {
      "get": {
        "description": "Returns sessions in every state (active, completed, aborted, voided). Sessions\nwaiting for OCMF signatures are included with `ocmf.status = pending`, not withheld.\n\nFilters:\n  - `from` / `to` \u2014 inclusive bounds on **session start time** (UTC).\n  - `updatedSince` \u2014 inclusive lower bound on `lastUpdatedAt` (for incremental sync).\n  - `cursor` / `limit` \u2014 cursor pagination ordered by `(startedAt, sessionId)`.\n\nSessions with `startedAt` before 2026-01-01T00:00:00Z are never returned.\n",
        "operationId": "listChargerSessions",
        "parameters": [
          {
            "$ref": "#/components/parameters/SessionFrom"
          },
          {
            "$ref": "#/components/parameters/SessionTo"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "default": {
                    "$ref": "#/components/examples/SessionListExample"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SessionListResponse"
                }
              }
            },
            "description": "Sessions returned successfully."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/OAuthUnauthorized"
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "revoked": {
                    "$ref": "#/components/examples/AccessRevokedError"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Token valid but not allowed for this operation. When the owner revoked the\nintegration grant, the error code is `access_revoked` (not a generic outage).\n"
          },
          "404": {
            "$ref": "#/components/responses/ChargerNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "ownerOAuth2": [
              "ere.sessions:read"
            ]
          }
        ],
        "summary": "List charging sessions for a charger",
        "tags": [
          "Sessions"
        ]
      },
      "parameters": [
        {
          "$ref": "#/components/parameters/ChargerId"
        }
      ]
    },
    "/openapi.json": {
      "get": {
        "description": "Returns this API contract (JSON). Same content as the repo `openapi.yaml`.",
        "operationId": "getOpenApi",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "OpenAPI document root object.",
                  "type": "object"
                }
              }
            },
            "description": "OpenAPI 3.1 document."
          }
        },
        "security": [],
        "summary": "Published OpenAPI document",
        "tags": [
          "Meta"
        ]
      }
    },
    "/webhooks": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "createWebhook",
        "summary": "Register a webhook endpoint",
        "description": "HTTPS only. The signing secret is returned once in this response.",
        "security": [
          {
            "ownerOAuth2": [
              "ere.webhooks:manage"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              },
              "example": {
                "url": "https://api.joulo.nl/rolec/events",
                "eventTypes": [
                  "session.started",
                  "meter.reading",
                  "session.completed",
                  "session.updated"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook registered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWebhookResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/OAuthUnauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "listWebhooks",
        "summary": "List webhook endpoints",
        "description": "The signing secret is not returned.",
        "security": [
          {
            "ownerOAuth2": [
              "ere.webhooks:manage"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Registered webhooks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Webhook"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/OAuthUnauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/webhooks/{webhookId}": {
      "parameters": [
        {
          "name": "webhookId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "deleteWebhook",
        "summary": "Delete a webhook endpoint",
        "security": [
          {
            "ownerOAuth2": [
              "ere.webhooks:manage"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "$ref": "#/components/responses/OAuthUnauthorized"
          },
          "404": {
            "description": "Unknown webhook."
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/webhooks/{webhookId}/rotate-secret": {
      "parameters": [
        {
          "name": "webhookId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "rotateWebhookSecret",
        "summary": "Rotate a webhook signing secret",
        "description": "The new secret is returned once and replaces the previous secret.",
        "security": [
          {
            "ownerOAuth2": [
              "ere.webhooks:manage"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Secret rotated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateWebhookSecretResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/OAuthUnauthorized"
          },
          "404": {
            "description": "Unknown webhook."
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "servers": [
    {
      "description": "Staging (TLS)",
      "url": "https://ere.rolec-staging.app/v1"
    },
    {
      "description": "Production (TLS, not yet deployed)",
      "url": "https://ere.rolec.app/v1"
    }
  ],
  "tags": [
    {
      "name": "Chargers",
      "description": "Charge-point metadata for the grant, including the BAG installation address."
    },
    {
      "name": "Sessions",
      "description": "Session history. Use this to recover an event that a webhook delivery missed."
    },
    {
      "name": "Webhooks",
      "description": "Register the HTTPS endpoint that receives events."
    },
    {
      "name": "Events",
      "description": "Payloads Rolec POSTs to the registered endpoint."
    },
    {
      "name": "Meta",
      "description": "Service metadata and the published contract."
    }
  ],
  "webhooks": {
    "sessionStarted": {
      "post": {
        "operationId": "deliverSessionStarted",
        "summary": "Session started",
        "description": "Sent when a charging session opens. `data.meterStartWh` is the MID import register at start.",
        "tags": [
          "Events"
        ],
        "parameters": [
          {
            "name": "X-Rolec-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "Stable id for this event. Unchanged across retries. Matches `eventId`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Rolec-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "UTC timestamp of this delivery attempt (RFC3339). Reject if older than 5 minutes.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "X-Rolec-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "sha256= + hex(HMAC-SHA256(secret, timestamp + '.' + raw body)).",
            "schema": {
              "type": "string",
              "examples": [
                "sha256=0123456789abcdef"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionStartedEvent"
              },
              "example": {
                "eventId": "8c2a1d40-1111-4a2b-9c3d-000000000001",
                "eventType": "session.started",
                "createdAt": "2026-11-23T07:15:00Z",
                "data": {
                  "sessionId": "6f1c0a2e-7b4d-4e1a-9c3f-2a8b5d6e7f01",
                  "chargerId": "ROLEC-EVO2-004512",
                  "connectorId": 1,
                  "measuringUnitSerial": "RC-EVO2-2026-004512",
                  "midCertified": true,
                  "startedAt": "2026-11-23T07:15:00Z",
                  "idTag": "04A1B2C3",
                  "ocmf": {
                    "status": "not_supported"
                  },
                  "clockReliable": true,
                  "endedAt": "2026-11-23T07:15:00Z",
                  "energyDeliveredWh": 0,
                  "meterStartWh": 1200400,
                  "meterEndWh": 1200400,
                  "state": "active",
                  "lastUpdatedAt": "2026-11-23T07:15:00Z"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event accepted."
          },
          "202": {
            "description": "Event accepted for later processing."
          },
          "204": {
            "description": "Event accepted, no body."
          },
          "400": {
            "description": "Payload rejected. Rolec does not retry."
          },
          "401": {
            "description": "Signature missing or invalid. Rolec does not retry."
          },
          "500": {
            "description": "Receiver failed. Rolec retries."
          }
        },
        "security": []
      }
    },
    "meterReading": {
      "post": {
        "operationId": "deliverMeterReading",
        "summary": "MID register reading",
        "description": "Sent during charging with the current MID import register, in Wh. This is the same register Axle receives.",
        "tags": [
          "Events"
        ],
        "parameters": [
          {
            "name": "X-Rolec-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "Stable id for this event. Unchanged across retries. Matches `eventId`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Rolec-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "UTC timestamp of this delivery attempt (RFC3339). Reject if older than 5 minutes.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "X-Rolec-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "sha256= + hex(HMAC-SHA256(secret, timestamp + '.' + raw body)).",
            "schema": {
              "type": "string",
              "examples": [
                "sha256=0123456789abcdef"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeterReadingEvent"
              },
              "example": {
                "eventId": "8c2a1d40-2222-4a2b-9c3d-000000000002",
                "eventType": "meter.reading",
                "createdAt": "2026-11-23T08:00:00Z",
                "data": {
                  "chargerId": "ROLEC-EVO2-004512",
                  "sessionId": "6f1c0a2e-7b4d-4e1a-9c3f-2a8b5d6e7f01",
                  "connectorId": 1,
                  "measuredAt": "2026-11-23T08:00:00Z",
                  "registerWh": 1206850,
                  "measuringUnitSerial": "RC-EVO2-2026-004512",
                  "midCertified": true
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event accepted."
          },
          "202": {
            "description": "Event accepted for later processing."
          },
          "204": {
            "description": "Event accepted, no body."
          },
          "400": {
            "description": "Payload rejected. Rolec does not retry."
          },
          "401": {
            "description": "Signature missing or invalid. Rolec does not retry."
          },
          "500": {
            "description": "Receiver failed. Rolec retries."
          }
        },
        "security": []
      }
    },
    "sessionCompleted": {
      "post": {
        "operationId": "deliverSessionCompleted",
        "summary": "Session completed",
        "description": "Sent when a session closes. `data` has the MID register at start and end and the energy delivered. This is the event already delivered to Allstar.",
        "tags": [
          "Events"
        ],
        "parameters": [
          {
            "name": "X-Rolec-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "Stable id for this event. Unchanged across retries. Matches `eventId`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Rolec-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "UTC timestamp of this delivery attempt (RFC3339). Reject if older than 5 minutes.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "X-Rolec-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "sha256= + hex(HMAC-SHA256(secret, timestamp + '.' + raw body)).",
            "schema": {
              "type": "string",
              "examples": [
                "sha256=0123456789abcdef"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionCompletedEvent"
              },
              "example": {
                "eventId": "8c2a1d40-3333-4a2b-9c3d-000000000003",
                "eventType": "session.completed",
                "createdAt": "2026-11-23T09:02:04Z",
                "data": {
                  "sessionId": "6f1c0a2e-7b4d-4e1a-9c3f-2a8b5d6e7f01",
                  "chargerId": "ROLEC-EVO2-004512",
                  "connectorId": 1,
                  "measuringUnitSerial": "RC-EVO2-2026-004512",
                  "midCertified": true,
                  "startedAt": "2026-11-23T07:15:00Z",
                  "idTag": "04A1B2C3",
                  "ocmf": {
                    "status": "not_supported"
                  },
                  "clockReliable": true,
                  "endedAt": "2026-11-23T09:02:00Z",
                  "energyDeliveredWh": 14250,
                  "meterStartWh": 1200400,
                  "meterEndWh": 1214650,
                  "state": "completed",
                  "lastUpdatedAt": "2026-11-23T09:02:04Z"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event accepted."
          },
          "202": {
            "description": "Event accepted for later processing."
          },
          "204": {
            "description": "Event accepted, no body."
          },
          "400": {
            "description": "Payload rejected. Rolec does not retry."
          },
          "401": {
            "description": "Signature missing or invalid. Rolec does not retry."
          },
          "500": {
            "description": "Receiver failed. Rolec retries."
          }
        },
        "security": []
      }
    },
    "sessionUpdated": {
      "post": {
        "operationId": "deliverSessionUpdated",
        "summary": "Session updated",
        "description": "Sent when a session is corrected, aborted or voided. `sessionId` stays the same and `lastUpdatedAt` moves.",
        "tags": [
          "Events"
        ],
        "parameters": [
          {
            "name": "X-Rolec-Webhook-Id",
            "in": "header",
            "required": true,
            "description": "Stable id for this event. Unchanged across retries. Matches `eventId`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Rolec-Webhook-Timestamp",
            "in": "header",
            "required": true,
            "description": "UTC timestamp of this delivery attempt (RFC3339). Reject if older than 5 minutes.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "X-Rolec-Webhook-Signature",
            "in": "header",
            "required": true,
            "description": "sha256= + hex(HMAC-SHA256(secret, timestamp + '.' + raw body)).",
            "schema": {
              "type": "string",
              "examples": [
                "sha256=0123456789abcdef"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionUpdatedEvent"
              },
              "example": {
                "eventId": "8c2a1d40-4444-4a2b-9c3d-000000000004",
                "eventType": "session.updated",
                "createdAt": "2026-11-23T09:10:12Z",
                "data": {
                  "sessionId": "6f1c0a2e-7b4d-4e1a-9c3f-2a8b5d6e7f01",
                  "chargerId": "ROLEC-EVO2-004512",
                  "connectorId": 1,
                  "measuringUnitSerial": "RC-EVO2-2026-004512",
                  "midCertified": true,
                  "startedAt": "2026-11-23T07:15:00Z",
                  "idTag": "04A1B2C3",
                  "ocmf": {
                    "status": "not_supported"
                  },
                  "clockReliable": true,
                  "endedAt": "2026-11-23T09:02:00Z",
                  "energyDeliveredWh": 0,
                  "meterStartWh": 1200400,
                  "meterEndWh": 1214650,
                  "state": "voided",
                  "lastUpdatedAt": "2026-11-23T09:10:12Z"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event accepted."
          },
          "202": {
            "description": "Event accepted for later processing."
          },
          "204": {
            "description": "Event accepted, no body."
          },
          "400": {
            "description": "Payload rejected. Rolec does not retry."
          },
          "401": {
            "description": "Signature missing or invalid. Rolec does not retry."
          },
          "500": {
            "description": "Receiver failed. Rolec retries."
          }
        },
        "security": []
      }
    }
  }
}
