{
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "description": "An OAuth 2.0 access token from CloudCharge's token server, taken with the client-credentials grant as the landing page's Authentication section describes, and carrying the `connect` scope.\n\nThe gateway refuses a request before it reaches these endpoints: with 401 when the token is missing, invalid or expired, and with 403 when it lacks the `connect` scope.\n\nEvery endpoint acts for one end user, and a client-credentials token names only the caller. Binding a token to the end user who granted access is not available yet; until it is, these endpoints answer 401 to every token. There will be no user parameter on any endpoint: a user identity sent in a header, path or body is ignored.",
        "scheme": "bearer",
        "type": "http"
      }
    },
    "schemas": {
      "AllowedRange": {
        "properties": {
          "kW": {
            "$ref": "#/components/schemas/KilowattRange"
          }
        },
        "required": [
          "kW"
        ],
        "type": "object"
      },
      "Capabilities": {
        "properties": {
          "setChargeRateLimit": {
            "$ref": "#/components/schemas/SetChargeRateLimit"
          },
          "startCharging": {
            "$ref": "#/components/schemas/Capability"
          },
          "stopCharging": {
            "$ref": "#/components/schemas/Capability"
          }
        },
        "required": [
          "setChargeRateLimit",
          "startCharging",
          "stopCharging"
        ],
        "type": "object"
      },
      "Capability": {
        "properties": {
          "isCapable": {
            "type": "boolean"
          }
        },
        "required": [
          "isCapable"
        ],
        "type": "object"
      },
      "ChargeState": {
        "properties": {
          "chargeRate": {
            "description": "Power being drawn right now, in kW. Always null today: no live power reading is available from our platform.",
            "nullable": true,
            "type": "number"
          },
          "chargeRateLimit": {
            "description": "The configured charge rate limit, in kW. Null when the charger supports no limit, or when its voltage and phase count were never reported and the limit therefore cannot be expressed in kW.",
            "example": 7.36,
            "nullable": true,
            "type": "number"
          },
          "isCharging": {
            "description": "Whether energy is flowing; null when it cannot be determined",
            "nullable": true,
            "type": "boolean"
          },
          "isPluggedIn": {
            "description": "Whether a cable is in the socket; null when it cannot be determined",
            "nullable": true,
            "type": "boolean"
          },
          "lastUpdated": {
            "description": "When this charge state last changed",
            "format": "date-time",
            "nullable": true,
            "type": "string"
          }
        },
        "type": "object"
      },
      "ControlChargingRequest": {
        "properties": {
          "action": {
            "description": "Charging action to perform",
            "enum": [
              "START",
              "STOP"
            ],
            "example": "START",
            "type": "string"
          }
        },
        "required": [
          "action"
        ],
        "type": "object"
      },
      "EnodeCharger": {
        "properties": {
          "capabilities": {
            "$ref": "#/components/schemas/Capabilities"
          },
          "chargeState": {
            "$ref": "#/components/schemas/ChargeState"
          },
          "id": {
            "description": "Charger id",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "type": "string"
          },
          "information": {
            "$ref": "#/components/schemas/Information"
          },
          "isReachable": {
            "description": "Whether live data can be read from the charger right now",
            "type": "boolean"
          },
          "lastSeen": {
            "description": "When the charger last reported in. Null for a charger that has never sent a boot notification.",
            "format": "date-time",
            "nullable": true,
            "type": "string"
          },
          "vendor": {
            "description": "Machine-friendly vendor name",
            "example": "DEFA",
            "type": "string"
          }
        },
        "required": [
          "capabilities",
          "chargeState",
          "id",
          "information",
          "isReachable",
          "vendor"
        ],
        "type": "object"
      },
      "EnodeProblem": {
        "properties": {
          "detail": {
            "example": "The requested asset wasn't found.",
            "type": "string"
          },
          "issues": {
            "items": {
              "$ref": "#/components/schemas/Issue"
            },
            "type": "array"
          },
          "title": {
            "example": "Not Found",
            "type": "string"
          },
          "type": {
            "example": "https://developers.cloudcharge.tech/problems/not-found",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Information": {
        "properties": {
          "brand": {
            "description": "From a fixed vocabulary, not the charger's boot notification.",
            "enum": [
              "DEFA"
            ],
            "example": "DEFA",
            "type": "string"
          },
          "displayName": {
            "description": "The name the owner gave the charger",
            "example": "Example charger",
            "type": "string"
          },
          "model": {
            "description": "From a fixed vocabulary, so a firmware update cannot silently reclassify a charger as a different product.",
            "enum": [
              "DEFA Power"
            ],
            "example": "DEFA Power",
            "type": "string"
          },
          "serialNumber": {
            "description": "Null for a charger whose boot notification never carried one.",
            "example": "01ABC2310",
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "brand",
          "displayName",
          "model"
        ],
        "type": "object"
      },
      "Issue": {
        "properties": {
          "detail": {
            "type": "string"
          },
          "field": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "KilowattRange": {
        "properties": {
          "max": {
            "example": 7.36,
            "type": "number"
          },
          "min": {
            "example": 1.38,
            "type": "number"
          }
        },
        "required": [
          "max",
          "min"
        ],
        "type": "object"
      },
      "SetChargeRateLimit": {
        "properties": {
          "allowedRange": {
            "$ref": "#/components/schemas/AllowedRange"
          },
          "isCapable": {
            "type": "boolean"
          }
        },
        "required": [
          "isCapable"
        ],
        "type": "object"
      },
      "SetChargeRateLimitRequest": {
        "properties": {
          "chargeRateLimit": {
            "description": "Desired charge rate limit in kilowatts (kW)",
            "example": 5.2,
            "type": "number"
          }
        },
        "required": [
          "chargeRateLimit"
        ],
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Read and control DEFA home chargers on behalf of the end user who granted access.\n\nThis is the **Enode profile** of Cloudcharge Connect: the charger shaped the way Enode's own API shapes it, so an adapter written against them needs as little change as possible. It is one profile of several that may exist; each is versioned on its own, and another integrator's profile may present the same chargers differently.\n\nA null field means the value could not be determined from the charger, not that it is false.",
    "title": "Cloudcharge Connect — Enode profile",
    "version": "v1"
  },
  "openapi": "3.0.1",
  "paths": {
    "/connect/auth/enode/v1/chargers": {
      "get": {
        "operationId": "listChargers",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/EnodeCharger"
                  },
                  "type": "array"
                }
              }
            },
            "description": "The user's chargers"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "Missing or unrecognised credential"
          }
        },
        "summary": "List the chargers this user has granted access to",
        "tags": [
          "Chargers"
        ]
      }
    },
    "/connect/auth/enode/v1/chargers/{chargerId}": {
      "get": {
        "operationId": "getCharger",
        "parameters": [
          {
            "description": "The charger id",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "in": "path",
            "name": "chargerId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeCharger"
                }
              }
            },
            "description": "The charger"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "Missing or unrecognised credential"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "No such charger for this user"
          }
        },
        "summary": "Read one charger",
        "tags": [
          "Chargers"
        ]
      }
    },
    "/connect/auth/enode/v1/chargers/{chargerId}/charge-rate-limit": {
      "post": {
        "description": "The limit is converted to whole amperes and snapped DOWN to the nearest rung the charger supports, so the effective rate may be below the one requested. Refused when the charger supports no limit, when its voltage and phase count were never reported, or when the value falls outside the allowedRange this charger publishes.",
        "operationId": "setChargeRateLimit",
        "parameters": [
          {
            "description": "The charger id",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "in": "path",
            "name": "chargerId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetChargeRateLimitRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "The command was accepted for delivery"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "The limit cannot be applied to this charger"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "Missing or unrecognised credential"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "No such charger for this user"
          }
        },
        "summary": "Set the charge rate limit, in kW",
        "tags": [
          "Chargers"
        ]
      }
    },
    "/connect/auth/enode/v1/chargers/{chargerId}/charging": {
      "post": {
        "description": "Accepted for delivery, not confirmed. The command is published to the charging backend; re-read the charger to see whether it took effect.",
        "operationId": "controlCharging",
        "parameters": [
          {
            "description": "The charger id",
            "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "in": "path",
            "name": "chargerId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlChargingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "The command was accepted for delivery"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "The body could not be read, or names an unknown action"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "Missing or unrecognised credential"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "No such charger for this user"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EnodeProblem"
                }
              }
            },
            "description": "Nothing is plugged in, so charging cannot start"
          }
        },
        "summary": "Start or stop charging",
        "tags": [
          "Chargers"
        ]
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://api-dev.cloudcharge.tech"
    }
  ],
  "tags": [
    {
      "description": "Read DEFA chargers on behalf of the end user who granted access",
      "name": "Chargers"
    }
  ]
}