Skip to main content

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

FieldTypeDescription
rule_idIntUnique rule identifier (read-only)
titleStringHuman-readable rule name shown in admin
entityStringTarget entity type: product, category, blog_post, or blog_category
prompt_idIntID of the prompt this rule applies
fieldStringTarget field path (e.g. product.meta_title)
is_activeBooleanWhether the rule runs when the apply-rule command is invoked
is_onceBooleanSkip entities the rule has already processed
is_overwriteBooleanOverwrite existing non-empty values
store_idsInt[]Store view IDs the rule targets
is_per_storeBooleanGenerate a separate value per store view instead of sharing one across stores
conditions_serializedStringSerialized condition tree describing which entities the rule applies to
override_regexStringOptional regex applied to the AI output before saving
populate_global_inputBooleanPass 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.