Skip to content

Audit log

Generated at build time from packages/core/src/operations/audit.ts. Every operation below isPOST /v1/ops/{name} over HTTP, env.API.invoke(actor, name, input) over RPC, and, when staff may call it, an MCP tool. See the API overview for authentication and errors.

audit.list

Read the audit log

Kind
Read
Who
Staff: admin, editor, viewer
MCP tool
audit_list

Who changed what and when. Every write made through the app, the MCP server, an agent or the portal is recorded with the actor, the operation and the record. Filter by record, account, actor, operation or time range.

Input (object)

FieldTypeDescription
entityType"account" | "contact" | "site" | "order" | "product" | "machine" | "ticket" | "warranty_claim" | "part" | "parts_order" | "document" | "activity" | "task" | "check_in" | "opportunity" | "service_plan" | "service_contract" | "training_record" | "import_run" | "user" | "portal_invite" | "customer_user" | "calendar_feed" | "stock_movement" | "email"
entityIdstringmax length 64
accountIdstringRecord id (UUID)min length 1, max length 64
actorUserIdstringmax length 64
actorEmailstringmax length 254
operationstringExact operation name, or a group prefix such as orders.max length 100
fromstring (date-time)UTC timestamp, ISO 8601 with Z
tostring (date-time)UTC timestamp, ISO 8601 with Z
limitintegerMaximum rows to return (default 50, max 500)default 50, min 1, max 500
offsetintegerRows to skip, for pagingdefault 0, min 0, max 9007199254740991

Output (object)

FieldTypeDescription
itemsrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
atrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
actorKindrequired"staff" | "customer" | "agent" | "system"
actorUserIdrequiredstring
actorEmailrequiredstring
actorNamerequiredstring
operationrequiredstring
entityTyperequired"account" | "contact" | "site" | "order" | "product" | "machine" | "ticket" | "warranty_claim" | "part" | "parts_order" | "document" | "activity" | "task" | "check_in" | "opportunity" | "service_plan" | "service_contract" | "training_record" | "import_run" | "user" | "portal_invite" | "customer_user" | "calendar_feed" | "stock_movement" | "email" | null
entityIdrequiredstring | null
accountIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
summaryrequiredstring | null
detailrequiredrecord of any | null
requestIdrequiredstring | null
totalrequiredintegerTotal rows matching the filters, ignoring limit and offsetmin 0, max 9007199254740991
limitrequiredintegermin -9007199254740991, max 9007199254740991
offsetrequiredintegermin -9007199254740991, max 9007199254740991
Example request
                curl https://api.cemco.app/v1/ops/audit.list \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "entityType": {
        "type": "string",
        "enum": [
          "account",
          "contact",
          "site",
          "order",
          "product",
          "machine",
          "ticket",
          "warranty_claim",
          "part",
          "parts_order",
          "document",
          "activity",
          "task",
          "check_in",
          "opportunity",
          "service_plan",
          "service_contract",
          "training_record",
          "import_run",
          "user",
          "portal_invite",
          "customer_user",
          "calendar_feed",
          "stock_movement",
          "email"
        ]
      },
      "entityId": {
        "type": "string",
        "maxLength": 64
      },
      "accountId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "actorUserId": {
        "type": "string",
        "maxLength": 64
      },
      "actorEmail": {
        "type": "string",
        "maxLength": 254
      },
      "operation": {
        "description": "Exact operation name, or a group prefix such as orders.",
        "type": "string",
        "maxLength": 100
      },
      "from": {
        "type": "string",
        "format": "date-time",
        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
        "description": "UTC timestamp, ISO 8601 with Z"
      },
      "to": {
        "type": "string",
        "format": "date-time",
        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
        "description": "UTC timestamp, ISO 8601 with Z"
      },
      "limit": {
        "default": 50,
        "description": "Maximum rows to return (default 50, max 500)",
        "type": "integer",
        "minimum": 1,
        "maximum": 500
      },
      "offset": {
        "default": 0,
        "description": "Rows to skip, for paging",
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      }
    }
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
              "description": "UTC timestamp, ISO 8601 with Z"
            },
            "actorKind": {
              "type": "string",
              "enum": [
                "staff",
                "customer",
                "agent",
                "system"
              ]
            },
            "actorUserId": {
              "type": "string"
            },
            "actorEmail": {
              "type": "string"
            },
            "actorName": {
              "type": "string"
            },
            "operation": {
              "type": "string"
            },
            "entityType": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "account",
                    "contact",
                    "site",
                    "order",
                    "product",
                    "machine",
                    "ticket",
                    "warranty_claim",
                    "part",
                    "parts_order",
                    "document",
                    "activity",
                    "task",
                    "check_in",
                    "opportunity",
                    "service_plan",
                    "service_contract",
                    "training_record",
                    "import_run",
                    "user",
                    "portal_invite",
                    "customer_user",
                    "calendar_feed",
                    "stock_movement",
                    "email"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "entityId": {
              "type": [
                "string",
                "null"
              ]
            },
            "accountId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "summary": {
              "type": [
                "string",
                "null"
              ]
            },
            "detail": {
              "anyOf": [
                {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                {
                  "type": "null"
                }
              ]
            },
            "requestId": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "at",
            "actorKind",
            "actorUserId",
            "actorEmail",
            "actorName",
            "operation",
            "entityType",
            "entityId",
            "accountId",
            "summary",
            "detail",
            "requestId"
          ],
          "additionalProperties": false
        }
      },
      "total": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991,
        "description": "Total rows matching the filters, ignoring limit and offset"
      },
      "limit": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      },
      "offset": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      }
    },
    "required": [
      "items",
      "total",
      "limit",
      "offset"
    ],
    "additionalProperties": false
  }
}