DOCS

v1.3.28
 // Pro v1.2.20

 · Latest

Docs/API Reference/Audit Log API

Audit Log API

Access the complete timeline of automation activities with filtering, search, and pagination.

Base URL: /wp-json/odcm/v1/audit-log

Authentication: GET endpoints require view_woocommerce_reports capability (Admin and Shop Manager). POST/DELETE endpoints additionally require a valid REST nonce.

Endpoints

GET /audit-log

List audit log entries with filtering and pagination.

Parameters:

  • page (int) – page number (default: 1, max: 1000)
  • per_page (int) – items per page (default: 20, max: 200)
  • view (string) – consolidated (default) or flat – see below
  • include_debug (bool) – include debug-level entries (default: false)
  • include_test (bool) – include test-mode entries (default: false)
  • source (string) – filter by source: manual, webhook, api, scheduled, system
curl "https://yoursite.com/wp-json/odcm/v1/audit-log?source=webhook&per_page=10" 
  -u "your-username:xxxx xxxx xxxx xxxx xxxx xxxx"

Response:

{
  "logs": [
    {
      "id": 456,
      "timestamp": "2025-01-15T14:30:25Z",
      "status": "success",
      "event_type": "rule_evaluation",
      "source": "automation",
      "summary": "Rule 'Auto-Complete Virtual Orders' executed successfully",
      "order_id": 789,
      "process_id": "proc_abc123"
    }
  ],
  "pagination": {
    "total": 1250,
    "total_pages": 125,
    "current_page": 1,
    "per_page": 10,
    "start_item": 1,
    "end_item": 10,
    "has_previous": false,
    "has_next": true
  },
  "filters": {},
  "meta": {
    "execution_time": 0.045,
    "timestamp": "2025-01-15 14:30:25",
    "consolidated_pagination": true,
    "view_mode": "consolidated",
    "is_truncated": false
  }
}

Choosing view mode

consolidated (default)flat
Pagination basisAfter grouping by process_idRaw DB rows
Max results500 grouped entries (safety cap)Unlimited via pagination
Use whenBuilding a timeline UIExporting data, counting events, or working with large volumes

When is_truncated: true in the response meta, the result set hit the 500-entry cap – switch to flat with explicit filters for reliable data export.

GET /audit-log/process/{process_id}

Get all log entries belonging to a single process (correlated by process_id).

curl "https://yoursite.com/wp-json/odcm/v1/audit-log/process/proc_abc123" 
  -u "your-username:xxxx xxxx xxxx xxxx xxxx xxxx"

Response: {logs: [...], meta: {process_id, execution_time}}

GET /audit-log/filter-options

Get the distinct values currently present in the log for populating filter dropdowns.

Response:

{
  "filter_options": {
    "statuses": [{ "value": "success", "label": "success" }, { "value": "error", "label": "error" }],
    "event_types": [{ "value": "rule_evaluation", "label": "rule_evaluation" }],
    "sources": [{ "value": "webhook", "label": "webhook" }]
  },
  "order_ids": [789, 456],
  "meta": { "execution_time": 0.02, "timestamp": "...", "max_results": 100 }
}

Internal-only event types are excluded from event_types. order_ids is capped at the 100 most recent orders that have log entries.

DELETE /audit-log/batch-delete

Delete multiple log entries by ID. Requires manage_woocommerce (stricter than the GET endpoints).

curl -X DELETE "https://yoursite.com/wp-json/odcm/v1/audit-log/batch-delete" 
  -H "Content-Type: application/json" 
  -H "X-WP-Nonce: YOUR_NONCE" 
  -d '{"log_ids": [1, 2, 3]}'

Body: {"log_ids": [1, 2, 3]} – max 100 IDs per request.

Response: {"success": true, "deleted_count": 3, "requested_count": 3}

POST /audit-log/render-components

Render timeline UI components for a specific log entry. Used internally by the Insight Dashboard – not intended for third-party consumption.

Body: {"log_id": 456, "include_debug": false, "view_mode": "consolidated"}

Response: {"html": "...", "meta": {...}}