Electricity Maps Zones API

Lists all available zones with the endpoints accessible for the caller's token, plus a health endpoint reporting API status. Both can be requested without an API key.

OpenAPI Specification

electricitymaps-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Electricity Maps API
  description: >-
    The Electricity Maps API serves electricity grid carbon intensity and power
    production/consumption breakdown data for 200+ zones worldwide, in real time,
    as 24-hour history, and as 24-72 hour forecasts. It is the same data behind the
    live map at app.electricitymap.org. All data endpoints require an API key passed
    in the auth-token header; the zones and health endpoints can be called without
    a key.
  termsOfService: https://www.electricitymaps.com/legal-notice
  contact:
    name: Electricity Maps Support
    url: https://www.electricitymaps.com
  version: '3.0'
servers:
  - url: https://api.electricitymap.org/v3
security:
  - authToken: []
paths:
  /carbon-intensity/latest:
    get:
      operationId: getCarbonIntensityLatest
      tags:
        - Carbon Intensity
      summary: Latest carbon intensity
      description: >-
        Retrieves the last known carbon intensity (in gCO2eq/kWh) of electricity
        consumed in a zone, queryable by zone identifier or by geolocation.
      parameters:
        - $ref: '#/components/parameters/zone'
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lon'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CarbonIntensity'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /carbon-intensity/history:
    get:
      operationId: getCarbonIntensityHistory
      tags:
        - Carbon Intensity
      summary: Carbon intensity history
      description: >-
        Retrieves the last 24 hours of carbon intensity (in gCO2eq/kWh) of
        electricity consumed in a zone, with hourly resolution.
      parameters:
        - $ref: '#/components/parameters/zone'
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lon'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CarbonIntensityHistory'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /carbon-intensity/forecast:
    get:
      operationId: getCarbonIntensityForecast
      tags:
        - Carbon Intensity
        - Forecast
      summary: Carbon intensity forecast
      description: >-
        Retrieves the forecasted carbon intensity (in gCO2eq/kWh) of electricity
        consumed in a zone, up to 24-72 hours ahead depending on plan.
      parameters:
        - $ref: '#/components/parameters/zone'
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lon'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CarbonIntensityForecast'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /power-breakdown/latest:
    get:
      operationId: getPowerBreakdownLatest
      tags:
        - Power Breakdown
      summary: Latest power breakdown
      description: >-
        Retrieves the last known power consumption and production breakdown of a
        zone, representing the physical origin of electricity broken down by
        production type, with import/export flows. Queryable by zone or geolocation.
      parameters:
        - $ref: '#/components/parameters/zone'
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lon'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PowerBreakdown'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /power-breakdown/history:
    get:
      operationId: getPowerBreakdownHistory
      tags:
        - Power Breakdown
      summary: Power breakdown history
      description: >-
        Retrieves the last 24 hours of power consumption and production breakdown
        of a zone, with a resolution of 60 minutes.
      parameters:
        - $ref: '#/components/parameters/zone'
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lon'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PowerBreakdownHistory'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /power-breakdown/forecast:
    get:
      operationId: getPowerBreakdownForecast
      tags:
        - Power Breakdown
        - Forecast
      summary: Power breakdown forecast
      description: >-
        Retrieves the forecasted power production breakdown of a zone, up to 24-72
        hours ahead depending on plan.
      parameters:
        - $ref: '#/components/parameters/zone'
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lon'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PowerBreakdownForecast'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /power-consumption-breakdown/latest:
    get:
      operationId: getPowerConsumptionBreakdownLatest
      tags:
        - Power Consumption
      summary: Latest power consumption breakdown
      description: >-
        Retrieves the last known flow-traced power consumption breakdown of a zone,
        in megawatts per production type, accounting for imports from neighbouring
        zones.
      parameters:
        - $ref: '#/components/parameters/zone'
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lon'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PowerConsumptionBreakdown'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /power-production-breakdown/latest:
    get:
      operationId: getPowerProductionBreakdownLatest
      tags:
        - Power Production
      summary: Latest power production breakdown
      description: >-
        Retrieves the last known physical power production breakdown of a zone, in
        megawatts per production type, before flow tracing.
      parameters:
        - $ref: '#/components/parameters/zone'
        - $ref: '#/components/parameters/lat'
        - $ref: '#/components/parameters/lon'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PowerProductionBreakdown'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /zones:
    get:
      operationId: getZones
      tags:
        - Zones
      summary: List zones
      description: >-
        Returns all available zones and, for an authenticated token, the endpoints
        accessible for each zone. Can be requested without an API key.
      security: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Zones'
  /health:
    get:
      operationId: getHealth
      tags:
        - Health
      summary: API health
      description: >-
        Returns the operational status of the API. Can be requested without an API
        key.
      security: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Health'
components:
  securitySchemes:
    authToken:
      type: apiKey
      in: header
      name: auth-token
      description: API key issued from the Electricity Maps portal, sent in the auth-token header.
  parameters:
    zone:
      name: zone
      in: query
      description: Zone identifier (e.g. DE, FR, GB, US-CAL-CISO). Alternative to lat/lon.
      required: false
      schema:
        type: string
    lat:
      name: lat
      in: query
      description: Latitude of the location to resolve to a zone. Used with lon as an alternative to zone.
      required: false
      schema:
        type: number
        format: float
    lon:
      name: lon
      in: query
      description: Longitude of the location to resolve to a zone. Used with lat as an alternative to zone.
      required: false
      schema:
        type: number
        format: float
  responses:
    Unauthorized:
      description: Missing or invalid auth-token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    CarbonIntensity:
      type: object
      properties:
        zone:
          type: string
          example: DE
        carbonIntensity:
          type: integer
          description: Carbon intensity in gCO2eq/kWh.
          example: 302
        datetime:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        emissionFactorType:
          type: string
          example: lifecycle
        isEstimated:
          type: boolean
        estimationMethod:
          type: string
          nullable: true
    CarbonIntensityHistory:
      type: object
      properties:
        zone:
          type: string
        history:
          type: array
          items:
            $ref: '#/components/schemas/CarbonIntensity'
    CarbonIntensityForecast:
      type: object
      properties:
        zone:
          type: string
        forecast:
          type: array
          items:
            type: object
            properties:
              carbonIntensity:
                type: integer
              datetime:
                type: string
                format: date-time
        updatedAt:
          type: string
          format: date-time
    PowerBreakdown:
      type: object
      properties:
        zone:
          type: string
        datetime:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        powerConsumptionBreakdown:
          $ref: '#/components/schemas/SourceBreakdown'
        powerProductionBreakdown:
          $ref: '#/components/schemas/SourceBreakdown'
        powerImportBreakdown:
          type: object
          additionalProperties:
            type: number
            nullable: true
        powerExportBreakdown:
          type: object
          additionalProperties:
            type: number
            nullable: true
        fossilFreePercentage:
          type: integer
        renewablePercentage:
          type: integer
        powerConsumptionTotal:
          type: number
        powerProductionTotal:
          type: number
        powerImportTotal:
          type: number
        powerExportTotal:
          type: number
        isEstimated:
          type: boolean
        estimationMethod:
          type: string
          nullable: true
    PowerBreakdownHistory:
      type: object
      properties:
        zone:
          type: string
        history:
          type: array
          items:
            $ref: '#/components/schemas/PowerBreakdown'
    PowerBreakdownForecast:
      type: object
      properties:
        zone:
          type: string
        forecast:
          type: array
          items:
            $ref: '#/components/schemas/PowerBreakdown'
        updatedAt:
          type: string
          format: date-time
    PowerConsumptionBreakdown:
      type: object
      properties:
        zone:
          type: string
        datetime:
          type: string
          format: date-time
        powerConsumptionBreakdown:
          $ref: '#/components/schemas/SourceBreakdown'
        powerConsumptionTotal:
          type: number
    PowerProductionBreakdown:
      type: object
      properties:
        zone:
          type: string
        datetime:
          type: string
          format: date-time
        powerProductionBreakdown:
          $ref: '#/components/schemas/SourceBreakdown'
        powerProductionTotal:
          type: number
    SourceBreakdown:
      type: object
      description: Power in MW per production type. Values may be null when unknown.
      properties:
        nuclear:
          type: number
          nullable: true
        geothermal:
          type: number
          nullable: true
        biomass:
          type: number
          nullable: true
        coal:
          type: number
          nullable: true
        wind:
          type: number
          nullable: true
        solar:
          type: number
          nullable: true
        hydro:
          type: number
          nullable: true
        gas:
          type: number
          nullable: true
        oil:
          type: number
          nullable: true
        unknown:
          type: number
          nullable: true
        hydro discharge:
          type: number
          nullable: true
        battery discharge:
          type: number
          nullable: true
    Zones:
      type: object
      additionalProperties:
        type: object
        properties:
          zoneName:
            type: string
          access:
            type: array
            items:
              type: string
      example:
        DE:
          zoneName: Germany
          access:
            - carbon-intensity/latest
            - power-breakdown/latest
    Health:
      type: object
      properties:
        status:
          type: string
          example: ok
        monitors:
          type: object
    Error:
      type: object
      properties:
        message:
          type: string
        status:
          type: string