{
  "openapi": "3.0.1",
  "info": {
    "title": "Carbon Aware Computing - Grid Carbon Intensity",
    "description": "Get the grid carbon intensity of a given computing location. Useful for calculating the carbon emissions of digital services or as a signal to start or stop computing.The data is licensed under the CC0 license (https://creativecommons.org/publicdomain/zero/1.0/)",
    "license": {
      "name": "Software is licensed under MIT license.",
      "url": "http://opensource.org/licenses/MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://intensity.carbon-aware-computing.com"
    }
  ],
  "paths": {
    "/register": {
      "post": {
        "tags": [
          "Usage"
        ],
        "summary": "Register yourself to the Carbon Aware Computing API. A API-Key is send to your mail address. The address is only used to inform you about incompatible changes to this service.",
        "description": "Register yourself to this API.",
        "operationId": "Register",
        "requestBody": {
          "description": "The mail address API-Key ist send",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/registrationData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "400": {
            "description": "failed operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/problemDetails"
                }
              }
            },
            "x-ms-summary": "failed operation"
          },
          "204": {
            "description": "API-Key sent. Operation succeeded",
            "x-ms-summary": "API-Key sent. Operation succeeded"
          }
        },
        "x-ms-visibility": "important"
      }
    },
    "/emissions/current": {
      "get": {
        "tags": [
          "Carbon Intensity"
        ],
        "summary": "Get the current grid carbon intensity for the given location",
        "description": "Get the current grid carbon intensity for a given location. The carbon intensity in gCO2e/kWh is returned",
        "operationId": "GetCurrentGridCarbonIntensity",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "description": "A named locations like 'de' or a cloud region like 'germanywestcentral'. Use the 'locations' endpoint to get the list of supported and available locations",
            "required": true,
            "schema": {
              "type": "string"
            },
            "examples": {
              "Germany": {
                "value": "de"
              },
              "Austria": {
                "value": "at"
              },
              "Azure francecentral": {
                "value": "francecentral"
              },
              "AWS eu-west-3": {
                "value": "eu-west-3"
              },
              "GCP europe-west9": {
                "value": "europe-west9"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Grid carbon intensity is available for this location and provided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/emissionData"
                }
              }
            },
            "x-ms-summary": "Carbon intensity available. Operation succeeded"
          },
          "404": {
            "description": "Forecast is not available for the location. Operation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/problemDetails"
                }
              }
            },
            "x-ms-summary": "Carbon intensity is not available for the location or time window. Operation failed"
          },
          "400": {
            "description": "failed operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/problemDetails"
                }
              }
            },
            "x-ms-summary": "failed operation"
          }
        },
        "security": [
          {
            "apikey": [ ]
          }
        ],
        "x-ms-visibility": "important"
      }
    },
    "/locations": {
      "get": {
        "tags": [
          "Usage"
        ],
        "summary": "Get a list of available locations. Not all locations are active, to avoid unnecessary computing. Send a message to 'a.mirmohammadi@bluehands.de' to activate a location.",
        "description": "Get a list of available locations. Not all locations are active, to avoid unnecessary computing. Send a message to 'a.mirmohammadi@bluehands.de' to activate a location.",
        "operationId": "GetLocations",
        "responses": {
          "200": {
            "description": "Operation succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/availableLocation"
                  }
                }
              }
            },
            "x-ms-summary": "Operation succeeded"
          }
        },
        "x-ms-visibility": "important"
      }
    }
  },
  "components": {
    "schemas": {
      "availableLocation": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "emissionData": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string"
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "value": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "problemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          },
          "extensions": {
            "type": "object",
            "additionalProperties": {
              "type": "object"
            }
          }
        }
      },
      "registrationData": {
        "type": "object",
        "properties": {
          "mailAddress": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "apikey": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header"
      }
    }
  }
}