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
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)
| Field | Type | Description |
|---|---|---|
accountIdrequired | string | Record id (UUID)min length 1, max length 64 |
typerequired | "call" | "email" | "text" | "visit" | "note" | |
subjectrequired | string | min length 1, max length 300 |
body | string | null | max length 50000 |
direction | "outbound" | "inbound" | null | |
occurredAt | string (date-time) | Defaults to now |
contactId | string | null | Record id (UUID)min length 1, max length 64 |
orderId | string | null | Record id (UUID)min length 1, max length 64 |
machineId | string | null | Record id (UUID)min length 1, max length 64 |
ticketId | string | null | Record id (UUID)min length 1, max length 64 |
durationMinutes | integer | null | min 0, max 1440 |
Output (object)
| Field | Type | Description |
|---|---|---|
activityrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
typerequired | "call" | "email" | "text" | "visit" | "note" | "system" | |
directionrequired | "outbound" | "inbound" | null | |
subjectrequired | string | |
bodyrequired | string | null | |
occurredAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
accountIdrequired | string | Record id (UUID)min length 1, max length 64 |
contactIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
orderIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
machineIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
ticketIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
externalRefrequired | string | null | Gmail message id for imported emails; unique |
externalThreadIdrequired | string | null | |
fromAddressrequired | string | null | |
toAddressesrequired | string[] | |
durationMinutesrequired | integer | null | min 0, max 9007199254740991 |
documentIdsrequired | string[] | Attachments stored as documents |
loggedByNamerequired | string | |
createdAtrequired | string (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
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)
| Field | Type | Description |
|---|---|---|
gmailMessageIdrequired | string | Gmail message id; the idempotency keymin length 1, max length 200 |
rfc822MessageId | string | null | The 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 |
gmailThreadId | string | null | max length 200 |
accountId | string | Skip matching and file on this accountmin length 1, max length 64 |
fromrequired | string | Sender addressmin length 1, max length 320 |
to | string[] | default [] |
cc | string[] | default [] |
subject | string | default "(no subject)", max length 500 |
bodyText | string | null | max length 200000 |
sentAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
direction | "outbound" | "inbound" | Defaults to outbound when the sender is a staff address |
orderId | string | null | Record id (UUID)min length 1, max length 64 |
machineId | string | null | Record id (UUID)min length 1, max length 64 |
ticketId | string | null | Record id (UUID)min length 1, max length 64 |
attachments | object[] | default [], at most 20 |
filenamerequired | string | min length 1, max length 255 |
contentType | string | default "application/pdf", max length 100 |
contentBase64required | string | File bytes, base64 encoded (max 10 MB)min length 1 |
attachmentDocumentIds | string[] | Documents already uploaded for this emaildefault [] |
Output (object)
| Field | Type | Description |
|---|---|---|
activityrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
typerequired | "call" | "email" | "text" | "visit" | "note" | "system" | |
directionrequired | "outbound" | "inbound" | null | |
subjectrequired | string | |
bodyrequired | string | null | |
occurredAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
accountIdrequired | string | Record id (UUID)min length 1, max length 64 |
contactIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
orderIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
machineIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
ticketIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
externalRefrequired | string | null | Gmail message id for imported emails; unique |
externalThreadIdrequired | string | null | |
fromAddressrequired | string | null | |
toAddressesrequired | string[] | |
durationMinutesrequired | integer | null | min 0, max 9007199254740991 |
documentIdsrequired | string[] | Attachments stored as documents |
loggedByNamerequired | string | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
createdrequired | boolean | False when this Gmail message id was already stored |
matchedByrequired | "account_id" | "contact_email" | "existing" | |
matchedContactIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
documentIdsrequired | string[] |
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
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)
| Field | Type | Description |
|---|---|---|
addressesrequired | string[] | at least 1 |
gmailMessageId | string | max length 200 |
rfc822MessageId | string | null | The email's Message-ID header; also checked for alreadyStoredmax length 998 |
Output (object)
| Field | Type | Description |
|---|---|---|
alreadyStoredrequired | boolean | |
matchesrequired | object[] | |
accountIdrequired | string | Record id (UUID)min length 1, max length 64 |
accountNamerequired | string | |
contactIdrequired | string | Record id (UUID)min length 1, max length 64 |
contactNamerequired | string | |
emailrequired | string | |
openOrderIdsrequired | string[] |
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
Activity timeline entries, newest first, for an account, contact, order, machine or ticket, optionally of one type or within a date range.
Input (object)
| Field | Type | Description |
|---|---|---|
accountId | string | Record id (UUID)min length 1, max length 64 |
contactId | string | Record id (UUID)min length 1, max length 64 |
orderId | string | Record id (UUID)min length 1, max length 64 |
machineId | string | Record id (UUID)min length 1, max length 64 |
ticketId | string | Record id (UUID)min length 1, max length 64 |
type | "call" | "email" | "text" | "visit" | "note" | "system" | |
from | string (date-time) | UTC timestamp, ISO 8601 with Z |
to | string (date-time) | UTC timestamp, ISO 8601 with Z |
query | string | Matches subject or bodymax length 200 |
limit | integer | Maximum rows to return (default 50, max 500)default 50, min 1, max 500 |
offset | integer | Rows to skip, for pagingdefault 0, min 0, max 9007199254740991 |
Output (object)
| Field | Type | Description |
|---|---|---|
itemsrequired | object[] | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
typerequired | "call" | "email" | "text" | "visit" | "note" | "system" | |
directionrequired | "outbound" | "inbound" | null | |
subjectrequired | string | |
bodyrequired | string | null | |
occurredAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
accountIdrequired | string | Record id (UUID)min length 1, max length 64 |
contactIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
orderIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
machineIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
ticketIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
externalRefrequired | string | null | Gmail message id for imported emails; unique |
externalThreadIdrequired | string | null | |
fromAddressrequired | string | null | |
toAddressesrequired | string[] | |
durationMinutesrequired | integer | null | min 0, max 9007199254740991 |
documentIdsrequired | string[] | Attachments stored as documents |
loggedByNamerequired | string | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
accountNamerequired | string | |
contactNamerequired | string | null | |
totalrequired | integer | Total rows matching the filters, ignoring limit and offsetmin 0, max 9007199254740991 |
limitrequired | integer | min -9007199254740991, max 9007199254740991 |
offsetrequired | integer | min -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
Correct the subject, body, time, links or duration of a logged activity. Imported emails keep their Gmail message id.
Input (object)
| Field | Type | Description |
|---|---|---|
idrequired | string | Record id (UUID)min length 1, max length 64 |
subject | string | min length 1, max length 300 |
body | string | null | max length 50000 |
occurredAt | string (date-time) | UTC timestamp, ISO 8601 with Z |
contactId | string | null | Record id (UUID)min length 1, max length 64 |
orderId | string | null | Record id (UUID)min length 1, max length 64 |
machineId | string | null | Record id (UUID)min length 1, max length 64 |
ticketId | string | null | Record id (UUID)min length 1, max length 64 |
durationMinutes | integer | null | min 0, max 1440 |
Output (object)
| Field | Type | Description |
|---|---|---|
activityrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
typerequired | "call" | "email" | "text" | "visit" | "note" | "system" | |
directionrequired | "outbound" | "inbound" | null | |
subjectrequired | string | |
bodyrequired | string | null | |
occurredAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
accountIdrequired | string | Record id (UUID)min length 1, max length 64 |
contactIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
orderIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
machineIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
ticketIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
externalRefrequired | string | null | Gmail message id for imported emails; unique |
externalThreadIdrequired | string | null | |
fromAddressrequired | string | null | |
toAddressesrequired | string[] | |
durationMinutesrequired | integer | null | min 0, max 9007199254740991 |
documentIdsrequired | string[] | Attachments stored as documents |
loggedByNamerequired | string | |
createdAtrequired | string (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
Remove an activity logged by mistake. The account's last-contacted date is recalculated.
Input (object)
| Field | Type | Description |
|---|---|---|
idrequired | string | Record id (UUID)min length 1, max length 64 |
Output (object)
| Field | Type | Description |
|---|---|---|
okrequired | true | |
idrequired | string | Record 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
}
}