Skip to content

Communication log

Generated at build time from packages/core/src/operations/activities.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.

activities.log

Log a call, text, visit or note

Kind
Write (audited)
Who
Staff: admin, editor
MCP tool
activities_log

Add an entry to an account's communication log: a call, text, visit, note or a manually entered email. It can also be tied to a contact, order, machine or ticket. Calls, emails, texts and visits update the account's last-contacted date. For emails imported from Gmail use activities.log_email, which prevents duplicates.

Input (object)

FieldTypeDescription
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
typerequired"call" | "email" | "text" | "visit" | "note"
subjectrequiredstringmin length 1, max length 300
bodystring | nullmax length 50000
direction"outbound" | "inbound" | null
occurredAtstring (date-time)Defaults to now
contactIdstring | nullRecord id (UUID)min length 1, max length 64
orderIdstring | nullRecord id (UUID)min length 1, max length 64
machineIdstring | nullRecord id (UUID)min length 1, max length 64
ticketIdstring | nullRecord id (UUID)min length 1, max length 64
durationMinutesinteger | nullmin 0, max 1440

Output (object)

FieldTypeDescription
activityrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
typerequired"call" | "email" | "text" | "visit" | "note" | "system"
directionrequired"outbound" | "inbound" | null
subjectrequiredstring
bodyrequiredstring | null
occurredAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
contactIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
orderIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
machineIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
ticketIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
externalRefrequiredstring | nullGmail message id for imported emails; unique
externalThreadIdrequiredstring | null
fromAddressrequiredstring | null
toAddressesrequiredstring[]
durationMinutesrequiredinteger | nullmin 0, max 9007199254740991
documentIdsrequiredstring[]Attachments stored as documents
loggedByNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
Example request
                curl https://api.cemco.app/v1/ops/activities.log \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"accountId":"00000000-0000-4000-8000-000000000000","type":"call","subject":"example"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "accountId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "type": {
        "type": "string",
        "enum": [
          "call",
          "email",
          "text",
          "visit",
          "note"
        ]
      },
      "subject": {
        "type": "string",
        "minLength": 1,
        "maxLength": 300
      },
      "body": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 50000
          },
          {
            "type": "null"
          }
        ]
      },
      "direction": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "outbound",
              "inbound"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "occurredAt": {
        "description": "Defaults to now",
        "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))$"
      },
      "contactId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "orderId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "machineId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "ticketId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "durationMinutes": {
        "anyOf": [
          {
            "type": "integer",
            "minimum": 0,
            "maximum": 1440
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "accountId",
      "type",
      "subject"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "activity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "type": {
            "type": "string",
            "enum": [
              "call",
              "email",
              "text",
              "visit",
              "note",
              "system"
            ]
          },
          "direction": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "outbound",
                  "inbound"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "subject": {
            "type": "string"
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "occurredAt": {
            "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"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "externalRef": {
            "description": "Gmail message id for imported emails; unique",
            "type": [
              "string",
              "null"
            ]
          },
          "externalThreadId": {
            "type": [
              "string",
              "null"
            ]
          },
          "fromAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "toAddresses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "durationMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "documentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "description": "Attachments stored as documents"
          },
          "loggedByName": {
            "type": "string"
          },
          "createdAt": {
            "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"
          }
        },
        "required": [
          "id",
          "type",
          "direction",
          "subject",
          "body",
          "occurredAt",
          "accountId",
          "contactId",
          "orderId",
          "machineId",
          "ticketId",
          "externalRef",
          "externalThreadId",
          "fromAddress",
          "toAddresses",
          "durationMinutes",
          "documentIds",
          "loggedByName",
          "createdAt"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "activity"
    ],
    "additionalProperties": false
  }
}
            

activities.log_email

File a Gmail email on an account

Kind
Write (audited)
Who
Staff: admin, editor
MCP tool
activities_log_email

Store one email from a staff mailbox on the right account, with its attachments saved as documents. Idempotent: an email with the same Gmail message id, or the same RFC 822 Message-ID (when given), is stored once, so the same email read from Gmail and forwarded to crm@ is filed once; calling again returns the existing entry with created false. If accountId is not given the account is matched from the sender and recipient addresses against contact emails; when no account matches the call fails with not_found and nothing is stored.

Input (object)

FieldTypeDescription
gmailMessageIdrequiredstringGmail message id; the idempotency keymin length 1, max length 200
rfc822MessageIdstring | nullThe email's Message-ID header, for example <abc@mail.example.com>; a second key: an email with the same Message-ID is stored oncemin length 1, max length 998
gmailThreadIdstring | nullmax length 200
accountIdstringSkip matching and file on this accountmin length 1, max length 64
fromrequiredstringSender addressmin length 1, max length 320
tostring[]default []
ccstring[]default []
subjectstringdefault "(no subject)", max length 500
bodyTextstring | nullmax length 200000
sentAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
direction"outbound" | "inbound"Defaults to outbound when the sender is a staff address
orderIdstring | nullRecord id (UUID)min length 1, max length 64
machineIdstring | nullRecord id (UUID)min length 1, max length 64
ticketIdstring | nullRecord id (UUID)min length 1, max length 64
attachmentsobject[]default [], at most 20
filenamerequiredstringmin length 1, max length 255
contentTypestringdefault "application/pdf", max length 100
contentBase64requiredstringFile bytes, base64 encoded (max 10 MB)min length 1
attachmentDocumentIdsstring[]Documents already uploaded for this emaildefault []

Output (object)

FieldTypeDescription
activityrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
typerequired"call" | "email" | "text" | "visit" | "note" | "system"
directionrequired"outbound" | "inbound" | null
subjectrequiredstring
bodyrequiredstring | null
occurredAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
contactIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
orderIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
machineIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
ticketIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
externalRefrequiredstring | nullGmail message id for imported emails; unique
externalThreadIdrequiredstring | null
fromAddressrequiredstring | null
toAddressesrequiredstring[]
durationMinutesrequiredinteger | nullmin 0, max 9007199254740991
documentIdsrequiredstring[]Attachments stored as documents
loggedByNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
createdrequiredbooleanFalse when this Gmail message id was already stored
matchedByrequired"account_id" | "contact_email" | "existing"
matchedContactIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
documentIdsrequiredstring[]
Example request
                curl https://api.cemco.app/v1/ops/activities.log_email \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"gmailMessageId":"00000000-0000-4000-8000-000000000000","from":"example","sentAt":"2026-12-06T15:00:00.000Z"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "gmailMessageId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200,
        "description": "Gmail message id; the idempotency key"
      },
      "rfc822MessageId": {
        "description": "The email's Message-ID header, for example <abc@mail.example.com>; a second key: an email with the same Message-ID is stored once",
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 998
          },
          {
            "type": "null"
          }
        ]
      },
      "gmailThreadId": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 200
          },
          {
            "type": "null"
          }
        ]
      },
      "accountId": {
        "description": "Skip matching and file on this account",
        "type": "string",
        "minLength": 1,
        "maxLength": 64
      },
      "from": {
        "type": "string",
        "minLength": 1,
        "maxLength": 320,
        "description": "Sender address"
      },
      "to": {
        "default": [],
        "type": "array",
        "items": {
          "type": "string",
          "maxLength": 320
        }
      },
      "cc": {
        "default": [],
        "type": "array",
        "items": {
          "type": "string",
          "maxLength": 320
        }
      },
      "subject": {
        "default": "(no subject)",
        "type": "string",
        "maxLength": 500
      },
      "bodyText": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 200000
          },
          {
            "type": "null"
          }
        ]
      },
      "sentAt": {
        "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"
      },
      "direction": {
        "description": "Defaults to outbound when the sender is a staff address",
        "type": "string",
        "enum": [
          "outbound",
          "inbound"
        ]
      },
      "orderId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "machineId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "ticketId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "attachments": {
        "default": [],
        "maxItems": 20,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "filename": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "contentType": {
              "default": "application/pdf",
              "type": "string",
              "maxLength": 100
            },
            "contentBase64": {
              "type": "string",
              "minLength": 1,
              "description": "File bytes, base64 encoded (max 10 MB)"
            }
          },
          "required": [
            "filename",
            "contentBase64"
          ]
        }
      },
      "attachmentDocumentIds": {
        "default": [],
        "description": "Documents already uploaded for this email",
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "description": "Record id (UUID)"
        }
      }
    },
    "required": [
      "gmailMessageId",
      "from",
      "sentAt"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "activity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "type": {
            "type": "string",
            "enum": [
              "call",
              "email",
              "text",
              "visit",
              "note",
              "system"
            ]
          },
          "direction": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "outbound",
                  "inbound"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "subject": {
            "type": "string"
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "occurredAt": {
            "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"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "externalRef": {
            "description": "Gmail message id for imported emails; unique",
            "type": [
              "string",
              "null"
            ]
          },
          "externalThreadId": {
            "type": [
              "string",
              "null"
            ]
          },
          "fromAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "toAddresses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "durationMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "documentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "description": "Attachments stored as documents"
          },
          "loggedByName": {
            "type": "string"
          },
          "createdAt": {
            "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"
          }
        },
        "required": [
          "id",
          "type",
          "direction",
          "subject",
          "body",
          "occurredAt",
          "accountId",
          "contactId",
          "orderId",
          "machineId",
          "ticketId",
          "externalRef",
          "externalThreadId",
          "fromAddress",
          "toAddresses",
          "durationMinutes",
          "documentIds",
          "loggedByName",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "created": {
        "type": "boolean",
        "description": "False when this Gmail message id was already stored"
      },
      "matchedBy": {
        "type": "string",
        "enum": [
          "account_id",
          "contact_email",
          "existing"
        ]
      },
      "matchedContactId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "documentIds": {
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "description": "Record id (UUID)"
        }
      }
    },
    "required": [
      "activity",
      "created",
      "matchedBy",
      "matchedContactId",
      "documentIds"
    ],
    "additionalProperties": false
  }
}
            

activities.match_email

Find the account for an email

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

Given the addresses on an email, return the accounts and contacts they belong to and whether the Gmail message id is already stored. Use it to decide where an email should be filed before calling activities.log_email.

Input (object)

FieldTypeDescription
addressesrequiredstring[]at least 1
gmailMessageIdstringmax length 200
rfc822MessageIdstring | nullThe email's Message-ID header; also checked for alreadyStoredmax length 998

Output (object)

FieldTypeDescription
alreadyStoredrequiredboolean
matchesrequiredobject[]
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
accountNamerequiredstring
contactIdrequiredstringRecord id (UUID)min length 1, max length 64
contactNamerequiredstring
emailrequiredstring
openOrderIdsrequiredstring[]
Example request
                curl https://api.cemco.app/v1/ops/activities.match_email \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"addresses":["example"]}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "addresses": {
        "minItems": 1,
        "type": "array",
        "items": {
          "type": "string",
          "maxLength": 320
        }
      },
      "gmailMessageId": {
        "type": "string",
        "maxLength": 200
      },
      "rfc822MessageId": {
        "description": "The email's Message-ID header; also checked for alreadyStored",
        "anyOf": [
          {
            "type": "string",
            "maxLength": 998
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "addresses"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "alreadyStored": {
        "type": "boolean"
      },
      "matches": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "accountName": {
              "type": "string"
            },
            "contactId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "contactName": {
              "type": "string"
            },
            "email": {
              "type": "string"
            },
            "openOrderIds": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              }
            }
          },
          "required": [
            "accountId",
            "accountName",
            "contactId",
            "contactName",
            "email",
            "openOrderIds"
          ],
          "additionalProperties": false
        }
      }
    },
    "required": [
      "alreadyStored",
      "matches"
    ],
    "additionalProperties": false
  }
}
            

activities.list

Read the communication log

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

Activity timeline entries, newest first, for an account, contact, order, machine or ticket, optionally of one type or within a date range.

Input (object)

FieldTypeDescription
accountIdstringRecord id (UUID)min length 1, max length 64
contactIdstringRecord id (UUID)min length 1, max length 64
orderIdstringRecord id (UUID)min length 1, max length 64
machineIdstringRecord id (UUID)min length 1, max length 64
ticketIdstringRecord id (UUID)min length 1, max length 64
type"call" | "email" | "text" | "visit" | "note" | "system"
fromstring (date-time)UTC timestamp, ISO 8601 with Z
tostring (date-time)UTC timestamp, ISO 8601 with Z
querystringMatches subject or bodymax length 200
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
typerequired"call" | "email" | "text" | "visit" | "note" | "system"
directionrequired"outbound" | "inbound" | null
subjectrequiredstring
bodyrequiredstring | null
occurredAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
contactIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
orderIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
machineIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
ticketIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
externalRefrequiredstring | nullGmail message id for imported emails; unique
externalThreadIdrequiredstring | null
fromAddressrequiredstring | null
toAddressesrequiredstring[]
durationMinutesrequiredinteger | nullmin 0, max 9007199254740991
documentIdsrequiredstring[]Attachments stored as documents
loggedByNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountNamerequiredstring
contactNamerequiredstring | 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/activities.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": {
      "accountId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "contactId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "orderId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "machineId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "ticketId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "type": {
        "type": "string",
        "enum": [
          "call",
          "email",
          "text",
          "visit",
          "note",
          "system"
        ]
      },
      "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"
      },
      "query": {
        "description": "Matches subject or body",
        "type": "string",
        "maxLength": 200
      },
      "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)"
            },
            "type": {
              "type": "string",
              "enum": [
                "call",
                "email",
                "text",
                "visit",
                "note",
                "system"
              ]
            },
            "direction": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "outbound",
                    "inbound"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "subject": {
              "type": "string"
            },
            "body": {
              "type": [
                "string",
                "null"
              ]
            },
            "occurredAt": {
              "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"
            },
            "accountId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "contactId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "orderId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "machineId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "ticketId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "externalRef": {
              "description": "Gmail message id for imported emails; unique",
              "type": [
                "string",
                "null"
              ]
            },
            "externalThreadId": {
              "type": [
                "string",
                "null"
              ]
            },
            "fromAddress": {
              "type": [
                "string",
                "null"
              ]
            },
            "toAddresses": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "durationMinutes": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            },
            "documentIds": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "description": "Attachments stored as documents"
            },
            "loggedByName": {
              "type": "string"
            },
            "createdAt": {
              "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"
            },
            "accountName": {
              "type": "string"
            },
            "contactName": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "type",
            "direction",
            "subject",
            "body",
            "occurredAt",
            "accountId",
            "contactId",
            "orderId",
            "machineId",
            "ticketId",
            "externalRef",
            "externalThreadId",
            "fromAddress",
            "toAddresses",
            "durationMinutes",
            "documentIds",
            "loggedByName",
            "createdAt",
            "accountName",
            "contactName"
          ],
          "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
  }
}
            

activities.update

Edit a log entry

Kind
Write (audited)
Who
Staff: admin, editor
MCP tool
activities_update

Correct the subject, body, time, links or duration of a logged activity. Imported emails keep their Gmail message id.

Input (object)

FieldTypeDescription
idrequiredstringRecord id (UUID)min length 1, max length 64
subjectstringmin length 1, max length 300
bodystring | nullmax length 50000
occurredAtstring (date-time)UTC timestamp, ISO 8601 with Z
contactIdstring | nullRecord id (UUID)min length 1, max length 64
orderIdstring | nullRecord id (UUID)min length 1, max length 64
machineIdstring | nullRecord id (UUID)min length 1, max length 64
ticketIdstring | nullRecord id (UUID)min length 1, max length 64
durationMinutesinteger | nullmin 0, max 1440

Output (object)

FieldTypeDescription
activityrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
typerequired"call" | "email" | "text" | "visit" | "note" | "system"
directionrequired"outbound" | "inbound" | null
subjectrequiredstring
bodyrequiredstring | null
occurredAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
contactIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
orderIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
machineIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
ticketIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
externalRefrequiredstring | nullGmail message id for imported emails; unique
externalThreadIdrequiredstring | null
fromAddressrequiredstring | null
toAddressesrequiredstring[]
durationMinutesrequiredinteger | nullmin 0, max 9007199254740991
documentIdsrequiredstring[]Attachments stored as documents
loggedByNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
Example request
                curl https://api.cemco.app/v1/ops/activities.update \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"id":"00000000-0000-4000-8000-000000000000"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "subject": {
        "type": "string",
        "minLength": 1,
        "maxLength": 300
      },
      "body": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 50000
          },
          {
            "type": "null"
          }
        ]
      },
      "occurredAt": {
        "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"
      },
      "contactId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "orderId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "machineId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "ticketId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "durationMinutes": {
        "anyOf": [
          {
            "type": "integer",
            "minimum": 0,
            "maximum": 1440
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "id"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "activity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "type": {
            "type": "string",
            "enum": [
              "call",
              "email",
              "text",
              "visit",
              "note",
              "system"
            ]
          },
          "direction": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "outbound",
                  "inbound"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "subject": {
            "type": "string"
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "occurredAt": {
            "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"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "contactId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "machineId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "externalRef": {
            "description": "Gmail message id for imported emails; unique",
            "type": [
              "string",
              "null"
            ]
          },
          "externalThreadId": {
            "type": [
              "string",
              "null"
            ]
          },
          "fromAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "toAddresses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "durationMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "documentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "description": "Attachments stored as documents"
          },
          "loggedByName": {
            "type": "string"
          },
          "createdAt": {
            "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"
          }
        },
        "required": [
          "id",
          "type",
          "direction",
          "subject",
          "body",
          "occurredAt",
          "accountId",
          "contactId",
          "orderId",
          "machineId",
          "ticketId",
          "externalRef",
          "externalThreadId",
          "fromAddress",
          "toAddresses",
          "durationMinutes",
          "documentIds",
          "loggedByName",
          "createdAt"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "activity"
    ],
    "additionalProperties": false
  }
}
            

activities.delete

Delete a log entry

Kind
Write (audited)
Who
Staff: admin, editor
MCP tool
activities_delete

Remove an activity logged by mistake. The account's last-contacted date is recalculated.

Input (object)

FieldTypeDescription
idrequiredstringRecord id (UUID)min length 1, max length 64

Output (object)

FieldTypeDescription
okrequiredtrue
idrequiredstringRecord id (UUID)min length 1, max length 64
Example request
                curl https://api.cemco.app/v1/ops/activities.delete \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"id":"00000000-0000-4000-8000-000000000000"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      }
    },
    "required": [
      "id"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "ok": {
        "type": "boolean",
        "const": true
      },
      "id": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      }
    },
    "required": [
      "ok",
      "id"
    ],
    "additionalProperties": false
  }
}