openapi: 3.1.0
info:
  version: 0.0.16
  title: OCPI
  contact:
    email: dev@plugo.co.jp
    url: https://plugo.co.jp/
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  x-logo:
    url: https://redocly.github.io/openapi-template/logo.png
  description: OCPI 2.2.1 specification
servers:
  - url: https://www.example.com
    description: Development server
tags:
  - name: Sessions
    description: |
      Module Identifier: sessions

      Data owner: CPO

      Type: Functional Module

      The Session object describes one charging session. The Session object is owned by the CPO back-end system, and can be GET from the CPO system, or pushed by the CPO to another system.
  - name: Commands
    description: |
      Module Identifier: commands

      Type: Functional Module

      The Commands module enables remote commands to be sent to a Location/EVSE. The following commands are supported:
      - CANCEL_RESERVATION • RESERVE_NOW
      - START_SESSION
      - STOP_SESSION
      - UNLOCK_CONNECTOR

      See CommandType for a description of the different commands. Use the UNLOCK_CONNECTOR command with care, please read
      the note at CommandType.

      Module dependency: Locations module, Sessions module
paths:
  /sessions:
    get:
      tags:
        - Sessions
      summary: Sender /sessions
      description: |
        Fetch Sessions from a CPO system.
      operationId: getSessions
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/collectionDateFrom'
        - $ref: '#/components/parameters/collectionDateTo'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionLimit'
      responses:
        '200':
          $ref: '#/components/responses/SessionsResponse'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
  /sessions/{session_id}/charging_preferences:
    put:
      tags:
        - Sessions
      summary: Sender /sessions/{session_id}/charging_preferences
      description: |
        Set/update the driver’s Charging Preferences for this charging session.
      operationId: setChargingPreferences
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/sessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChargingPreferences'
      responses:
        '200':
          $ref: '#/components/responses/ChargingPreferencesResponse'
        '403':
          description: Forbidden
          $ref: '#/components/responses/Problem'
  /sessions/{country_code}/{party_id}/{session_id}:
    get:
      tags:
        - Sessions
      summary: Receiver /sessions/{country_code}/{party_id}/{session_id}
      description: |
        Retrieve a Session object from the eMSP’s system with Session.id equal to {session_id}.
      operationId: getSessionById
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/countryCode'
        - $ref: '#/components/parameters/partyId'
        - $ref: '#/components/parameters/sessionId'
      responses:
        '200':
          $ref: '#/components/responses/SessionResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
    put:
      tags:
        - Sessions
      summary: Receiver /sessions/{country_code}/{party_id}/{session_id}
      description: |
        Inform the eMSP’s system about a new/updated Session object in the CPO’s system.
      operationId: putSessionById
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/countryCode'
        - $ref: '#/components/parameters/partyId'
        - $ref: '#/components/parameters/sessionId'
      requestBody:
        $ref: '#/components/requestBodies/Session'
    patch:
      tags:
        - Sessions
      summary: Receiver /sessions/{country_code}/{party_id}/{session_id}
      description: |
        Same as the PUT method, but only the fields/objects that need to be updated have to be present. Fields/objects which are not specified are considered unchange
      operationId: patchSessionById
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/countryCode'
        - $ref: '#/components/parameters/partyId'
        - $ref: '#/components/parameters/sessionId'
      requestBody:
        required: false
        $ref: '#/components/requestBodies/SessionPatch'
  /commands/START_SESSION:
    post:
      tags:
        - Commands
      summary: Receiver /commands/START_SESSION
      description: |
        Typically implemented by market roles like: CPO.
      security:
        - tokenAuth: []
      operationId: startSession
      requestBody:
        $ref: '#/components/requestBodies/StartSession'
      responses:
        '200':
          $ref: '#/components/responses/CommandResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /commands/STOP_SESSION:
    post:
      tags:
        - Commands
      summary: Receiver /commands/STOP_SESSION
      security:
        - tokenAuth: []
      operationId: stopSession
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StopSession'
      responses:
        '200':
          description: OK
          $ref: '#/components/responses/CommandResponse'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
  /commands/{command}/{uid}:
    post:
      tags:
        - Commands
      summary: Sender /commands/{command}/{uid}
      description: |
        Typically implemented by market roles like: eMSP.
        The Sender interface receives the asynchronous responses.
      operationId: SenderCommandsUID
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/command'
        - $ref: '#/components/parameters/uid'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandResult'
  /tokens/{country_code}/{party_id}/{token_uid}:
    get:
      tags:
        - Tokens
      summary: Receiver /tokens/{country_code}/{party_id}/{token_uid}
      description: |
        Retrieve a Token as it is stored in the CPO system.
      operationId: getTokenById
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/countryCode'
        - $ref: '#/components/parameters/partyId'
        - $ref: '#/components/parameters/tokenUid'
        - name: type
          in: query
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/OneTokenResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Tokens
      summary: Receiver /tokens/{country_code}/{party_id}/{token_uid}
      description: |
        New or updated Token objects are pushed from the eMSP to the CPO.
      operationId: putToken
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/countryCode'
        - $ref: '#/components/parameters/partyId'
        - $ref: '#/components/parameters/tokenUid'
        - $ref: '#/components/parameters/type'
      requestBody:
        $ref: '#/components/requestBodies/Token'
      responses:
        '200':
          description: Token updated
          $ref: '#/components/responses/OneTokenResponse'
        '201':
          description: Token created
          $ref: '#/components/responses/OneTokenResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Tokens
      summary: Receiver /tokens/{country_code}/{party_id}/{token_uid}
      description: |
        New or updated Token objects are pushed from the eMSP to the CPO.
      operationId: patchToken
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/countryCode'
        - $ref: '#/components/parameters/partyId'
        - $ref: '#/components/parameters/tokenUid'
      requestBody:
        $ref: '#/components/requestBodies/TokenPatch'
      responses:
        '200':
          description: Token updated
          $ref: '#/components/responses/OneTokenResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /versions:
    servers:
      - url: https://www.server.com/ocpi/cpo
      - url: https://www.server.com/ocpi/emsp
      - url: https://ocpi.server.com
    get:
      tags:
        - Versions
      summary: /versions
      security:
        - tokenAuth: []
      operationId: getVersions
      responses:
        '200':
          description: OK
          $ref: '#/components/responses/Versions'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
  /{version}:
    servers:
      - url: https://www.server.com/ocpi/cpo
      - url: https://www.server.com/ocpi/emsp
    get:
      tags:
        - Versions
      summary: /{version}
      description: |
        also supports https://ocpi.server.com/{version}/details
      security:
        - tokenAuth: []
      operationId: getVersion
      parameters:
        - name: version
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          $ref: '#/components/responses/Version'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
  /credentials:
    servers:
      - url: https://www.server.com/ocpi/2.2
      - url: https://www.server.com/ocpi/emsp/2.2
    get:
      tags:
        - Credentials
      summary: Get
      description: |
        Retrieves the credentials object to access the server’s platform.
      operationId: getCredentials
      security:
        - tokenAuth: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credentials'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
    post:
      tags:
        - Credentials
      summary: Register
      description: |
        Provides the server with a credentials object to access the client’s system (i.e. register).
      operationId: postCredentials
      security:
        - tokenAuth: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Credentials'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credentials'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
        '405':
          description: |
            This method MUST return a HTTP status code 405: method not allowed if the client has already been registered.
          $ref: '#/components/responses/MethodNotAllowed'
    put:
      tags:
        - Credentials
      summary: Update
      description: |
        Provides the server with an updated credentials object to access the client’s system.
      operationId: putCredentials
      security:
        - tokenAuth: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Credentials'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credentials'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
        '405':
          description: |
            This method MUST return a HTTP status code 405: method not allowed if the client has not been registered yet.
          $ref: '#/components/responses/MethodNotAllowed'
    delete:
      tags:
        - Credentials
      summary: Unregister
      description: |
        Informs the server that its credentials to the client’s system are now invalid (i.e. unregister).
      operationId: deleteCredentials
      security:
        - tokenAuth: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Credentials'
      responses:
        '202':
          description: credentials are invalid and can no longer be used
          $ref: '#/components/responses/Accepted'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
        '405':
          description: |
            This method MUST return a HTTP status code 405: method not allowed if the client has not been registered yet.
          $ref: '#/components/responses/MethodNotAllowed'
  /locations:
    get:
      tags:
        - Locations
      summary: Sender /locations
      description: |
        Fetch a list of Locations
      operationId: getLocations
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/collectionDateFrom'
        - $ref: '#/components/parameters/collectionDateTo'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionLimit'
      responses:
        '200':
          $ref: '#/components/responses/LocationsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /locations/{location_id}:
    get:
      tags:
        - Locations
      summary: Sender /locations/{location_id}
      operationId: getLocation_by_location_id
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/locationId'
      responses:
        '200':
          $ref: '#/components/responses/Location'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /locations/{location_id}/{evse_uid}:
    get:
      tags:
        - Locations
      summary: Sender /locations/{location_id}/{evse_uid}
      operationId: getLocation_by_location_id_evse_uid
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/locationId'
        - $ref: '#/components/parameters/evseUid'
      responses:
        '200':
          $ref: '#/components/responses/Location'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /locations/{location_id}/{evse_uid}/{connector_id}:
    get:
      tags:
        - Locations
      summary: Sender /locations/{location_id}/{evse_uid}]/[{connector_id}
      operationId: getLocation_by_location_id_evse_uid_connector_id
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/locationId'
        - $ref: '#/components/parameters/evseUid'
        - $ref: '#/components/parameters/connectorId'
      responses:
        '200':
          $ref: '#/components/responses/Location'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /tariffs:
    get:
      tags:
        - Tariffs
      summary: Sender /tariffs
      operationId: getTariffs
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/collectionDateFrom'
        - $ref: '#/components/parameters/collectionDateTo'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionLimit'
      responses:
        '200':
          $ref: '#/components/responses/TariffsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /cdrs:
    get:
      tags:
        - CDRs
      summary: Sender /cdrs
      operationId: getCdrs
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/collectionDateFrom'
        - $ref: '#/components/parameters/collectionDateTo'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionLimit'
      responses:
        '200':
          $ref: '#/components/responses/CdrsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      tags:
        - CDRs
      summary: Receiver /cdrs
      operationId: createCdr
      security:
        - tokenAuth: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CDR'
      responses:
        '201':
          description: Created
          headers:
            Location:
              schema:
                $ref: '#/components/schemas/URL'
              example: https://www.server.com/ocpi/emsp/2.2/cdrs/123456
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /cdrs/{cdr_id}:
    get:
      tags:
        - CDRs
      summary: Receiver /cdrs/{cdr_id}
      operationId: getCdrById
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/cdrId'
      responses:
        '200':
          $ref: '#/components/responses/CdrResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /chargingprofiles/{session_id}:
    put:
      tags:
        - ChargingProfiles
      summary: '{chargingprofiles_endpoint_url}{session_id}'
      description: |
        Creates a new ChargingProfile on a session, or replaces an existing ChargingProfile on the EVSE.
      operationId: updateChargingProfile
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/sessionId'
      requestBody:
        description: SetChargingProfile
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetChargingProfile'
      responses:
        '200':
          description: OK
          $ref: '#/components/responses/SetChargingProfileResponse'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Not Found
          $ref: '#/components/responses/NotFound'
  /clientinfo/{country_code}/{party_id}:
    get:
      tags:
        - HubClientInfo
      summary: 'Receiver: {clientinfo_endpoint_url}/{country_code}/{party_id}'
      description: |
        Retrieve a ClientInfo object as it is stored in the connected clients system.
      operationId: getClientInfo
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/countryCode'
        - $ref: '#/components/parameters/partyId'
      responses:
        '200':
          description: OK
          $ref: '#/components/responses/ClientInfoResponse'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Not Found
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - HubClientInfo
      summary: 'Receiver: {clientinfo_endpoint_url}/{country_code}/{party_id}'
      description: |
        New or updated ClientInfo objects are pushed from the Hub to a connected client.
      operationId: putClientInfo
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/countryCode'
        - $ref: '#/components/parameters/partyId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientInfo'
      responses:
        '200':
          description: Updated
          $ref: '#/components/responses/ClientInfoResponse'
        '201':
          description: Created
          $ref: '#/components/responses/ClientInfoResponse'
        '400':
          description: Bad Request
          $ref: '#/components/responses/BadRequest'
        '401':
          description: Unauthorized
          $ref: '#/components/responses/Unauthorized'
  /hubclientinfo:
    get:
      tags:
        - HubClientInfo
      summary: 'Sender: {locations_endpoint_url}'
      description: |
        Get the list of known ClientInfo objects, last updated between the {date_from} and {date_to} paginated)
      operationId: getHubClientInfos
      security:
        - tokenAuth: []
      parameters:
        - $ref: '#/components/parameters/collectionDateFrom'
        - $ref: '#/components/parameters/collectionDateTo'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionLimit'
      responses:
        '200':
          $ref: '#/components/responses/ClientInfosResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  securitySchemes:
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
  schemas:
    DateTime:
      summary: DateTime type
      type: string
      format: date-time
      examples:
        - '2015-06-29T20:39:09Z'
    BaseResponse:
      required:
        - status_code
        - timestamp
      properties:
        data:
          description: |
            * or ?
            Contains the actual response data object or list of objects from each request, depending on the cardinality of the response data, this is an array (card. * or +), or a single object (card. 1 or ?)
        status_code:
          type: number
          example: 200
        status_message:
          type: string
          example: OK
        timestamp:
          type: string
          format: date-time
          example: '2020-01-01T00:00:00Z'
    CountryCode:
      summary: country_code
      type: string
      maxLength: 2
      minLength: 2
      description: |
        ISO-3166 alpha-2 country code
      example: JP
    PartyID:
      summary: party_id
      type: string
      maxLength: 3
      description: |
        ID of the CPO (following the ISO-15118 standard).
      example: PLU
    CdrToken:
      required:
        - country_code
        - party_id
        - contract_id
        - type
        - uid
      type: object
      properties:
        country_code:
          $ref: '#/components/schemas/CountryCode'
        party_id:
          $ref: '#/components/schemas/PartyID'
        uid:
          type: string
          description: |
            Unique ID by which this Token can be identified.
            This is the field used by the CPO’s system (RFID reader on the Charge Point) to identify this token.
            Currently, in most cases: type=RFID, this is the RFID hidden ID as read by the RFID reader, but that is not a requirement.
            If this is a type=APP_USER Token, it will be a unique, by the eMSP, generated ID.
        type:
          type: string
          enum:
            - AD_HOC_USER
            - APP_USER
            - OTHER
            - RFID
        contract_id:
          type: string
          description: |
            Uniquely identifies the EV driver contract token within the eMSP’s platform (and suboperator platforms). Recommended to follow the specification for eMA ID from "eMI3 standard version V1.0" (http://emi3group.com/documents-links/) "Part 2: business objects."
    CdrDimension:
      required:
        - type
        - volume
      type: object
      properties:
        type:
          type: string
          enum:
            - CURRENT
            - ENERGY
            - ENERGY_EXPORT
            - ENERGY_IMPORT
            - MAX_CURRENT
            - MIN_CURRENT
            - MAX_POWER
            - MIN_POWER
            - PARKING_TIME
            - POWER
            - RESERVATION_TIME
            - STATE_OF_CHARGE
            - TIME
        volume:
          type: number
          format: float
    ChargingPeriod:
      required:
        - dimensions
        - start_date_time
      type: object
      properties:
        start_date_time:
          type: string
          format: date-time
        dimensions:
          type: array
          items:
            $ref: '#/components/schemas/CdrDimension'
        tariff_id:
          type: string
    Price:
      required:
        - excl_vat
      type: object
      properties:
        excl_vat:
          type: number
          format: float
        incl_vat:
          type: number
          format: float
    Session:
      required:
        - auth_method
        - cdr_token
        - connector_id
        - country_code
        - currency
        - evse_uid
        - id
        - kwh
        - last_updated
        - location_id
        - party_id
        - start_date_time
        - status
      type: object
      properties:
        country_code:
          $ref: '#/components/schemas/CountryCode'
        party_id:
          $ref: '#/components/schemas/PartyID'
        id:
          type: string
        start_date_time:
          type: string
          format: date-time
          description: |
            The timestamp when the session became ACTIVE in the Charge Point.
            When the session is still PENDING, this field SHALL be set to the time the Session was created at the Charge Point. When a Session goes from PENDING to ACTIVE, this field SHALL be updated to the moment the Session went to ACTIVE in the Charge Point.
        end_date_time:
          type: string
          format: date-time
        kwh:
          type: number
          format: float
        cdr_token:
          $ref: '#/components/schemas/CdrToken'
        auth_method:
          type: string
          enum:
            - AUTH_REQUEST
            - COMMAND
            - WHITELIST
          description: |
            Method used for authentication. This might change during a session, for example when the session was started with a reservation: ReserveNow: COMMAND. When the driver arrives and starts charging using a Token that is whitelisted: WHITELIST.
        authorization_reference:
          type: string
        location_id:
          type: string
        evse_uid:
          type: string
          description: |
            EVSE.uid of the EVSE of this Location on which the charging session is/was happening. Allowed to be set to: #NA when this session is created for a reservation, but no EVSE yet assigned to the driver.
        connector_id:
          type: string
        meter_id:
          type: string
        currency:
          type: string
        charging_periods:
          type: array
          items:
            $ref: '#/components/schemas/ChargingPeriod'
        total_cost:
          $ref: '#/components/schemas/Price'
        status:
          type: string
          enum:
            - ACTIVE
            - COMPLETED
            - INVALID
            - PENDING
            - RESERVATION
        last_updated:
          $ref: '#/components/schemas/DateTime'
    ChargingPreferences:
      required:
        - profile_type
      type: object
      properties:
        profile_type:
          type: string
          enum:
            - CHEAP
            - FAST
            - GREEN
            - REGULAR
        departure_time:
          type: string
        energy_need:
          type: number
          format: float
        discharge_allowed:
          type: boolean
    Problem:
      type: object
      additionalProperties: true
      minProperties: 1
      description: The Problem Details JSON Object [[RFC7807](https://tools.ietf.org/html/rfc7807)].
      properties:
        type:
          type: string
          description: A URI reference [[RFC3986](https://tools.ietf.org/html/rfc3986)] that identifies the problem type. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank".
          format: uri
        title:
          type: string
          description: A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
        status:
          type: integer
          description: The HTTP status code.
          minimum: 400
          maximum: 599
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence of the problem.
        instance:
          type: string
          description: A URI reference that identifies the specific occurrence of the problem.  It may or may not yield further information if dereferenced.
    SessionPatch:
      required:
        - last_updated
      type: object
      properties:
        country_code:
          $ref: '#/components/schemas/CountryCode'
        party_id:
          $ref: '#/components/schemas/PartyID'
        id:
          type: string
        start_date_time:
          type: string
        end_date_time:
          type: string
        kwh:
          type: number
          format: float
        cdr_token:
          $ref: '#/components/schemas/CdrToken'
        auth_method:
          type: string
          enum:
            - AUTH_REQUEST
            - COMMAND
            - WHITELIST
        authorization_reference:
          type: string
        location_id:
          type: string
        evse_uid:
          type: string
        connector_id:
          type: string
        meter_id:
          type: string
        currency:
          type: string
        charging_periods:
          type: array
          items:
            $ref: '#/components/schemas/ChargingPeriod'
        total_cost:
          $ref: '#/components/schemas/Price'
        status:
          type: string
          enum:
            - ACTIVE
            - COMPLETED
            - INVALID
            - PENDING
            - RESERVATION
        last_updated:
          $ref: '#/components/schemas/DateTime'
    EnergyContract:
      summary: EnergyContract class
      description: Information about a energy contract that belongs to a Token so a driver could use his/her own energy contract when charging at a Charge Point.
      type: object
      required:
        - supplier_name
      properties:
        supplier_name:
          type: string
          description: Name of the energy supplier.
          example: The Green Power Company
          maxLength: 64
        contract_id:
          type: string
          description: Contract ID at the energy supplier, that belongs to the owner of this token.
          example: 123456789
          maxLength: 64
    Token:
      summary: Token Object
      required:
        - country_code
        - party_id
        - uid
        - type
        - contract_id
        - issuer
        - valid
        - whitelist
        - last_updated
      type: object
      properties:
        country_code:
          $ref: '#/components/schemas/CountryCode'
        party_id:
          type: string
        uid:
          type: string
        type:
          description: TokenType enum
          type: string
          enum:
            - AD_HOC_USER
            - APP_USER
            - OTHER
            - RFID
        contract_id:
          type: string
        visual_number:
          type: string
        issuer:
          type: string
        group_id:
          type: string
        valid:
          type: boolean
        whitelist:
          type: string
          summary: WhitelistType enum
          description: Defines when authorization of a Token by the CPO is allowed.
          enum:
            - ALWAYS
            - ALLOWED
            - ALLOWED_OFFLINE
            - NEVER
        language:
          type: string
        default_profile_type:
          type: string
          summary: ProfileType enum
          description: Different smart charging profile types.
          enum:
            - CHEAP
            - FAST
            - GREEN
            - REGULAR
        energy_contract:
          $ref: '#/components/schemas/EnergyContract'
        last_updated:
          $ref: '#/components/schemas/DateTime'
    StartSession:
      required:
        - response_url
        - token
        - location_id
      type: object
      properties:
        response_url:
          type: string
        token:
          $ref: '#/components/schemas/Token'
        location_id:
          type: string
        evse_uid:
          type: string
        connector_id:
          type: string
        authorization_reference:
          type: string
    CommandResponseType:
      type: string
      summary: CommandResponseType enum
      enum:
        - NOT_SUPPORTED
        - REJECTED
        - ACCEPTED
        - UNKNOWN_SESSION
    DisplayText:
      required:
        - language
        - text
      type: object
      summary: DisplayText class
      properties:
        language:
          type: string
          description: Language Code ISO 639-1.
          example: en
          maxLength: 2
          minLength: 2
        text:
          type: string
          example: Standard Tariff
          description: Text to be displayed to a end user. No markup, html etc. allowed.
          maxLength: 512
    CommandResponse:
      type: object
      required:
        - result
        - timeout
      properties:
        result:
          $ref: '#/components/schemas/CommandResponseType'
        timeout:
          type: integer
        message:
          $ref: '#/components/schemas/DisplayText'
    StopSession:
      required:
        - response_url
        - session_id
      type: object
      properties:
        response_url:
          type: string
        session_id:
          type: string
    CommandResultType:
      type: string
      summary: CommandResultType enum
      description: Result of the command that was send to the Charge Point.
      enum:
        - ACCEPTED
        - CANCELED_RESERVATION
        - EVSE_OCCUPIED
        - EVSE_INOPERATIVE
        - FAILED
        - NOT_SUPPORTED
        - REJECTED
        - TIMEOUT
        - UNKNOWN_RESERVATION
    CommandResult:
      required:
        - result
        - message
      type: object
      properties:
        result:
          $ref: '#/components/schemas/CommandResultType'
        message:
          $ref: '#/components/schemas/DisplayText'
    TokenPatch:
      summary: Token patch payload
      required:
        - last_updated
      type: object
      properties:
        country_code:
          type: string
        party_id:
          type: string
        uid:
          type: string
        type:
          description: TokenType enum
          type: string
          enum:
            - AD_HOC_USER
            - APP_USER
            - OTHER
            - RFID
        contract_id:
          type: string
        visual_number:
          type: string
        issuer:
          type: string
        group_id:
          type: string
        valid:
          type: boolean
        whitelist:
          type: string
          summary: WhitelistType enum
          description: Defines when authorization of a Token by the CPO is allowed.
          enum:
            - ALWAYS
            - ALLOWED
            - ALLOWED_OFFLINE
            - NEVER
        language:
          type: string
        default_profile_type:
          type: string
          summary: ProfileType enum
          description: Different smart charging profile types.
          enum:
            - CHEAP
            - FAST
            - GREEN
            - REGULAR
        energy_contract:
          $ref: '#/components/schemas/EnergyContract'
        last_updated:
          $ref: '#/components/schemas/DateTime'
      example:
        valid: false
        last_updated: '2019-06-19T02:11:11Z'
    VersionNumber:
      description: VersionNumber enum
      type: string
      enum:
        - '2.0'
        - '2.1'
        - 2.1.1
        - '2.2'
        - 2.2.1
      example: 2.2.1
    Version:
      required:
        - version
        - url
      type: object
      properties:
        version:
          $ref: '#/components/schemas/VersionNumber'
        url:
          type: string
          example: https://www.example.com/ocpi/cpo/2.2.1
    Versions:
      type: array
      items:
        $ref: '#/components/schemas/Version'
      example:
        - version: 2.2.1
          url: https://www.example.com/ocpi/cpo/2.2.1
        - version: '2.2'
          url: https://www.example.com/ocpi/cpo/2.2
    ModuleID:
      description: ModuleID enum
      type: string
      enum:
        - cdrs
        - chargingprofiles
        - commands
        - credentials
        - hubclientinfo
        - locations
        - sessions
        - tariffs
        - tokens
    InterfaceRole:
      description: InterfaceRole enum
      type: string
      enum:
        - SENDER
        - RECEIVER
    Endpoint:
      description: Endpoint
      type: object
      required:
        - identifier
        - role
        - url
      properties:
        identifier:
          $ref: '#/components/schemas/ModuleID'
        role:
          $ref: '#/components/schemas/InterfaceRole'
        url:
          type: string
          example: https://www.server.com/ocpi/cpo/2.2
    VersionDetail:
      required:
        - version
        - endpoints
      type: object
      properties:
        version:
          $ref: '#/components/schemas/VersionNumber'
        endpoints:
          type: array
          items:
            $ref: '#/components/schemas/Endpoint'
    URL:
      summary: URL
      type: string
      format: uri
      maxLength: 255
    Role:
      summary: Role enum
      type: string
      enum:
        - CPO
        - EMSP
        - HUB
        - NAP
        - NSP
        - OTHER
        - SCSP
    ImageCategory:
      summary: ImageCategory enum
      type: string
      enum:
        - CHARGER
        - ENTRANCE
        - LOCATION
        - NETWORK
        - OPERATOR
        - OTHER
        - OWNER
    Image:
      summary: Image class
      type: object
      required:
        - url
        - category
        - type
      properties:
        url:
          $ref: '#/components/schemas/URL'
        thumbnail:
          $ref: '#/components/schemas/URL'
        category:
          $ref: '#/components/schemas/ImageCategory'
        type:
          type: string
          maxLength: 4
          description: |
            Image type like: gif, jpeg, png, svg.
        width:
          type: integer
          maximum: 99999
        height:
          type: integer
          maximum: 99999
    BusinessDetails:
      summary: BusinessDetails class
      type: object
      required:
        - name
      properties:
        name:
          type: string
          maxLength: 100
          description: Name of the operator.
        website:
          $ref: '#/components/schemas/URL'
        logo:
          $ref: '#/components/schemas/Image'
    CredentialsRole:
      summary: CredentialsRole class
      type: object
      required:
        - role
        - business_details
        - party_id
        - country_code
      properties:
        role:
          $ref: '#/components/schemas/Role'
        business_details:
          $ref: '#/components/schemas/BusinessDetails'
        party_id:
          $ref: '#/components/schemas/PartyID'
        country_code:
          $ref: '#/components/schemas/CountryCode'
    Credentials:
      summary: Credentials object
      description: |
        Every role needs a unique combination of: role, party_id and country_code.
      type: object
      required:
        - token
        - url
        - roles
      properties:
        token:
          type: string
          maxLength: 64
        url:
          $ref: '#/components/schemas/URL'
        roles:
          type: array
          items:
            $ref: '#/components/schemas/CredentialsRole'
      examples:
        - a minimal CPO credentials object: null
          value:
            token: ebf3b399-779f-4497-9b9d-ac6ad3cc44d2
            url: https://example.com/ocpi/versions/
            roles:
              - role: CPO
                business_details:
                  name: Example Operator
                party_id: EXA
                country_code: NL
        - a combined CPO/eMSP credentials object:
            value:
              token: 9e80a9c4-28be-11e9-b210-d663bd873d93
              url: https://ocpi.example.com/versions/
              roles:
                - role: CPO
                  party_id: EXA
                  country_code: NL
                  business_details:
                    name: Example Operator
                - role: EMSP
                  party_id: EXA
                  country_code: NL
                  business_details:
                    name: Example Provider
    GeoLocation:
      summary: GeoLocation class
      type: object
      required:
        - latitude
        - longitude
      properties:
        latitude:
          type: string
          maxLength: 10
          pattern: ^-?[0-9]{1,2}\.[0-9]{5,7}$
        longitude:
          type: string
          maxLength: 11
          pattern: ^-?[0-9]{1,3}\.[0-9]{5,7}$
    AdditionalGeoLocation:
      summary: AdditionalGeoLocation class
      type: object
      required:
        - latitude
        - longitude
      properties:
        latitude:
          type: string
          maxLength: 10
          pattern: ^-?[0-9]{1,2}\.[0-9]{5,7}$
        longitude:
          type: string
          maxLength: 11
          pattern: ^-?[0-9]{1,3}\.[0-9]{5,7}$
        name:
          $ref: '#/components/schemas/DisplayText'
    ParkingType:
      summary: ParkingType enum
      type: string
      enum:
        - ALONG_MOTORWAY
        - PARKING_GARAGE
        - PARKING_LOT
        - ON_DRIVEWAY
        - ON_STREET
        - UNDERGROUND_GARAGE
    Status:
      summary: Status enum
      description: The status of an EVSE.
      type: string
      enum:
        - AVAILABLE
        - BLOCKED
        - CHARGING
        - INOPERATIVE
        - OUTOFORDER
        - PLANNED
        - REMOVED
        - RESERVED
        - UNKNOWN
    StatusSchedule:
      summary: StatusSchedule class
      type: object
      required:
        - period_begin
        - status
      properties:
        period_begin:
          $ref: '#/components/schemas/DateTime'
        period_end:
          $ref: '#/components/schemas/DateTime'
        status:
          $ref: '#/components/schemas/Status'
    Capability:
      summary: Capability enum
      description: The capability of an EVSE.
      type: string
      enum:
        - CHARGING_PROFILE_CAPABLE
        - CHARGING_PREFERENCES_CAPABLE
        - CHIP_CARD_SUPPORT
        - CONTACTLESS_CARD_SUPPORT
        - CREDIT_CARD_PAYABLE
        - DEBIT_CARD_PAYABLE
        - PED_TERMINAL
        - REMOTE_START_STOP_CAPABLE
        - RESERVABLE
        - RFID_READER
        - START_SESSION_CONNECTOR_REQUIRED
        - TOKEN_GROUP_CAPABLE
        - UNLOCK_CAPABLE
    ConnectorType:
      summary: ConnectorType enum
      type: string
      enum:
        - CHADEMO
        - CHAOJI
        - DOMESTIC_A
        - DOMESTIC_B
        - DOMESTIC_C
        - DOMESTIC_D
        - DOMESTIC_E
        - DOMESTIC_F
        - DOMESTIC_G
        - DOMESTIC_H
        - DOMESTIC_I
        - DOMESTIC_J
        - DOMESTIC_K
        - DOMESTIC_L
        - DOMESTIC_M
        - DOMESTIC_N
        - DOMESTIC_O
        - GBT_AC
        - GBT_DC
        - IEC_60309_2_single_16
        - IEC_60309_2_three_16
        - IEC_60309_2_three_32
        - IEC_60309_2_three_64
        - IEC_62196_T1
        - IEC_62196_T1_COMBO
        - IEC_62196_T2
        - IEC_62196_T2_COMBO
        - IEC_62196_T3A
        - IEC_62196_T3C
        - NEMA_5_20
        - NEMA_6_30
        - NEMA_6_50
        - NEMA_10_30
        - NEMA_10_50
        - NEMA_14_30
        - NEMA_14_50
        - PANTOGRAPH_BOTTOM_UP
        - PANTOGRAPH_TOP_DOWN
        - TESLA_R
        - TESLA_S
    ConnectorFormat:
      summary: ConnectorFormat enum
      type: string
      enum:
        - SOCKET
        - CABLE
    PowerType:
      summary: PowerType enum
      type: string
      enum:
        - AC_1_PHASE
        - AC_2_PHASE
        - AC_2_PHASE_SPLIT
        - AC_3_PHASE
        - DC
    Connector:
      summary: Connector Object
      type: object
      required:
        - id
        - standard
        - format
        - power_type
        - max_voltage
        - max_amperage
        - last_updated
      properties:
        id:
          type: string
          maxLength: 36
        standard:
          $ref: '#/components/schemas/ConnectorType'
        format:
          $ref: '#/components/schemas/ConnectorFormat'
        power_type:
          $ref: '#/components/schemas/PowerType'
        max_voltage:
          type: integer
          minimum: 0
          maximum: 999
        max_amperage:
          type: integer
        max_electric_power:
          type: integer
        tariff_ids:
          type: array
          items:
            type: string
            maxLength: 36
        terms_and_conditions:
          $ref: '#/components/schemas/URL'
        last_updated:
          $ref: '#/components/schemas/DateTime'
    ParkingRestriction:
      summary: ParkingRestriction enum
      type: string
      enum:
        - EV_ONLY
        - PLUGGED
        - DISABLED
        - CUSTOMERS
        - MOTORCYCLES
    EVSE:
      type: object
      required:
        - uid
        - status
        - connectors
        - last_updated
      properties:
        uid:
          type: string
          maxLength: 36
        evse_id:
          type: string
          maxLength: 48
        status:
          $ref: '#/components/schemas/Status'
        status_schedule:
          type: array
          items:
            $ref: '#/components/schemas/StatusSchedule'
        capabilities:
          type: array
          items:
            $ref: '#/components/schemas/Capability'
        connectors:
          type: array
          items:
            $ref: '#/components/schemas/Connector'
        floor_level:
          type: string
          maxLength: 4
        coordinates:
          $ref: '#/components/schemas/GeoLocation'
        physical_reference:
          type: string
          maxLength: 16
        directions:
          type: array
          items:
            $ref: '#/components/schemas/DisplayText'
        parking_restrictions:
          type: array
          items:
            $ref: '#/components/schemas/ParkingRestriction'
        images:
          type: array
          items:
            $ref: '#/components/schemas/Image'
        last_updated:
          type: string
          format: date-time
    Facility:
      description: Facility enum
      type: string
      enum:
        - HOTEL
        - RESTAURANT
        - CAFE
        - MALL
        - SUPERMARKET
        - SPORT
        - RECREATION_AREA
        - NATURE
        - MUSEUM
        - BIKE_SHARING
        - BUS_STOP
        - TAXI_STAND
        - TRAM_STOP
        - METRO_STATION
        - TRAIN_STATION
        - AIRPORT
        - PARKING_LOT
        - CARPOOL_PARKING
        - FUEL_STATION
        - WIFI
    RegularHours:
      description: RegularHours class
      type: object
      required:
        - weekday
        - period_begin
        - period_end
      properties:
        weekday:
          type: integer
          minimum: 1
          maximum: 7
          description: |
            Number of day in the week, from Monday (1) till Sunday (7)
        period_begin:
          type: string
          maxLength: 5
          pattern: ^[0-1][0-9]|2[0-3]):[0-5][0-9]$
        period_end:
          type: string
          maxLength: 5
          pattern: ^[0-1][0-9]|2[0-3]):[0-5][0-9]$
    ExceptionalPeriod:
      description: ExceptionalPeriod class
      type: object
      required:
        - period_begin
        - period_end
      properties:
        period_begin:
          $ref: '#/components/schemas/DateTime'
        period_end:
          $ref: '#/components/schemas/DateTime'
    Hours:
      description: Hours class
      type: object
      required:
        - twentyfourseven
      properties:
        twentyfourseven:
          type: boolean
        regular_hours:
          type: array
          items:
            $ref: '#/components/schemas/RegularHours'
        exceptional_openings:
          $ref: '#/components/schemas/ExceptionalPeriod'
        exceptional_closings:
          $ref: '#/components/schemas/ExceptionalPeriod'
    EnergySourceCategory:
      description: EnergySourceCategory enum
      type: string
      enum:
        - NUCLEAR
        - GENERAL_FOSSIL
        - COAL
        - GAS
        - GENERAL_GREEN
        - SOLAR
        - WIND
        - WATER
    EnergySource:
      description: EnergySource class
      type: object
      required:
        - source
        - percentage
      properties:
        source:
          $ref: '#/components/schemas/EnergySourceCategory'
        percentage:
          type: number
          minimum: 0
          maximum: 100
          multipleOf: 0.01
    EnvironmentalImpactCategory:
      description: EnvironmentalImpactCategory enum
      type: string
      enum:
        - NUCLEAR_WASTE
        - CARBON_DIOXIDE
    EnvironmentalImpact:
      description: EnvironmentalImpact class
      type: object
      required:
        - category
        - amount
      properties:
        category:
          $ref: '#/components/schemas/EnvironmentalImpactCategory'
        amount:
          type: number
          minimum: 0
          maximum: 100
          multipleOf: 0.01
    EnergyMix:
      description: EnergyMix class
      type: object
      required:
        - is_green_energy
      properties:
        is_green_energy:
          type: boolean
        energy_sources:
          type: array
          items:
            $ref: '#/components/schemas/EnergySource'
        environ_impact:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentalImpact'
        supplier_name:
          type: string
          maxLength: 64
        energy_product_name:
          type: string
          maxLength: 64
    Location:
      type: object
      required:
        - country_code
        - party_id
        - id
        - publish
        - address
        - city
        - country
        - coordinates
        - time_zone
        - last_updated
      properties:
        country_code:
          $ref: '#/components/schemas/CountryCode'
        party_id:
          $ref: '#/components/schemas/PartyID'
        id:
          type: string
          maxLength: 36
        publish:
          type: boolean
        publish_allowed_to:
          type: array
          items:
            type: string
            maxLength: 3
        name:
          type: string
          maxLength: 255
        address:
          type: string
          maxLength: 45
        city:
          type: string
          maxLength: 45
        postal_code:
          type: string
          maxLength: 10
        state:
          type: string
          maxLength: 20
        country:
          type: string
          maxLength: 3
        coordinates:
          $ref: '#/components/schemas/GeoLocation'
        related_locations:
          type: array
          items:
            $ref: '#/components/schemas/AdditionalGeoLocation'
        parking_type:
          type: array
          items:
            $ref: '#/components/schemas/ParkingType'
        evses:
          type: array
          items:
            $ref: '#/components/schemas/EVSE'
        directions:
          type: array
          items:
            $ref: '#/components/schemas/DisplayText'
        operator:
          $ref: '#/components/schemas/BusinessDetails'
        suboperator:
          $ref: '#/components/schemas/BusinessDetails'
        owner:
          $ref: '#/components/schemas/BusinessDetails'
        facilities:
          type: array
          items:
            $ref: '#/components/schemas/Facility'
        time_zone:
          type: string
          maxLength: 255
        opening_times:
          type: array
          items:
            $ref: '#/components/schemas/Hours'
        charging_when_closed:
          type: boolean
        images:
          type: array
          items:
            $ref: '#/components/schemas/Image'
        energy_mix:
          $ref: '#/components/schemas/EnergyMix'
        last_updated:
          $ref: '#/components/schemas/DateTime'
    TariffType:
      summary: TariffType enum
      type: string
      enum:
        - AD_HOC_PAYMENT
        - PROFILE_CHEAP
        - PROFILE_FAST
        - PROFILE_GREEN
        - REGULAR
    TariffDimensionType:
      summary: TariffDimensionType enum
      type: string
      enum:
        - ENERGY
        - FLAT
        - PARKING_TIME
        - TIME
    number:
      summary: number type
      type: number
      format: number
      minimum: 0.0001
      maximum: 9999.9999
    PriceComponent:
      summary: PriceComponent class
      type: object
      required:
        - type
        - price
        - step_size
      properties:
        type:
          $ref: '#/components/schemas/TariffDimensionType'
        price:
          $ref: '#/components/schemas/number'
        vat:
          $ref: '#/components/schemas/number'
        step_size:
          type: integer
    time:
      summary: time type
      description: |
        time of day in local time, the time zone is defined in the time_zone field of the Location, for example 13:30, valid from this time of the day. Must be in 24h format with leading zeros. Hour/Minute separator: ":" Regex: ([0-1][0- 9]|2[0-3]):[0-5][0-9]
      type: string
      maxLength: 5
      minLength: 5
      pattern: ([0-1][0-9]|2[0-3]):[0-5][0-9]
    day:
      summary: day type
      description: |
        date in local time, the time zone is defined in the time_zone field of the Location, for example: 2015-12-24, valid from this day (inclusive). Regex: ([12][0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])
      type: string
      maxLength: 10
      minLength: 10
      pattern: ([12][0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])
    DayOfWeek:
      summary: DayOfWeek enum
      type: string
      enum:
        - MONDAY
        - TUESDAY
        - WEDNESDAY
        - THURSDAY
        - FRIDAY
        - SATURDAY
        - SUNDAY
    ReservationRestrictionType:
      summary: ReservationRestrictionType enum
      type: string
      enum:
        - RESERVATION
        - RESERVATION_EXPIRES
    TariffRestrictions:
      summary: TariffRestrictions class
      type: object
      properties:
        star_time:
          $ref: '#/components/schemas/time'
        end_time:
          $ref: '#/components/schemas/time'
        start_date:
          $ref: '#/components/schemas/day'
        end_date:
          $ref: '#/components/schemas/day'
        min_kwh:
          $ref: '#/components/schemas/number'
        max_kwh:
          $ref: '#/components/schemas/number'
        min_current:
          $ref: '#/components/schemas/number'
        max_current:
          $ref: '#/components/schemas/number'
        min_power:
          $ref: '#/components/schemas/number'
        max_power:
          $ref: '#/components/schemas/number'
        min_duration:
          type: integer
        max_duration:
          type: integer
        day_of_week:
          $ref: '#/components/schemas/DayOfWeek'
        reservation:
          $ref: '#/components/schemas/ReservationRestrictionType'
    TariffElement:
      summary: TariffElement class
      type: object
      required:
        - price_components
      properties:
        price_components:
          type: array
          items:
            $ref: '#/components/schemas/PriceComponent'
        restrictions:
          $ref: '#/components/schemas/TariffRestrictions'
    Tariff:
      type: object
      required:
        - country_code
        - party_id
        - id
        - currency
        - elements
        - last_updated
      properties:
        country_code:
          $ref: '#/components/schemas/CountryCode'
        party_id:
          $ref: '#/components/schemas/PartyID'
        id:
          type: string
          maxLength: 36
        currency:
          type: string
          maxLength: 3
          description: ISO-4217 code of the currency
        type:
          $ref: '#/components/schemas/TariffType'
        tariff_alt_text:
          $ref: '#/components/schemas/DisplayText'
        tariff_alt_url:
          $ref: '#/components/schemas/URL'
        min_price:
          $ref: '#/components/schemas/Price'
        max_price:
          $ref: '#/components/schemas/Price'
        elements:
          type: array
          items:
            $ref: '#/components/schemas/TariffElement'
        start_date_time:
          $ref: '#/components/schemas/DateTime'
        end_date_time:
          $ref: '#/components/schemas/DateTime'
        energy_min:
          $ref: '#/components/schemas/EnergyMix'
        last_updated:
          $ref: '#/components/schemas/DateTime'
      example:
        country_code: DE
        party_id: ALL
        id: 16
        currency: EUR
        elements:
          - price_components:
              - type: ENERGY
                price: 0.25
                vat: 10
                step_size: 1
        last_updated: '2018-12-17T11:16:55Z'
    AuthMethod:
      summary: AuthMethod enum
      type: string
      enum:
        - AUTH_REQUEST
        - COMMAND
        - WHITELIST
    CdrLocation:
      summary: CdrLocation class
      description: The CdrLocation class contains only the relevant information from the Location object that is needed in a CDR.
      type: object
      required:
        - id
        - address
        - city
        - country
        - coordinates
        - evse_uid
        - evse_id
        - connector_id
        - connector_standard
        - connector_format
        - connector_power_type
      properties:
        id:
          type: string
          maxLength: 36
          minLength: 36
        name:
          type: string
          maxLength: 255
        address:
          type: string
          maxLength: 45
        city:
          type: string
          maxLength: 45
        postal_code:
          type: string
          maxLength: 10
        state:
          type: string
          maxLength: 20
        country:
          type: string
          maxLength: 3
        coordinates:
          $ref: '#/components/schemas/GeoLocation'
        evse_uid:
          type: string
          maxLength: 36
          minLength: 36
        evse_id:
          type: string
          maxLength: 48
          minLength: 48
        connector_id:
          type: string
          maxLength: 36
          minLength: 36
        connector_standard:
          $ref: '#/components/schemas/ConnectorType'
        connector_format:
          $ref: '#/components/schemas/ConnectorFormat'
        connector_power_type:
          $ref: '#/components/schemas/PowerType'
    SignedValue:
      description: SignedValue class
      type: object
      required:
        - nature
        - plain_data
        - signed_data
      properties:
        nature:
          type: string
          maxLength: 32
        plain_data:
          type: string
          maxLength: 512
        signed_data:
          type: string
          maxLength: 5000
    SignedData:
      description: SignedData class
      type: object
      required:
        - encoding_method
        - signed_values
      properties:
        encoding_method:
          type: string
          maxLength: 36
        encoding_method_version:
          type: integer
        public_key:
          type: string
          maxLength: 512
        signed_values:
          type: array
          $ref: '#/components/schemas/SignedValue'
        url:
          type: string
          maxLength: 512
    CDR:
      summary: CDR
      description: The CDR object describes the charging session and its costs, how these costs are composed, etc.
      type: object
      required:
        - country_code
        - party_id
        - id
        - start_date_time
        - end_date_time
        - cdr_token
        - auth_method
        - cdr_location
        - currency
        - total_cost
        - total_energy
        - total_time
        - last_updated
      properties:
        country_code:
          $ref: '#/components/schemas/CountryCode'
        party_id:
          $ref: '#/components/schemas/PartyID'
        id:
          type: string
          maxLength: 39
          minLength: 39
        start_date_time:
          type: string
          format: date-time
        end_date_time:
          type: string
          format: date-time
        session_id:
          type: string
          maxLength: 36
          minLength: 36
        cdr_token:
          $ref: '#/components/schemas/CdrToken'
        auth_method:
          $ref: '#/components/schemas/AuthMethod'
        authorization_reference:
          type: string
          maxLength: 36
          minLength: 36
        cdr_location:
          $ref: '#/components/schemas/CdrLocation'
        meter_id:
          type: string
          maxLength: 255
        currency:
          type: string
          maxLength: 3
        tariffs:
          type: array
          items:
            $ref: '#/components/schemas/Tariff'
        charging_periods:
          type: array
          items:
            $ref: '#/components/schemas/ChargingPeriod'
        signed_data:
          $ref: '#/components/schemas/SignedData'
        total_cost:
          $ref: '#/components/schemas/Price'
        total_fixed_cost:
          $ref: '#/components/schemas/Price'
        total_energy:
          type: number
          format: float
        total_energy_cost:
          $ref: '#/components/schemas/Price'
        total_time:
          type: number
          format: float
        total_time_cost:
          $ref: '#/components/schemas/Price'
        total_parking_time:
          type: number
          format: float
        total_parking_cost:
          $ref: '#/components/schemas/Price'
        total_reservation_cost:
          $ref: '#/components/schemas/Price'
        remark:
          type: string
          maxLength: 255
        invoice_reference_id:
          type: string
          maxLength: 39
          minLength: 39
        credit:
          type: boolean
        credit_reference_id:
          type: string
          maxLength: 39
          minLength: 39
        home_charging_compensation:
          type: boolean
        last_updated:
          $ref: '#/components/schemas/DateTime'
    ChargingRateUnit:
      type: string
      enum:
        - W
        - A
    ChargingProfilePeriod:
      type: object
      required:
        - start_period
        - limit
      properties:
        start_period:
          type: integer
        limit:
          $ref: '#/components/schemas/number'
    ChargingProfile:
      type: object
      required:
        - charging_rate_unit
      properties:
        start_date_time:
          $ref: '#/components/schemas/DateTime'
        duration:
          type: integer
        charging_rate_unit:
          $ref: '#/components/schemas/ChargingRateUnit'
        min_charging_rate:
          $ref: '#/components/schemas/number'
        charging_profile_period:
          type: array
          items:
            $ref: '#/components/schemas/ChargingProfilePeriod'
    SetChargingProfile:
      type: object
      required:
        - charging_profile
        - response_url
      properties:
        charging_profile:
          $ref: '#/components/schemas/ChargingProfile'
        response_url:
          $ref: '#/components/schemas/URL'
    ChargingProfileResponseType:
      type: string
      enum:
        - ACCEPTED
        - NOT_SUPPORTED
        - REJECTED
        - TOO_OFTEN
        - UNKNOWN_SESSION
    ChargingProfileResponse:
      type: object
      required:
        - result
        - timeout
      properties:
        result:
          $ref: '#/components/schemas/ChargingProfileResponseType'
          example: ACCEPTED
        timeout:
          type: integer
    ConnectionStatus:
      summary: ConnectionStatus enum
      type: string
      enum:
        - CONNECTED
        - OFFLINE
        - PLANNED
        - SUSPENDED
    ClientInfo:
      type: object
      required:
        - party_id
        - country_code
        - role
        - status
        - last_updated
      properties:
        party_id:
          $ref: '#/components/schemas/PartyID'
        country_code:
          $ref: '#/components/schemas/CountryCode'
        role:
          $ref: '#/components/schemas/Role'
        status:
          $ref: '#/components/schemas/ConnectionStatus'
        last_updated:
          $ref: '#/components/schemas/DateTime'
  parameters:
    collectionDateFrom:
      name: date_from
      in: query
      schema:
        $ref: '#/components/schemas/DateTime'
    collectionDateTo:
      name: date_to
      in: query
      schema:
        $ref: '#/components/schemas/DateTime'
    collectionOffset:
      name: offset
      in: query
      schema:
        type: integer
        example: 0
    collectionLimit:
      name: limit
      in: query
      schema:
        type: integer
        example: 10
    sessionId:
      name: session_id
      in: path
      required: true
      schema:
        type: string
    countryCode:
      name: country_code
      in: path
      required: true
      schema:
        type: string
        maxLength: 2
        example: JP
    partyId:
      name: party_id
      in: path
      required: true
      schema:
        type: string
        maxLength: 3
        example: PLU
    command:
      name: command
      in: path
      required: true
      schema:
        type: string
        enum:
          - CANCEL_RESERVATION
          - RESERVE_NOW
          - START_SESSION
          - STOP_SESSION
          - UNLOCK_CONNECTOR
    uid:
      name: uid
      in: path
      required: true
      schema:
        type: string
    tokenUid:
      name: token_uid
      in: path
      required: true
      schema:
        type: string
    type:
      name: type
      in: query
      schema:
        type: string
    locationId:
      name: location_id
      in: path
      required: true
      schema:
        type: string
        maxLength: 36
        example: LOC1
    evseUid:
      name: evse_uid
      in: path
      required: true
      schema:
        type: string
        maxLength: 36
        example: 3256
    connectorId:
      name: connector_id
      in: path
      required: true
      schema:
        type: string
        maxLength: 36
        example: 1
    cdrId:
      name: cdr_id
      in: path
      required: true
      schema:
        type: string
  headers:
    Link:
      schema:
        type: string
      description: Link to the 'next' page should be provided when this is NOT the last page. The Link should also contain any filters present in the original request. See the examples below.
    X-Total-Count:
      schema:
        type: number
      description: |
        (Custom HTTP Header) The total number of objects available in the server system that match the given query (including the given query parameters, for example: date_to and date_from but excluding limit and offset) and that are available to this client. For example: The CPO server might return less CDR objects to an eMSP than the total number of CDRs available in the CPO system.
    X-Limit:
      schema:
        type: number
      description: |
        (Custom HTTP Header) The maximum number of objects that the server can return. Note that this is an upper limit. If there are not enough remaining objects to return, fewer objects than this upper limit number will be returned, X-Limit SHALL then still show the upper limit, not the number of objects returned.
  responses:
    SessionsResponse:
      description: Success
      headers:
        Link:
          $ref: '#/components/headers/Link'
        X-Total-Count:
          $ref: '#/components/headers/X-Total-Count'
        X-Limit:
          $ref: '#/components/headers/X-Limit'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Session'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BaseResponse'
          example:
            status_code: 401
            status_message: Unauthorized
            timestamp: '2021-01-01T00:00:00Z'
    ChargingPreferencesResponse:
      description: Success
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    type: string
                    enum:
                      - ACCEPTED
                      - DEPARTURE_REQUIRED
                      - ENERGY_NEED_REQUIRED
                      - NOT_POSSIBLE
                      - PROFILE_TYPE_NOT_SUPPORTED
    Problem:
      description: Problem
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Problem'
    SessionResponse:
      description: Success
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/Session'
    CommandResponse:
      description: Success
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/CommandResponse'
    OneTokenResponse:
      description: Tokens GET Response with one Token object.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/Token'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BaseResponse'
          example:
            status_code: 404
            status_message: Not Found
            timestamp: '2021-01-01T00:00:00Z'
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BaseResponse'
          example:
            status_code: 400
            status_message: Bad Request
            timestamp: '2021-01-01T00:00:00Z'
    Versions:
      description: versions
      headers:
        Link:
          $ref: '#/components/headers/Link'
        X-Total-Count:
          $ref: '#/components/headers/X-Total-Count'
        X-Limit:
          $ref: '#/components/headers/X-Limit'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/Versions'
    Version:
      description: Version
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/VersionDetail'
    MethodNotAllowed:
      description: method not allowed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BaseResponse'
          example:
            status_code: 405
            status_message: method not allowed
            timestamp: '2021-01-01T00:00:00Z'
    Accepted:
      description: Accepted
      content:
        application/json:
          schema:
            type: object
          example:
            status_code: 202
            status_message: Accepted
            timestamp: '2021-01-01T00:00:00Z'
    LocationsResponse:
      description: Success
      headers:
        Link:
          $ref: '#/components/headers/Link'
        X-Total-Count:
          $ref: '#/components/headers/X-Total-Count'
        X-Limit:
          $ref: '#/components/headers/X-Limit'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Location'
    Location:
      description: Location
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/Location'
    TariffsResponse:
      description: |
        List of all tariffs.
      headers:
        Link:
          $ref: '#/components/headers/Link'
        X-Total-Count:
          $ref: '#/components/headers/X-Total-Count'
        X-Limit:
          $ref: '#/components/headers/X-Limit'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Tariff'
    CdrsResponse:
      description: CDRs Response.
      headers:
        Link:
          $ref: '#/components/headers/Link'
        X-Total-Count:
          $ref: '#/components/headers/X-Total-Count'
        X-Limit:
          $ref: '#/components/headers/X-Limit'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/CDR'
    CdrResponse:
      description: CDR Response.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/CDR'
    SetChargingProfileResponse:
      description: SetChargingProfileResponse
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/ChargingProfileResponse'
    ClientInfoResponse:
      description: ClientInfo Response
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    $ref: '#/components/schemas/ClientInfo'
    ClientInfosResponse:
      description: List of ClientInfo objects
      headers:
        Link:
          $ref: '#/components/headers/Link'
        X-Total-Count:
          $ref: '#/components/headers/X-Total-Count'
        X-Limit:
          $ref: '#/components/headers/X-Limit'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/BaseResponse'
              - properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ClientInfo'
  requestBodies:
    Session:
      description: Session payload
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Session'
          examples:
            Simple Session example of just starting a session:
              value:
                country_code: NL
                party_id: STK
                id: '101'
                start_date_time: '2020-03-09T10:17:09Z'
                kwh: 0
                cdr_token:
                  uid: 123abc
                  type: RFID
                  contract_id: NL-TST-C12345678-S
                  country_code: NL
                  party_id: STK
                auth_method: WHITELIST
                location_id: LOC1
                evse_uid: '3256'
                connector_id: '1'
                currency: EUR
                total_cost:
                  excl_vat: 2.5
                status: PENDING
                last_updated: '2020-03-09T10:17:09Z'
            Simple Session example of a short finished session:
              value:
                country_code: BE
                party_id: BEC
                id: '101'
                start_date_time: '2015-06-29T22:39:09Z'
                end_date_time: '2015-06-29T23:50:16Z'
                kwh: 41
                cdr_token:
                  uid: 123abc
                  type: RFID
                  contract_id: NL-TST-C12345678-S
                  country_code: NL
                  party_id: STK
                auth_method: WHITELIST
                location_id: LOC1
                evse_uid: '3256'
                connector_id: '1'
                currency: EUR
                charging_periods:
                  - start_date_time: '2015-06-29T22:39:09Z'
                    dimensions:
                      - type: ENERGY
                        volume: 120
                      - type: MAX_CURRENT
                        volume: 30
                  - start_date_time: '2015-06-29T22:40:54Z'
                    dimensions:
                      - type: ENERGY
                        volume: 41000
                      - type: MIN_CURRENT
                        volume: 34
                  - start_date_time: '2015-06-29T23:07:09Z'
                    dimensions:
                      - type: PARKING_TIME
                        volume: 0.718
                    tariff_id: '12'
                total_cost:
                  excl_vat: 8.5
                  incl_vat: 9.35
                status: COMPLETED
                last_updated: '2015-06-29T23:50:17Z'
    SessionPatch:
      description: Session patch payload
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SessionPatch'
          examples:
            'Example: update the total cost':
              value:
                total_cost:
                  excl_vat: 0.6
                  incl_vat: 0.66
                last_updated: '2019-06-23T08:11:00Z'
            'Example: adding a new ChargingPeriod':
              value:
                kwh: 15
                charging_periods:
                  - start_date_time: '2019-06-23T08:16:02Z'
                    dimensions:
                      - type: ENERGY
                        volume: 2200
                total_cost:
                  excl_vat: 0.8
                  incl_vat: 0.88
                last_updated: '2019-06-23T08:16:02Z'
    StartSession:
      description: StartSession payload
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StartSession'
    Token:
      description: Token payload
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Token'
    TokenPatch:
      description: Token patch payload
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TokenPatch'
