openapi: 3.0.3
paths:
  /rest/v1/ping:
    get:
      operationId: PingController_ping
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PingDTO'
      tags:
        - ping
  /rest/v1/sites/{id}:
    get:
      operationId: SiteController_getSiteById
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the site for which to retrieve site data
          schema:
            type: string
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Site'
      tags:
        - sites
  /rest/v1/sites:
    get:
      operationId: SiteController_getSites
      parameters:
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Site'
      tags:
        - sites
  /rest/v1/ocpp-logs/site/{id}:
    get:
      operationId: OCPPLogsController_getSiteOcppLogs
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the site for which to retrieve OCPP logs
          schema:
            type: string
        - name: from
          required: true
          in: query
          description: Start date/time for the log query (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: to
          required: true
          in: query
          description: End date/time for the log query (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: actions
          required: false
          in: query
          description: Comma-separated list of OCPP log actions to filter by
          schema:
            type: string
        - name: sort_order
          required: false
          in: query
          description: Sort order for the results
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: take
          required: false
          in: query
          description: Number of records to retrieve (max 1000)
          schema:
            type: number
        - name: skip
          required: false
          in: query
          description: Number of records to skip for pagination
          schema:
            type: number
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OCPPLogsResponse'
      tags:
        - ocpp-logs
  /rest/v1/charging-events/site/{id}:
    get:
      operationId: ChargingEventsController_getSiteChargingEvents
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the site for which to retrieve charging events
          schema:
            type: string
        - name: from
          required: true
          in: query
          description: Start date/time for the charging events query (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: to
          required: true
          in: query
          description: End date/time for the charging events query (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: search_text
          required: false
          in: query
          description: Text to search for in the charging events data
          schema:
            type: string
        - name: sort_field
          required: false
          in: query
          description: Field to sort the results by
          schema:
            enum:
              - occurrence_time
              - rfid
              - rfid_name
              - energy_consumed
              - duration
              - cost
              - optimized_cost
              - cost_savings
            type: string
        - name: sort_order
          required: false
          in: query
          description: Sort order for the results
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: take
          required: false
          in: query
          description: Number of records to retrieve (max 1000)
          schema:
            type: number
        - name: skip
          required: false
          in: query
          description: Number of records to skip for pagination
          schema:
            type: number
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ChargingEvent'
      tags:
        - charging-events
  /rest/v1/live/site/{id}/charging-points:
    get:
      operationId: LiveController_getChargingPoints
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the site for which to retrieve charging points
          schema:
            type: string
        - name: search_text
          required: false
          in: query
          description: Text to search for in the charging points data
          schema:
            type: string
        - name: sort_field
          required: false
          in: query
          description: Field to sort the results by
          schema:
            enum:
              - name
              - status
              - rfid_name
              - charging_power
              - session_energy_consumed
              - state_of_charge
              - plug_in_time
            type: string
        - name: sort_order
          required: false
          in: query
          description: Sort order for the results
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: take
          required: false
          in: query
          description: Number of records to retrieve (max 1000)
          schema:
            type: number
        - name: skip
          required: false
          in: query
          description: Number of records to skip for pagination
          schema:
            type: number
        - name: only_currently_plugged_in
          required: false
          in: query
          description: Filter to only include currently plugged-in charging points
          schema:
            type: boolean
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChargingPoints'
      tags:
        - live
  /rest/v1/live/site/{id}/power-and-limits:
    get:
      operationId: LiveController_getSitePowerAndLimits
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the site for which to retrieve power and limits
          schema:
            type: string
        - name: from
          required: true
          in: query
          description: Start of the time range for the data (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: to
          required: true
          in: query
          description: End of the time range for the data (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: fuse
          required: false
          in: query
          description: >-
            Optional fuse id to filter the power and limits data for a specific
            fuse within the site
          schema:
            type: number
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SitePowerAndLimits'
      tags:
        - live
  /rest/v1/live/site/{id}/fleet-and-total:
    get:
      operationId: LiveController_getSiteFleetAndTotal
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the site for which to retrieve fleet and total power
          schema:
            type: string
        - name: from
          required: true
          in: query
          description: Start of the time range for the data (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: to
          required: true
          in: query
          description: >-
            End of the time range for the data (ISO 8601 format), at most 31
            days after from
          schema:
            format: date-time
            type: string
        - name: interval
          required: true
          in: query
          description: Length of each bucket
          schema:
            enum:
              - 5min
              - 15min
            type: string
        - name: fuse
          required: false
          in: query
          description: >-
            Optional fuse id to retrieve the data for a specific fuse within the
            site (defaults to the main fuse, 0)
          schema:
            type: number
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SiteFleetAndTotal'
      tags:
        - live
  /rest/v1/error-events/site/{id}:
    get:
      operationId: ErrorEventsController_getSiteErrorEvents
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the site for which to retrieve error events
          schema:
            type: string
        - name: start_date
          required: true
          in: query
          description: Start date/time for the error events query (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: end_date
          required: true
          in: query
          description: End date/time for the error events query (ISO 8601 format)
          schema:
            format: date-time
            type: string
        - name: search_text
          required: false
          in: query
          description: Text to search for in the error events data
          schema:
            type: string
        - name: sort_field
          required: false
          in: query
          description: Field to sort the results by
          schema:
            enum:
              - error_status
              - device_id
              - charging_point_name
              - error_message
              - error_date
              - case_type
              - site_name
              - automatic_recovery_status
            type: string
        - name: sort_order
          required: false
          in: query
          description: Sort order for the results (defaults to `desc`)
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: take
          required: false
          in: query
          description: Number of records to retrieve (max 200)
          schema:
            type: number
        - name: skip
          required: false
          in: query
          description: Number of records to skip for pagination
          schema:
            type: number
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEvents'
      tags:
        - error-events
  /rest/v1/error-events/site/{id}/{event_id}:
    get:
      operationId: ErrorEventsController_getSiteErrorEvent
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the site the error event belongs to
          schema:
            type: string
        - name: event_id
          required: true
          in: path
          description: >-
            The ID of the error event, as returned in `event_id` by the error
            events list
          schema:
            type: string
        - name: x-api-key
          in: header
          description: API key for authentication
          required: true
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEventDetail'
        '404':
          description: Error event not found
      tags:
        - error-events
  /rest/v1/scopes:
    get:
      operationId: ScopesController_scopes
      parameters:
        - name: x-api-key
          required: true
          in: header
          description: API key for authentication
          schema:
            type: string
        - name: x-signature
          in: header
          description: HMAC signature for request authentication
          required: true
          schema:
            type: string
        - name: x-req-timestamp
          in: header
          description: Request timestamp for signature validation (Unix timestamp)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScopesDTO'
      tags:
        - scopes
info:
  title: ChargePilot API
  description: ''
  version: 1.10.5
  contact: {}
tags: []
servers:
  - url: https://chargepilot-api.tmhusa.energy
components:
  schemas:
    PingDTO:
      type: object
      properties:
        result:
          type: string
      required:
        - result
    LocalController:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        serial_no:
          type: string
        device_id:
          type: string
      required:
        - id
        - name
        - serial_no
        - device_id
    Meter:
      type: object
      properties:
        primary_transformer_ratio:
          type: number
          nullable: true
        secondary_transformer_ratio:
          type: number
          nullable: true
        is_producer:
          type: boolean
          nullable: true
        producer_name:
          type: string
          nullable: true
        producer_current:
          type: number
          nullable: true
        consumer_name:
          type: string
          nullable: true
        max_possible_current:
          type: number
          nullable: true
        is_consumer:
          type: boolean
          nullable: true
        fallback_value:
          type: number
          nullable: true
    Connector:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        connector_id:
          type: string
        priority:
          type: number
        charging_capability:
          type: array
          items:
            type: number
        discharge_capability:
          type: array
          items:
            type: number
        charging_station_id:
          type: string
      required:
        - id
        - name
        - connector_id
        - priority
        - charging_capability
        - discharge_capability
        - charging_station_id
    TreeParameters:
      type: object
      properties:
        limit:
          type: number
        inbound_limit:
          type: number
        outbound_limit:
          type: number
        fallback:
          type: number
        meter:
          $ref: '#/components/schemas/Meter'
        name:
          type: string
        order:
          type: number
        depth:
          type: string
        additional_comments:
          type: string
        pending_fallback_value:
          type: number
        fallback_status:
          enum:
            - pending
            - active
            - rejected
          type: string
        fuse_id:
          type: string
        firmware_version:
          type: string
        connectors:
          type: array
          items:
            $ref: '#/components/schemas/Connector'
    FuseTree:
      type: object
      properties:
        type:
          type: string
        parameters:
          $ref: '#/components/schemas/TreeParameters'
        children:
          type: array
          items:
            $ref: '#/components/schemas/FuseTree'
      required:
        - type
        - parameters
    Site:
      type: object
      properties:
        id:
          type: string
        timezone:
          type: string
        name:
          type: string
        local_controller:
          $ref: '#/components/schemas/LocalController'
        fuse_tree:
          type: array
          items:
            $ref: '#/components/schemas/FuseTree'
      required:
        - id
        - timezone
        - name
        - local_controller
        - fuse_tree
    ChargingSchedulePeriod:
      type: object
      properties:
        start_period:
          type: number
        limit:
          type: number
        number_phases:
          type: number
    OCPPLog:
      type: object
      properties:
        occurrence_time:
          format: date-time
          type: string
        payload:
          type: object
        action:
          enum:
            - Authorize
            - BootNotification
            - CancelReservation
            - CertificateSigned
            - ChangeAvailability
            - ChangeConfiguration
            - ClearCache
            - ClearChargingProfile
            - DataTransfer
            - DeleteCertificate
            - DiagnosticsStatusNotification
            - ExtendedTriggerMessage
            - FirmwareStatusNotification
            - GetCompositeSchedule
            - GetConfiguration
            - GetDiagnostics
            - GetInstalledCertificateIds
            - GetLocalListVersion
            - GetLog
            - Heartbeat
            - InstallCertificate
            - LogStatusNotification
            - MeterValues
            - RemoteStartTransaction
            - RemoteStopTransaction
            - ReserveNow
            - Reset
            - SecurityEventNotification
            - SendLocalList
            - SetChargingProfile
            - SignCertificate
            - SignedFirmwareStatusNotification
            - SignedUpdateFirmware
            - StartTransaction
            - StatusNotification
            - StopTransaction
            - TriggerMessage
            - UnlockConnector
            - UpdateFirmware
          type: string
        site_id:
          type: string
        site_name:
          type: string
        charger_id:
          type: string
        connector_id:
          type: number
        request_timestamp:
          type: string
        request_info:
          type: string
        request_status:
          type: string
        request_reason:
          type: string
        request_id_tag:
          type: string
        request_transaction_id:
          type: number
        request_vendor_id:
          type: string
        request_error_code:
          type: string
        request_vendor_error_code:
          type: string
        request_meter_stop:
          type: string
        req_cs_profile_sched_charging_rate_unit:
          type: string
        req_cs_profile_sched_duration:
          type: number
        req_cs_profile_sched_start_schedule:
          format: date-time
          type: string
        req_cs_profile_sched_min_charging_rate:
          type: number
        req_cs_profile_sched_schedule_period:
          type: array
          items:
            $ref: '#/components/schemas/ChargingSchedulePeriod'
        response_id_tag_info_status:
          type: string
        extracted_voltage_phase1:
          type: number
        extracted_voltage_phase2:
          type: number
        extracted_voltage_phase3:
          type: number
        extracted_voltage:
          type: number
        extracted_current_phase1:
          type: number
        extracted_current_phase2:
          type: number
        extracted_current_phase3:
          type: number
        extracted_current:
          type: number
        extracted_power_phase1:
          type: number
        extracted_power_phase2:
          type: number
        extracted_power_phase3:
          type: number
        extracted_power:
          type: number
        extracted_state_of_charge:
          type: number
      required:
        - occurrence_time
        - payload
        - action
        - site_id
        - charger_id
    OCPPLogsResponse:
      type: object
      properties:
        ocpp_logs:
          type: array
          items:
            $ref: '#/components/schemas/OCPPLog'
        count:
          type: number
      required:
        - ocpp_logs
        - count
    ChargingEvent:
      type: object
      properties:
        SiteName:
          type: string
          nullable: true
        ChargerType:
          type: string
          nullable: true
        TransactionID:
          type: number
        ChargerID:
          type: string
        ConnectorID:
          type: number
        StartAt:
          type: string
        EndAt:
          type: string
        InitialSoC:
          type: number
          nullable: true
        BusID:
          type: string
          nullable: true
        Identifier:
          type: string
          nullable: true
          description: >-
            ID tag the charger reported when the session started, as received
            (RFID UID, vehicle MAC address for autocharge, or an EMAID). Not
            normalised; may contain separators.
        EndSoC:
          type: number
          nullable: true
        EnergyDelivered:
          type: number
          nullable: true
      required:
        - SiteName
        - ChargerType
        - TransactionID
        - ChargerID
        - ConnectorID
        - StartAt
        - EndAt
        - InitialSoC
        - BusID
        - Identifier
        - EndSoC
        - EnergyDelivered
    ChargingPoint:
      type: object
      properties:
        id:
          type: number
        uuid:
          type: string
        status:
          enum:
            - error
            - unknown
            - available
            - charging
            - finishing
            - offline
            - paused_ev
            - paused_lm
            - preparing
            - unavailable
          type: string
        name:
          type: string
        prioritized:
          type: boolean
        ocpp_error:
          type: object
          properties:
            code:
              type: string
            vendor_code:
              type: string
              nullable: true
          required:
            - code
            - vendor_code
        charger_id:
          type: string
        device_id:
          type: string
        rfid:
          type: string
        rfid_name:
          type: string
        rfid_time:
          format: date-time
          type: string
        charging_power:
          type: number
        current_type:
          enum:
            - AC
            - DC
          type: string
        inbound_power_limit:
          type: number
        session_energy_consumed:
          type: number
        state_of_charge:
          type: number
        state_of_charge_time:
          format: date-time
          type: string
        plug_in_time:
          format: date-time
          type: string
        target_soc:
          type: number
      required:
        - id
        - uuid
        - status
        - name
        - prioritized
        - charger_id
        - device_id
    ChargingPoints:
      type: object
      properties:
        charging_points:
          type: array
          items:
            $ref: '#/components/schemas/ChargingPoint'
        count:
          type: number
      required:
        - charging_points
        - count
    SitePowerAndLimits:
      type: object
      properties:
        chunk_start:
          format: date-time
          type: string
        total_current_phase1:
          type: number
        total_current_phase2:
          type: number
        total_current_phase3:
          type: number
        total_power:
          type: number
        fleet_current_phase1:
          type: number
        fleet_current_phase2:
          type: number
        fleet_current_phase3:
          type: number
        fleet_power:
          type: number
        power_factor_phase1:
          type: number
        power_factor_phase2:
          type: number
        power_factor_phase3:
          type: number
        inbound_opt_current_limit_phase1:
          type: number
        inbound_opt_current_limit_phase2:
          type: number
        inbound_opt_current_limit_phase3:
          type: number
        inbound_current_limit:
          type: number
        inbound_power_limit:
          type: number
        overridden_inbound_current_limit:
          type: number
        overridden_inbound_power_limit:
          type: number
      required:
        - chunk_start
        - total_current_phase1
        - total_current_phase2
        - total_current_phase3
        - total_power
        - fleet_current_phase1
        - fleet_current_phase2
        - fleet_current_phase3
        - fleet_power
        - inbound_opt_current_limit_phase1
        - inbound_opt_current_limit_phase2
        - inbound_opt_current_limit_phase3
        - inbound_current_limit
    SiteFleetAndTotal:
      type: object
      properties:
        bucket_start:
          format: date-time
          type: string
        avg_fleet_power:
          type: number
        avg_fleet_current_phase1:
          type: number
        avg_fleet_current_phase2:
          type: number
        avg_fleet_current_phase3:
          type: number
        avg_total_power:
          type: number
        avg_total_current_phase1:
          type: number
        avg_total_current_phase2:
          type: number
        avg_total_current_phase3:
          type: number
        max_inbound_current_limit:
          type: number
        max_overridden_inbound_current_limit:
          type: number
      required:
        - bucket_start
    ErrorEvent:
      type: object
      properties:
        event_id:
          type: string
        error_status:
          enum:
            - active
            - recovered
          type: string
        device_id:
          type: string
          nullable: true
        charging_point_name:
          type: string
          nullable: true
        error_message:
          type: string
        error_date:
          type: string
          format: date-time
        automatic_recovery_status:
          nullable: true
          enum:
            - initiated
            - not_initiated
          type: string
        site_name:
          type: string
          nullable: true
        case_type:
          enum:
            - controller_error
            - charger_error
            - connector_error
          type: string
      required:
        - event_id
        - error_status
        - device_id
        - charging_point_name
        - error_message
        - error_date
        - automatic_recovery_status
        - site_name
        - case_type
    ErrorEvents:
      type: object
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/ErrorEvent'
        records_count:
          type: number
      required:
        - events
        - records_count
    ErrorEventDetail:
      type: object
      properties:
        site_name:
          type: string
          nullable: true
        controller_id:
          type: string
        charger_id:
          type: string
          nullable: true
        charging_point_name:
          type: string
          nullable: true
        error_status:
          enum:
            - active
            - recovered
          type: string
        error_message:
          type: string
        error_occurred:
          type: string
          format: date-time
        error_resolved:
          type: string
          nullable: true
          format: date-time
        automatic_recovery_status:
          nullable: true
          enum:
            - initiated
            - not_initiated
          type: string
        automatic_recovery_time:
          type: string
          nullable: true
          format: date-time
        case_type:
          enum:
            - controller_error
            - charger_error
            - connector_error
          type: string
        vendor_error_code:
          type: string
          nullable: true
        vendor_info:
          type: string
          nullable: true
      required:
        - site_name
        - controller_id
        - charger_id
        - charging_point_name
        - error_status
        - error_message
        - error_occurred
        - error_resolved
        - automatic_recovery_status
        - automatic_recovery_time
        - case_type
        - vendor_error_code
        - vendor_info
    ScopeDTO:
      type: object
      properties:
        scope:
          type: string
        paths:
          type: array
          items:
            type: string
      required:
        - scope
        - paths
    ScopesDTO:
      type: object
      properties:
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/ScopeDTO'
      required:
        - scopes
