Automation rules API
Manage automation rules — bulk content generation jobs that apply a prompt to a set of entities matching declared conditions. All endpoints require authentication.
Rule object
| Field | Type | Description |
|---|---|---|
rule_id | Int | Unique rule identifier (read-only) |
title | String | Human-readable rule name shown in admin |
entity | String | Target entity type: product, category, blog_post, or blog_category |
prompt_id | Int | ID of the prompt this rule applies |
field | String | Target field path (e.g. product.meta_title) |
is_active | Boolean | Whether the rule runs when the apply-rule command is invoked |
is_once | Boolean | Skip entities the rule has already processed |
is_overwrite | Boolean | Overwrite existing non-empty values |
store_ids | Int[] | Store view IDs the rule targets |
is_per_store | Boolean | Generate a separate value per store view instead of sharing one across stores |
conditions_serialized | String | Serialized condition tree describing which entities the rule applies to |
override_regex | String | Optional regex applied to the AI output before saving |
populate_global_input | Boolean | Pass the current field value to the prompt as {{ global.input }} |
Get rule
GET /rest/V1/assistant/rule/:ruleId
Response: the rule object.
Errors: 404 rule not found.
List rules
GET /rest/V1/assistant/rules
Supports filtering and pagination.
Response:
{
"items": [ { ... } ],
"search_criteria": { "filter_groups": [], "page_size": 20, "current_page": 1 },
"total_count": 3
}
Create rule
POST /rest/V1/assistant/rule
Request body:
{
"rule": {
"title": "Generate meta titles",
"entity": "product",
"prompt_id": 1,
"field": "product.meta_title",
"is_active": true,
"is_once": true,
"is_overwrite": false,
"store_ids": [1]
}
}
title, entity, prompt_id, and field are required.
Response: the created rule object with rule_id assigned.
Update rule
PUT /rest/V1/assistant/rule/:ruleId
Request body: same structure as Create rule. Include only the fields you want to change — see partial updates.
Response: the updated rule object.
Errors: 404 rule not found.
Delete rule
DELETE /rest/V1/assistant/rule/:ruleId
Response:
true
Errors: 404 rule not found.
Running a rule
Rules are executed via the mirasvit:assistant:apply-rule CLI command, not through the REST API. Once a rule is created or updated, run it from the shell:
bin/magento mirasvit:assistant:apply-rule --id <rule_id> --limit 100
Progress and per-entity outcomes are written to the logs and history tables, which you can poll via REST.