# Tags

Tags are a powerful feature that allows you to categorize, organize, and group related rules within the system. This functionality simplifies the process of managing large numbers of rules and provides a streamlined way to retrieve specific subsets of rules using the REST API.

<figure><img src="/files/B1qO4UlbI6QpqEGST68y" alt=""><figcaption></figcaption></figure>

## **Purpose of Tags**

Tags serve as simple, user-defined labels that can be associated with rules. Their primary use cases include:

* Grouping rules by purpose (e.g., `security`, `compliance`, `marketing`)
* Filtering rules for reporting or processing
* Selectively retrieving rules via the REST API

## **Adding Tags to Rules**

When creating or editing a rule, you can attach one or more tags to it.

### **How to Add Tags**

1. Navigate to the rule configuration page of the rule you want to enrich with tags.
2. In the upper left click on "Add Tag"
3. Enter the name of the tag. Tags should be simple strings (e.g., `highpriority`, `beta`, `finance`).
4. Appply the tag.
5. Save the rule.

## **REST API**

## GET /rules/tags/v1

> Get all distinct tags used on any rules

```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"}}},"paths":{"/rules/tags/v1":{"get":{"tags":["PublicAPI"],"summary":"Get all distinct tags used on any rules","operationId":"getTagsV1","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}}}}}}}
```

#### **REST API Endpoint**

## GET /rules/v1

> Get Rules

```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":{"Rule":{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":"integer","format":"int64"},"customerId":{"type":"string","pattern":"^[a-zA-Z0-9]{24}$"},"name":{"type":"string","pattern":"^.{1,100}$"},"description":{"type":"string","pattern":"^[\\s\\S]{0,10000}$"},"ruleState":{"type":"string","enum":["ACTIVE","PAUSE"]},"notification":{"$ref":"#/components/schemas/Notification"},"notificationCases":{"type":"array","items":{"$ref":"#/components/schemas/NotificationCase"}},"match_threshold":{"type":"integer","format":"int32"},"time_between_triggers_seconds":{"type":"integer","format":"int64"},"resetStateWhenMatched":{"type":"boolean"},"condition":{"type":"string","pattern":"^[\\s\\S]{1,10000}$"},"isStreak":{"type":"boolean"},"streakCondition":{"type":"string","pattern":"^[\\s\\S]{0,10000}$"},"isRestrictedToEarlyAdopters":{"type":"boolean"},"isTimeBased":{"type":"boolean"},"timeBasedCron":{"type":"string"},"messageQueueSetting":{"$ref":"#/components/schemas/MessageQueueSetting"},"datasets":{"type":"array","items":{"$ref":"#/components/schemas/Dataset"}},"topicIcon":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,50}$"},"impactIcon":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,50}$"},"templateRuleId":{"type":"string","pattern":"^[a-zA-Z0-9]{24}$"},"tags":{"type":"array","items":{"type":"string"}},"motivationScoreWeighting":{"$ref":"#/components/schemas/MotivationScoreWeighting"},"goalAchievedCondition":{"type":"string","pattern":"^[\\s\\S]{0,10000}$"}},"required":["condition","customerId","name"]},"Notification":{"type":"object","properties":{"actionQualifier":{"type":"object","additionalProperties":{"type":"string","enum":["DISMISS","OPENAPP","STOPDELIVERY","OPENWEB"]}},"texts":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/NotificationTexts"}},"command":{"type":"string","pattern":"^[\\s\\S]{0,10000}$"}}},"NotificationTexts":{"type":"object","properties":{"title":{"type":"string","pattern":"^[\\s\\S]{1,10000}$"},"message":{"type":"string","pattern":"^[\\s\\S]{1,10000}$"},"actions":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/NotificationAction"}}}},"NotificationAction":{"type":"object","properties":{"text":{"type":"string","pattern":"^[\\s\\S]{1,10000}$"},"parameter":{"type":"string","pattern":"^[\\s\\S]{0,10000}$"}}},"NotificationCase":{"type":"object","properties":{"label":{"type":"string","pattern":"^.{0,100}$"},"caseCondition":{"type":"string","pattern":"^[\\s\\S]{1,10000}$"},"notification":{"$ref":"#/components/schemas/Notification"}},"required":["caseCondition"]},"MessageQueueSetting":{"type":"object","properties":{"isOverflowProtectionActive":{"type":"boolean"}}},"Dataset":{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,100}$"},"description":{"type":"string","pattern":"^.{0,100}$"},"type":{"type":"string","enum":["SINGLEVALUE","TIMESERIES"]},"source_types":{"type":"array","items":{"type":"string","enum":["APPLIANCE","BATTERY","CAR","CAR_CHARGER","ENERGY_MEASUREMENT","GATEWAY","HEAT_PUMP","INPUT_DEVICE","INVERTER","MOOST","SMART_METER","SMART_PLUG","SWITCH","THERMOSTAT","THERMAL_ZONE","THERMAL_STORAGE","WATER_HEATER","WALL_TABLET","SOLAR_PANEL","DISHWASHER","DRYER","ENTERTAINMENT","LIGHTING","OVEN","REFRIGERATION","WASHING_MACHINE"]}},"event_types":{"type":"array","items":{"type":"string","enum":["CHARGING_MODE","DEVICE_STATUS","ENERGY_CONSUMPTION","ENERGY_CONSUMPTION_LAST_24H","ENERGY_CONSUMPTION_YESTERDAY","ENERGY_EXCESS_LAST_24H","ENERGY_EXCESS_YESTERDAY","ENERGY_GENERATION_LAST_24H","ENERGY_GENERATION_YESTERDAY","ENERGY_IMPORT","ENERGY_IMPORT_YESTERDAY","ENERGY_EXPORT","ENERGY_EXPORT_YESTERDAY","EXPECTED_OUTSIDE_TEMPERATURE","EXPECTED_OUTSIDE_TEMPERATURE_4DAYS","GRID_POWER_CONSUMPTION","GRID_POWER_CONSUMPTION_ANOMALY_SCORE","IS_LOW_TARIFF_HOURS","POWER_CONSUMPTION","POWER_CONSUMPTION_FORECAST_1H","POWER_CONSUMPTION_FORECAST_24H","POWER_EXCESS","POWER_GENERATION","POWER_GENERATION_FORECAST_1H","POWER_GENERATION_FORECAST_1H_MIN","POWER_GENERATION_FORECAST_24H","POWER_GENERATION_FORECAST_48H","POWER_GENERATION_FORECAST_DAY_AFTER_TOMORROW","POWER_GENERATION_FORECAST_TOMORROW","SELF_CONSUMPTION_RATE","SELF_CONSUMPTION_RATE_YESTERDAY","SELF_SUFFICIENCY_RATE","SELF_SUFFICIENCY_RATE_YESTERDAY","STATE_OF_CHARGE_FORECAST_RATE","STATE_OF_CHARGE_RATE","SWITCH_STATE","TEMPERATURE","WATER_TEMPERATURE","POWER_CONSUMPTION_BASE_LOAD","DYNAMIC_TARIFF_PRICE","DYNAMIC_TARIFF_PRICE_FORECAST_1H","DYNAMIC_TARIFF_LOWEST_PRICE_FORECAST_TOMORROW","IS_HIGH_TARIFF_HOURS","ENERGY_EXCESS","ENERGY_BASE_CONSUMPTION","ENERGY_CONSUMPTION_FORECAST_1H","ENERGY_CONSUMPTION_FORECAST_24H","ENERGY_GENERATION","ENERGY_GENERATION_FORECAST_1H","ENERGY_GENERATION_FORECAST_24H","GRID_ENERGY_CONSUMPTION","GRID_ENERGY_CONSUMPTION_YESTERDAY","GRID_ENERGY_CONSUMPTION_ANOMALY_SCORE","GRID_ENERGY_BASE_CONSUMPTION","ENERGY_GENERATION_FORECAST_DAY_AFTER_TOMORROW","ENERGY_GENERATION_FORECAST_TOMORROW","GLOBAL_HORIZONTAL_IRRADIATION_FORECAST_TOMORROW_HOURLY","GLOBAL_HORIZONTAL_IRRADIATION_FORECAST_TOMORROW","ENERGY_CONSUMPTION_FORECAST_TOMORROW","ENERGY_CONSUMPTION_FORECAST_DAY_AFTER_TOMORROW","GRID_BASE_LOAD_CONSUMPTION","DYNAMIC_TARIFF_PRICE_FORECAST_24H","GRID_POWER_CONSUMPTION_YESTERDAY"]}},"timeframe":{"type":"integer","format":"int64"}},"required":["event_types","name","source_types","timeframe","type"]},"MotivationScoreWeighting":{"type":"object","properties":{"deliveredEconomical":{"type":"integer","format":"int32","maximum":10,"minimum":-10},"deliveredEcological":{"type":"integer","format":"int32","maximum":10,"minimum":-10},"deliveredAutarky":{"type":"integer","format":"int32","maximum":10,"minimum":-10},"actionEconomical":{"type":"integer","format":"int32","maximum":10,"minimum":-10},"actionEcological":{"type":"integer","format":"int32","maximum":10,"minimum":-10},"actionAutarky":{"type":"integer","format":"int32","maximum":10,"minimum":-10},"expectedSetting":{"type":"array","items":{"type":"number","format":"float"}},"expectedAction":{"type":"string","pattern":"^(DECREASE|INCREASE|CHANGE)$"},"expectedActionEventType":{"type":"string","enum":["CHARGING_MODE","DEVICE_STATUS","ENERGY_CONSUMPTION","ENERGY_CONSUMPTION_LAST_24H","ENERGY_CONSUMPTION_YESTERDAY","ENERGY_EXCESS_LAST_24H","ENERGY_EXCESS_YESTERDAY","ENERGY_GENERATION_LAST_24H","ENERGY_GENERATION_YESTERDAY","ENERGY_IMPORT","ENERGY_IMPORT_YESTERDAY","ENERGY_EXPORT","ENERGY_EXPORT_YESTERDAY","EXPECTED_OUTSIDE_TEMPERATURE","EXPECTED_OUTSIDE_TEMPERATURE_4DAYS","GRID_POWER_CONSUMPTION","GRID_POWER_CONSUMPTION_ANOMALY_SCORE","IS_LOW_TARIFF_HOURS","POWER_CONSUMPTION","POWER_CONSUMPTION_FORECAST_1H","POWER_CONSUMPTION_FORECAST_24H","POWER_EXCESS","POWER_GENERATION","POWER_GENERATION_FORECAST_1H","POWER_GENERATION_FORECAST_1H_MIN","POWER_GENERATION_FORECAST_24H","POWER_GENERATION_FORECAST_48H","POWER_GENERATION_FORECAST_DAY_AFTER_TOMORROW","POWER_GENERATION_FORECAST_TOMORROW","SELF_CONSUMPTION_RATE","SELF_CONSUMPTION_RATE_YESTERDAY","SELF_SUFFICIENCY_RATE","SELF_SUFFICIENCY_RATE_YESTERDAY","STATE_OF_CHARGE_FORECAST_RATE","STATE_OF_CHARGE_RATE","SWITCH_STATE","TEMPERATURE","WATER_TEMPERATURE","POWER_CONSUMPTION_BASE_LOAD","DYNAMIC_TARIFF_PRICE","DYNAMIC_TARIFF_PRICE_FORECAST_1H","DYNAMIC_TARIFF_LOWEST_PRICE_FORECAST_TOMORROW","IS_HIGH_TARIFF_HOURS","ENERGY_EXCESS","ENERGY_BASE_CONSUMPTION","ENERGY_CONSUMPTION_FORECAST_1H","ENERGY_CONSUMPTION_FORECAST_24H","ENERGY_GENERATION","ENERGY_GENERATION_FORECAST_1H","ENERGY_GENERATION_FORECAST_24H","GRID_ENERGY_CONSUMPTION","GRID_ENERGY_CONSUMPTION_YESTERDAY","GRID_ENERGY_CONSUMPTION_ANOMALY_SCORE","GRID_ENERGY_BASE_CONSUMPTION","ENERGY_GENERATION_FORECAST_DAY_AFTER_TOMORROW","ENERGY_GENERATION_FORECAST_TOMORROW","GLOBAL_HORIZONTAL_IRRADIATION_FORECAST_TOMORROW_HOURLY","GLOBAL_HORIZONTAL_IRRADIATION_FORECAST_TOMORROW","ENERGY_CONSUMPTION_FORECAST_TOMORROW","ENERGY_CONSUMPTION_FORECAST_DAY_AFTER_TOMORROW","GRID_BASE_LOAD_CONSUMPTION","DYNAMIC_TARIFF_PRICE_FORECAST_24H","GRID_POWER_CONSUMPTION_YESTERDAY"]},"expectedActionSourceType":{"type":"string","enum":["APPLIANCE","BATTERY","CAR","CAR_CHARGER","ENERGY_MEASUREMENT","GATEWAY","HEAT_PUMP","INPUT_DEVICE","INVERTER","MOOST","SMART_METER","SMART_PLUG","SWITCH","THERMOSTAT","THERMAL_ZONE","THERMAL_STORAGE","WATER_HEATER","WALL_TABLET","SOLAR_PANEL","DISHWASHER","DRYER","ENTERTAINMENT","LIGHTING","OVEN","REFRIGERATION","WASHING_MACHINE"]}},"required":["expectedAction","expectedActionEventType","expectedActionSourceType"]}}},"paths":{"/rules/v1":{"get":{"tags":["PublicAPI"],"summary":"Get Rules","operationId":"getRulesV1","parameters":[{"name":"tags","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Rule"}}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}}}}}}}
```

{% hint style="warning" %}
A comma-separated list can be used to query rules with multiple tags (e.g. security,network). *This would return rules tagged with `security`* ***AND*** *`network`.*
{% endhint %}


---

# 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/platform-manual/rules/rule-configurator/tags.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.
