Skip to main content

REST API

AI Assistant exposes a REST API that lets you manage prompts, automation rules, and system messages — and render prompts against live entities — without going through the Magento admin UI.

This is useful when you want to:

  • Import or synchronize prompts and rules from an external configuration store.
  • Trigger prompt rendering programmatically (e.g. from a custom workflow or another AI agent).
  • Audit automation activity by pulling log and history records.
  • Manage AI Assistant configuration via CI/CD pipelines or scripts.

Base URL

All endpoints follow Magento's standard REST API pattern:

https://<your-store-domain>/rest/<store-code>/V1/assistant/

For the default store view use default as the store code, or omit it entirely to target the global scope:

https://<your-store-domain>/rest/V1/assistant/

Authentication

All AI Assistant API endpoints require an admin Bearer token. Obtain one by calling:

POST /rest/V1/integration/admin/token

Request body:

{
"username": "admin",
"password": "your-admin-password"
}

Response:

"abc123xyz..."

Include the token in every subsequent request:

Authorization: Bearer abc123xyz...

Access control

Each endpoint group is gated by a matching admin ACL resource. Assign these to admin roles under System → Permissions → User Roles to limit who can call which endpoints:

AreaResourceEndpoints
PromptsMirasvit_Assistant::assistant_prompt/V1/assistant/prompts, /V1/assistant/prompt/...
Automation rulesMirasvit_Assistant::assistant_rule/V1/assistant/rules, /V1/assistant/rule/...
System messagesMirasvit_Assistant::assistant_system_message/V1/assistant/system-messages, /V1/assistant/system-message/...
LogsMirasvit_Assistant::assistant_log/V1/assistant/logs, /V1/assistant/log/...
HistoryMirasvit_Assistant::assistant_history/V1/assistant/history

Filtering and pagination

All list endpoints accept Magento's standard searchCriteria query parameters.

Example — fetch active prompts, newest first, page 1, 10 per page:

GET /rest/V1/assistant/prompts
?searchCriteria[filter_groups][0][filters][0][field]=is_active
&searchCriteria[filter_groups][0][filters][0][value]=1
&searchCriteria[filter_groups][0][filters][0][condition_type]=eq
&searchCriteria[sort_orders][0][field]=position
&searchCriteria[sort_orders][0][direction]=ASC
&searchCriteria[currentPage]=1
&searchCriteria[pageSize]=10

List response envelope:

{
"items": [ ... ],
"search_criteria": { ... },
"total_count": 42
}

Partial updates

PUT endpoints accept partial payloads — include only the fields you want to change. Omitted fields keep their existing values. The full set of fields for each entity is documented in the entity pages below.

Endpoints

  • Prompts — CRUD operations for prompts plus a render endpoint
  • Automation rules — CRUD operations for automation rules
  • System messages — CRUD operations for reusable system messages
  • Logs and history — read-only access to apply-rule logs and content-change history