# Energy Statistics

The energy-statistics endpoints aggregate raw event data into time-bucketed readings for a specific building. Three temporal resolutions are available: hourly, daily, and monthly.

{% hint style="info" %}
The building's local time zone is taken into account for all energy-statistics endpoints. The time window can be up to 1 year.
{% endhint %}

## Hourly Energy Statistics

Returns energy data aggregated on an hourly basis. Use this for intraday charts (e.g. "Today's energy").

## A building’s energy data with hourly readings

> Get energy related data of a building, aggregated on a hourly basis.

```json
{"openapi":"3.0.3","info":{"title":"MOOST Public API","version":"latest"},"servers":[{"url":"https://api.moost.io"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","name":"bearerAuth","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"HourlyEnergyStatistics":{"type":"object","properties":{"startTimestamp":{"type":"integer","format":"int64"},"energyGeneration":{"type":"number","format":"float"},"energyConsumption":{"type":"number","format":"float"},"gridEnergyConsumption":{"type":"number","format":"float"}}}}},"paths":{"/buildings/{customerBuildingId}/energy-statistics/hourly/v1":{"get":{"tags":["PublicAPI"],"summary":"A building’s energy data with hourly readings","description":"Get energy related data of a building, aggregated on a hourly basis.","operationId":"getHourlyEnergyStatistics","parameters":[{"name":"customerBuildingId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9:._-]{1,100}$"}},{"name":"eventTypes","in":"query","description":"Comma-separated set of event types, which defines what data is to be aggregated.\n","required":true,"schema":{"type":"array","items":{"type":"string","enum":["ENERGY_GENERATION","ENERGY_CONSUMPTION","GRID_ENERGY_CONSUMPTION"]}}},{"name":"from","in":"query","description":"The starting date of the time window for selecting event data.\n<br/>\nRemark: The building's local time zone is taken into account.\n","required":true,"schema":{"type":"string","pattern":"[0-9]{4}-[0-9]{2}-[0-9]{2}"}},{"name":"to","in":"query","description":"The final date of the time window for selecting event data.\n<br/>\nRemark: the time window can be up to 1 year.\n","required":true,"schema":{"type":"string","pattern":"[0-9]{4}-[0-9]{2}-[0-9]{2}"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/HourlyEnergyStatistics"}}}}}}}}}}
```

## Daily Energy Statistics

Returns energy data aggregated on a daily basis. Use this for "this month" charts and seasonal analysis.

## A building’s energy data with daily readings

> Get energy related data of a building, aggregated on a daily basis.

```json
{"openapi":"3.0.3","info":{"title":"MOOST Public API","version":"latest"},"servers":[{"url":"https://api.moost.io"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","name":"bearerAuth","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"DailyEnergyStatistics":{"type":"object","properties":{"day":{"type":"string"},"energyGeneration":{"type":"number","format":"float"},"energyConsumption":{"type":"number","format":"float"},"gridEnergyConsumption":{"type":"number","format":"float"},"energyBaseConsumption":{"type":"number","format":"float"},"gridEnergyBaseConsumption":{"type":"number","format":"float"}}}}},"paths":{"/buildings/{customerBuildingId}/energy-statistics/daily/v1":{"get":{"tags":["PublicAPI"],"summary":"A building’s energy data with daily readings","description":"Get energy related data of a building, aggregated on a daily basis.","operationId":"getDailyEnergyStatistics","parameters":[{"name":"customerBuildingId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9:._-]{1,100}$"}},{"name":"eventTypes","in":"query","description":"Comma-separated set of event types, which defines what data is to be aggregated.\n<ul>\n<li>For energy generation use <code>ENERGY_GENERATION_YESTERDAY</code> or <code>ENERGY_GENERATION</code>.</li>\n<li>For energy consumption use <code>ENERGY_CONSUMPTION_YESTERDAY</code> or <code>ENERGY_CONSUMPTION</code>.</li>\n<li>For grid energy consumption use <code>GRID_ENERGY_CONSUMPTION_YESTERDAY</code> or <code>GRID_ENERGY_CONSUMPTION</code>.</li>\n</ul>\n<br/>\nRemark: prefer the <code>*_YESTERDAY</code> event types, i.e. daily resolution data over high resolution data, as it is much faster.\nIf both low and high resolution types have been declared, then this API tries with low resolution, and only if nothing found\ntries with high resolution type.","required":true,"schema":{"type":"array","items":{"type":"string","enum":["ENERGY_GENERATION_YESTERDAY","ENERGY_GENERATION","ENERGY_CONSUMPTION_YESTERDAY","ENERGY_CONSUMPTION","GRID_ENERGY_CONSUMPTION_YESTERDAY","GRID_ENERGY_CONSUMPTION","ENERGY_BASE_CONSUMPTION","GRID_ENERGY_BASE_CONSUMPTION"]}}},{"name":"from","in":"query","description":"The starting date of the time window for selecting event data.\n<br/>\nRemark: The building's local time zone is taken into account.\n","required":true,"schema":{"type":"string","pattern":"[0-9]{4}-[0-9]{2}-[0-9]{2}"}},{"name":"to","in":"query","description":"The final date of the time window for selecting event data.\n<br/>\nRemark: the time window can be up to 1 year.\n","required":true,"schema":{"type":"string","pattern":"[0-9]{4}-[0-9]{2}-[0-9]{2}"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DailyEnergyStatistics"}}}}}}}}}}
```

{% hint style="warning" %}
Prefer the `*_YESTERDAY` event types (daily resolution data) over high-resolution types — they are significantly faster to query. If both low and high resolution types are declared, the API tries daily resolution first and falls back to high resolution only if no data is found.
{% endhint %}

## Monthly Energy Statistics

Returns energy data aggregated on a monthly basis. Use this for yearly overview charts and 12-month trend cards.

## A building’s energy data with monthly readings

> Get energy related data of a building, aggregated on a monthly basis.

```json
{"openapi":"3.0.3","info":{"title":"MOOST Public API","version":"latest"},"servers":[{"url":"https://api.moost.io"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","name":"bearerAuth","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"MonthlyEnergyStatistics":{"type":"object","properties":{"month":{"type":"string"},"energyGeneration":{"type":"number","format":"float"},"energyConsumption":{"type":"number","format":"float"},"gridEnergyConsumption":{"type":"number","format":"float"}}}}},"paths":{"/buildings/{customerBuildingId}/energy-statistics/monthly/v1":{"get":{"tags":["PublicAPI"],"summary":"A building’s energy data with monthly readings","description":"Get energy related data of a building, aggregated on a monthly basis.","operationId":"getMonthlyEnergyStatistics","parameters":[{"name":"customerBuildingId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9:._-]{1,100}$"}},{"name":"eventTypes","in":"query","description":"Comma-separated set of event types, which defines what data is to be aggregated.\n<ul>\n<li>For energy generation use <code>ENERGY_GENERATION_YESTERDAY</code> or <code>ENERGY_GENERATION</code>.</li>\n<li>For energy consumption use <code>ENERGY_CONSUMPTION_YESTERDAY</code> or <code>ENERGY_CONSUMPTION</code>.</li>\n<li>For grid energy consumption use <code>GRID_ENERGY_CONSUMPTION_YESTERDAY</code> or <code>GRID_ENERGY_CONSUMPTION</code>.</li>\n</ul>\nRemark: prefer the <code>*_YESTERDAY</code> event types, i.e. daily resolution data over high resolution data, as it is much faster.\nIf both low and high resolution types have been declared, then this API tries with low resolution, and only if nothing found\ntries with high resolution type.","required":true,"schema":{"type":"array","items":{"type":"string","enum":["ENERGY_GENERATION_YESTERDAY","ENERGY_GENERATION","ENERGY_CONSUMPTION_YESTERDAY","ENERGY_CONSUMPTION","GRID_ENERGY_CONSUMPTION_YESTERDAY","GRID_ENERGY_CONSUMPTION"]}}},{"name":"from","in":"query","description":"The starting month of the time window for selecting event data.\n<br/>\nRemark: The building's local time zone is taken into account.\n","required":true,"schema":{"type":"string","pattern":"[0-9]{4}-[0-9]{2}"}},{"name":"to","in":"query","description":"The final month of the time window for selecting event data.\n<br/>\nRemark: the time window can be up to 1 year.\n","required":true,"schema":{"type":"string","pattern":"[0-9]{4}-[0-9]{2}"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MonthlyEnergyStatistics"}}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.moost.io/technical-integration/cloud-to-cloud-integration/intelligence-service-integration/energy-statistics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
