Execution history and audit

GET /api/v1/rules/:id/executions. Timeline of fires with evaluated / matched / acted / skipped / errored counts + per-entity details + metric snapshots.

Written By Salvatore Sinigaglia

Last updated About 5 hours ago

GET /api/v1/rules/:id/executions. Timeline of fires with evaluated / matched / acted / skipped / errored counts + per-entity details + metric snapshots.

Execution history and audit

/rules/:id. Backed by GET /api/v1/rules/:id/executions (verified, paginated). Every cron fire that matched at least one entity writes to the automation_rule_execution table with full per-entity outcomes. Rule lifecycle audit entries (rule.create / rule.delete / rule.toggle / rule.duplicate, dot-notation) live separately in the audit log. Use both to answer "what did this rule do and when?".

Who is this for

Rule owners auditing what rules actually did. Anyone debugging "why did this campaign get paused yesterday?". Admins on compliance reviews.

How to view

Per-rule execution timeline

  1. Open /rules/:id
  2. Scroll to Executions section
  3. Timeline shows fires in reverse-chronological order
  4. Click a fire β†’ expanded view per entity

Per-rule audit log

Same page β†’ Audit tab. Shows lifecycle entries: who created / edited / paused / duplicated the rule and when.

What's in an execution record

automation_rule_execution schema fields:

  • id
  • rule_id
  • status β€” one of evaluated / executed / skipped / error
  • entities_evaluated β€” total scanned
  • entities_matched β€” passed all conditions
  • entities_acted β€” action successfully applied
  • entities_skipped β€” matched but skipped by a protection
  • entities_errored β€” execution failed (API error / validation)
  • details (JSON) β€” per-entity result map
  • error_message β€” top-level failure (e.g. SQS timeout)
  • started_at, completed_at, duration_ms
  • metrics_snapshot (JSON) β€” the metric values used for evaluation

Reading the details

For each entity in details:

{  "entity_id": "120211211211",  "entity_name": "Adset Prospecting US v3",  "matched": true,  "metric_values": {"roas": 1.2, "spend": 120},  "action_applied": "pause",  "before": {"status": "active"},  "after": {"status": "paused"},  "skipped": false}

Skipped entries include a skip reason (real values):

  • cooldown
  • failure_backoff
  • pending
  • no_tokens
  • redundant_action

Errored entries include the error detail.

metrics_snapshot

A JSON object of the metric values seen at evaluation time. Useful when:

  • Investigating "the dashboard shows ROAS 2.5 now β€” why did the rule pause the adset?" β†’ check snapshot; rule saw ROAS 0.8 at fire time, late conversions raised it
  • Debugging condition logic β€” did the metric actually match?

Audit log entries

The audit log records rule lifecycle actions (dot-notation):

actionwhen
rule.createnew rule saved
rule.deleterule deleted
rule.togglepause ↔ active toggle
rule.duplicateclone via POST /api/v1/rules/:id/duplicate

There is no rule.update audit action and no per-execution audit action β€” individual rule fires are recorded in automation_rule_execution, not the audit log.

Access the audit log via /api/v1/audit-log.

Paging executions

The executions endpoint is paginated only β€” it does not support date, status, or min-acted filters:

  • page (min 1, default 1)
  • page_size (1-100, default 20)

Endpoint

GET /api/v1/rules/:id/executions (verified apps/backend/src/routes/api/rules.route.ts).

Returns a page of executions in reverse-chronological order, with page and page_size echoed back.

Use cases

Why did this adset pause yesterday?

  1. Open the adset in Ads Manager β†’ see status changed at 14:35
  2. Go to /rules β†’ find the rule that matches the adset's scope
  3. Open /rules/:id β†’ executions around 14:30-14:40
  4. Find the entity in details β†’ see metric_values + match details
  5. Validate the rule did the right thing (or fix the rule if not)

Did the new template actually act?

  1. After activating a templated rule, check executions over 24h
  2. entities_acted > 0 confirms the rule fired action
  3. entities_skipped reasons tell you about protection behavior

Compliance audit

  1. /api/v1/audit-log (rule lifecycle actions with user attribution)
  2. Filter to rule actions (rule.create, rule.delete, rule.toggle, rule.duplicate)
  3. Export for compliance review

Retention

Execution history retained per workspace plan tier β€” see /settings/team/billing. Audit log retention typically matches (or exceeds) execution retention.

Common mistakes

  • Looking at the dashboard instead of metrics_snapshot: dashboard is current; snapshot is what the rule saw. They can differ.
  • Confusing entities_matched with entities_acted: matched = passed conditions; acted = action actually applied (skip protections aside).
  • Missing audit log permission: audit log access may be admin-only depending on workspace policy.

FAQ

Where can I see what a Wevion rule actually did?

Open /rules/:id and scroll to the Executions section, backed by GET /api/v1/rules/:id/executions. It shows fires in reverse-chronological order with counts for entities evaluated, matched, acted, skipped, and errored. Click a fire to expand per-entity details, including metric values and before/after states.

What is metrics_snapshot and why does it differ from the dashboard?

metrics_snapshot is a JSON record of the metric values the rule saw at evaluation time, while the dashboard shows current values. They can differ β€” the rule may have seen ROAS 0.8 at fire time while late conversions later raised it to 2.5. Check the snapshot to understand why a rule acted.

What's the difference between entities_matched and entities_acted?

In Wevion, entities_matched are entities that passed all conditions, while entities_acted are those where the action was actually applied. The gap is caused by protections that skip matched entities, with reasons like cooldown, failure_backoff, pending, no_tokens, and redundant_action. Confusing the two is a common mistake.

How do I run a compliance audit of rule changes?

Use the audit log via /api/v1/audit-log. It records rule lifecycle actions β€” rule.create, rule.delete, rule.toggle, rule.duplicate (there is no rule.update action) β€” with user attribution and timestamp, which you can export for review. Individual rule fires are not audit-log actions; they live in the automation_rule_execution table.

How long is execution history retained?

Execution history is retained per workspace plan tier β€” check /settings/team/billing for your tier. Audit log retention typically matches or exceeds execution retention. The two live in separate tables: executions in automation_rule_execution and lifecycle actions in audit_log.