Skip to content

Orders

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

orders.list

List orders

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

List production orders with filters for account, stage and validity. Each row says whether the order is valid and, if not, which of the three requirements are missing (signed quote, its received date, balance remaining).

Input (object)

FieldTypeDescription
accountIdstringRecord id (UUID)min length 1, max length 64
stage"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stages("received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed")[]Several stages at once
openbooleantrue for orders not yet closed, false for closed orders
validbooleanfalse returns only orders that are not yet valid
querystringMatches order number, PO number, title or account namemax length 200
sort"newest" | "oldest" | "order_number" | "expected_ship"default "newest"
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
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountNamerequiredstring
siteNamerequiredstring | null
missingrequired("signed_quote" | "signed_quote_received_on" | "balance_remaining")[]
nextStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed" | null
lineCountrequiredintegermin -9007199254740991, max 9007199254740991
machineCountrequiredintegermin -9007199254740991, max 9007199254740991
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/orders.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)"
      },
      "stage": {
        "type": "string",
        "enum": [
          "received",
          "in_build",
          "ready_to_ship",
          "shipped",
          "delivered",
          "set_up",
          "commissioned",
          "trained",
          "closed"
        ]
      },
      "stages": {
        "description": "Several stages at once",
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "received",
            "in_build",
            "ready_to_ship",
            "shipped",
            "delivered",
            "set_up",
            "commissioned",
            "trained",
            "closed"
          ]
        }
      },
      "open": {
        "description": "true for orders not yet closed, false for closed orders",
        "type": "boolean"
      },
      "valid": {
        "description": "false returns only orders that are not yet valid",
        "type": "boolean"
      },
      "query": {
        "description": "Matches order number, PO number, title or account name",
        "type": "string",
        "maxLength": 200
      },
      "sort": {
        "default": "newest",
        "type": "string",
        "enum": [
          "newest",
          "oldest",
          "order_number",
          "expected_ship"
        ]
      },
      "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)"
            },
            "orderNumber": {
              "type": "string"
            },
            "accountId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "siteId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Delivery site"
            },
            "title": {
              "type": [
                "string",
                "null"
              ]
            },
            "stage": {
              "type": "string",
              "enum": [
                "received",
                "in_build",
                "ready_to_ship",
                "shipped",
                "delivered",
                "set_up",
                "commissioned",
                "trained",
                "closed"
              ]
            },
            "stageDates": {
              "type": "object",
              "properties": {
                "received": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "in_build": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ready_to_ship": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "shipped": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "delivered": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "set_up": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "commissioned": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "trained": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "closed": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "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])))$",
                      "description": "Date as YYYY-MM-DD"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "received",
                "in_build",
                "ready_to_ship",
                "shipped",
                "delivered",
                "set_up",
                "commissioned",
                "trained",
                "closed"
              ],
              "additionalProperties": false,
              "description": "Date each stage was reached; null if not yet"
            },
            "signedQuoteDocumentId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "signedQuoteReceivedOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "totalCents": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "Amount in integer US cents (zero or more)"
            },
            "balanceRemainingCents": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in integer US cents (zero or more)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Null until someone records it; 0 means paid in full"
            },
            "isValid": {
              "type": "boolean"
            },
            "financingPartner": {
              "type": "string",
              "enum": [
                "none",
                "commercial_capital",
                "northland_capital",
                "other"
              ]
            },
            "financingStatus": {
              "type": "string",
              "enum": [
                "not_applicable",
                "pending",
                "approved",
                "declined",
                "funded"
              ]
            },
            "financingNotes": {
              "type": [
                "string",
                "null"
              ]
            },
            "poNumber": {
              "type": [
                "string",
                "null"
              ]
            },
            "expectedShipOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "ownerUserId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "notes": {
              "type": [
                "string",
                "null"
              ]
            },
            "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"
            },
            "updatedAt": {
              "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"
            },
            "siteName": {
              "type": [
                "string",
                "null"
              ]
            },
            "missing": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "signed_quote",
                  "signed_quote_received_on",
                  "balance_remaining"
                ]
              }
            },
            "nextStage": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "lineCount": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "machineCount": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "id",
            "orderNumber",
            "accountId",
            "siteId",
            "title",
            "stage",
            "stageDates",
            "signedQuoteDocumentId",
            "signedQuoteReceivedOn",
            "totalCents",
            "balanceRemainingCents",
            "isValid",
            "financingPartner",
            "financingStatus",
            "financingNotes",
            "poNumber",
            "expectedShipOn",
            "ownerUserId",
            "notes",
            "createdAt",
            "updatedAt",
            "accountName",
            "siteName",
            "missing",
            "nextStage",
            "lineCount",
            "machineCount"
          ],
          "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
  }
}
            

orders.board

Get the order board by stage

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

Every order grouped into the nine lifecycle stages in order (received, in_build, ready_to_ship, shipped, delivered, set_up, commissioned, trained, closed), with a count and dollar total per stage. Orders that are not valid are flagged with what is missing. Closed orders are left out unless includeClosed is true.

Input (object)

FieldTypeDescription
accountIdstringRecord id (UUID)min length 1, max length 64
includeClosedbooleandefault false

Output (object)

FieldTypeDescription
columnsrequiredobject[]One column per stage, in lifecycle order
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
labelrequiredstring
countrequiredintegermin -9007199254740991, max 9007199254740991
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
ordersrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountNamerequiredstring
siteNamerequiredstring | null
missingrequired("signed_quote" | "signed_quote_received_on" | "balance_remaining")[]
nextStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed" | null
lineCountrequiredintegermin -9007199254740991, max 9007199254740991
machineCountrequiredintegermin -9007199254740991, max 9007199254740991
openCountrequiredintegermin -9007199254740991, max 9007199254740991
invalidCountrequiredintegerOpen orders that are not yet validmin -9007199254740991, max 9007199254740991
Example request
                curl https://api.cemco.app/v1/ops/orders.board \
  -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)"
      },
      "includeClosed": {
        "default": false,
        "type": "boolean"
      }
    }
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "columns": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "stage": {
              "type": "string",
              "enum": [
                "received",
                "in_build",
                "ready_to_ship",
                "shipped",
                "delivered",
                "set_up",
                "commissioned",
                "trained",
                "closed"
              ]
            },
            "label": {
              "type": "string"
            },
            "count": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "totalCents": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "Amount in integer US cents (zero or more)"
            },
            "orders": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "orderNumber": {
                    "type": "string"
                  },
                  "accountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  },
                  "siteId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Delivery site"
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "stage": {
                    "type": "string",
                    "enum": [
                      "received",
                      "in_build",
                      "ready_to_ship",
                      "shipped",
                      "delivered",
                      "set_up",
                      "commissioned",
                      "trained",
                      "closed"
                    ]
                  },
                  "stageDates": {
                    "type": "object",
                    "properties": {
                      "received": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "in_build": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "ready_to_ship": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "shipped": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "delivered": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "set_up": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "commissioned": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "trained": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "closed": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date",
                            "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])))$",
                            "description": "Date as YYYY-MM-DD"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "received",
                      "in_build",
                      "ready_to_ship",
                      "shipped",
                      "delivered",
                      "set_up",
                      "commissioned",
                      "trained",
                      "closed"
                    ],
                    "additionalProperties": false,
                    "description": "Date each stage was reached; null if not yet"
                  },
                  "signedQuoteDocumentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "signedQuoteReceivedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "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])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "totalCents": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "description": "Amount in integer US cents (zero or more)"
                  },
                  "balanceRemainingCents": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "description": "Amount in integer US cents (zero or more)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Null until someone records it; 0 means paid in full"
                  },
                  "isValid": {
                    "type": "boolean"
                  },
                  "financingPartner": {
                    "type": "string",
                    "enum": [
                      "none",
                      "commercial_capital",
                      "northland_capital",
                      "other"
                    ]
                  },
                  "financingStatus": {
                    "type": "string",
                    "enum": [
                      "not_applicable",
                      "pending",
                      "approved",
                      "declined",
                      "funded"
                    ]
                  },
                  "financingNotes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "poNumber": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "expectedShipOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "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])))$",
                        "description": "Date as YYYY-MM-DD"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ownerUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64,
                        "description": "Record id (UUID)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "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"
                  },
                  "updatedAt": {
                    "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"
                  },
                  "siteName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "missing": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "signed_quote",
                        "signed_quote_received_on",
                        "balance_remaining"
                      ]
                    }
                  },
                  "nextStage": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "received",
                          "in_build",
                          "ready_to_ship",
                          "shipped",
                          "delivered",
                          "set_up",
                          "commissioned",
                          "trained",
                          "closed"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lineCount": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "machineCount": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "id",
                  "orderNumber",
                  "accountId",
                  "siteId",
                  "title",
                  "stage",
                  "stageDates",
                  "signedQuoteDocumentId",
                  "signedQuoteReceivedOn",
                  "totalCents",
                  "balanceRemainingCents",
                  "isValid",
                  "financingPartner",
                  "financingStatus",
                  "financingNotes",
                  "poNumber",
                  "expectedShipOn",
                  "ownerUserId",
                  "notes",
                  "createdAt",
                  "updatedAt",
                  "accountName",
                  "siteName",
                  "missing",
                  "nextStage",
                  "lineCount",
                  "machineCount"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "stage",
            "label",
            "count",
            "totalCents",
            "orders"
          ],
          "additionalProperties": false
        },
        "description": "One column per stage, in lifecycle order"
      },
      "openCount": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      },
      "invalidCount": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991,
        "description": "Open orders that are not yet valid"
      }
    },
    "required": [
      "columns",
      "openCount",
      "invalidCount"
    ],
    "additionalProperties": false
  }
}
            

orders.get

Get an order

Kind
Read
Who
Staff: admin, editor, viewer
MCP tool
orders_get
In-chat view
ui://cemco/order.html

One order by id or order number: the valid-order checklist, the nine-stage timeline with dates and who moved it, balance remaining, financing, line items, linked documents, the machines built for it, and its account and site.

Input (object)

FieldTypeDescription
idstringRecord id (UUID)min length 1, max length 64
orderNumberstringmax length 40

Output (object)

FieldTypeDescription
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountNamerequiredstring
siteNamerequiredstring | null
missingrequired("signed_quote" | "signed_quote_received_on" | "balance_remaining")[]
nextStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed" | null
lineCountrequiredintegermin -9007199254740991, max 9007199254740991
machineCountrequiredintegermin -9007199254740991, max 9007199254740991
validityrequiredobject
isValidrequiredbooleanTrue when the order has the signed quote, its received date and the balance remaining
missingrequired("signed_quote" | "signed_quote_received_on" | "balance_remaining")[]Requirements still missing; empty when valid
missingLabelsrequiredstring[]Human-readable names of the missing requirements
linesrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
orderIdrequiredstringRecord id (UUID)min length 1, max length 64
productIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
skurequiredstring | null
descriptionrequiredstring
quantityrequiredintegermin 1, max 9007199254740991
unitPriceCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
positionrequiredintegermin -9007199254740991, max 9007199254740991
eventsrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
orderIdrequiredstringRecord id (UUID)min length 1, max length 64
fromStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed" | null
toStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
occurredOnrequiredstring (date)Date as YYYY-MM-DD
noterequiredstring | null
actorUserIdrequiredstring | null
actorNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
timelinerequiredobject[]All nine stages in order with state and date
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
labelrequiredstring
staterequired"done" | "current" | "upcoming"
daterequiredstring (date) | nullDate as YYYY-MM-DD
ownerNamerequiredstring | nullWho moved the order into this stage
documentsrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
kindrequired"signed_quote" | "quote" | "purchase_order" | "drawing" | "manual" | "inspection_report" | "photo" | "training_record" | "invoice" | "email_attachment" | "export" | "other"
titlerequiredstring
filenamerequiredstring
contentTyperequiredstring
sizeBytesrequiredintegermin 0, max 9007199254740991
statusrequired"pending" | "stored"pending until the file bytes are stored
accountIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
customerVisiblerequiredbooleanWhether the customer can open it in the portal
sourcerequired"upload" | "email" | "portal" | "system" | "import"
linksrequiredobject[]
entityTyperequired"account" | "contact" | "site" | "order" | "machine" | "ticket" | "warranty_claim" | "parts_order" | "part" | "opportunity" | "check_in"
entityIdrequiredstringRecord id (UUID)min length 1, max length 64
uploadedByNamerequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
machinesrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
serialNumberrequiredstring
typerequired"plant" | "mixer" | "silo" | "feeder" | "power_pack"
modelrequiredstring
configurationrequiredstring | null
optionsrequiredstring[]
accountIdrequiredstringCurrent ownermin length 1, max length 64
siteIdrequiredstring | nullCurrent sitemin length 1, max length 64
orderIdrequiredstring | nullOrder the machine was built formin length 1, max length 64
productIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
statusrequired"in_build" | "in_transit" | "operating" | "down" | "idle" | "retired"
builtOnrequiredstring (date) | nullDate as YYYY-MM-DD
shippedOnrequiredstring (date) | nullDate as YYYY-MM-DD
commissionedOnrequiredstring (date) | nullDate as YYYY-MM-DD
warrantyStartrequiredstring (date) | nullDate as YYYY-MM-DD
warrantyEndrequiredstring (date) | nullDate as YYYY-MM-DD
warrantyStaterequired"none" | "active" | "expiring" | "expired"Computed from the warranty dates and today's date
warrantyDaysLeftrequiredinteger | nullDays until the warranty ends; negative once expired; null if not startedmin -9007199254740991, max 9007199254740991
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
accountrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
namerequiredstring
normalizedNamerequiredstringLower-cased name without punctuation or company suffixes; used for duplicate checks
segmentrequired"concrete_producer" | "multiservice"
statusrequired"active" | "prospect" | "inactive"
phonerequiredstring | null
websiterequiredstring | null
hqLine1requiredstring | null
hqLine2requiredstring | null
hqCityrequiredstring | null
hqStaterequiredstring | nullTwo-letter US state or region code
hqPostalCoderequiredstring | null
hqCountryrequiredstring | null
hubspotCompanyIdrequiredstring | null
ownerUserIdrequiredstring | nullStaff user who owns the accountmin length 1, max length 64
notesrequiredstring | null
lastContactedAtrequiredstring (date-time) | nullMost recent call, email, text or visit
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
siterequiredobject | null
idrequiredstringRecord id (UUID)min length 1, max length 64
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
namerequiredstring
line1requiredstring | null
line2requiredstring | null
cityrequiredstring | null
staterequiredstring | null
postalCoderequiredstring | null
countryrequiredstring | null
latituderequirednumber | nullmin -90, max 90
longituderequirednumber | nullmin -180, max 180
powerSourcerequiredstring | nullFor example utility 480V three-phase, or generator
waterSourcerequiredstring | nullFor example municipal, well, hauled
activeFromrequiredstring (date) | nullDate as YYYY-MM-DD
activeTorequiredstring (date) | nullSet when the site is no longer used
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
Example request
                curl https://api.cemco.app/v1/ops/orders.get \
  -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)"
      },
      "orderNumber": {
        "type": "string",
        "maxLength": 40
      }
    }
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "orderNumber": {
        "type": "string"
      },
      "accountId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "siteId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ],
        "description": "Delivery site"
      },
      "title": {
        "type": [
          "string",
          "null"
        ]
      },
      "stage": {
        "type": "string",
        "enum": [
          "received",
          "in_build",
          "ready_to_ship",
          "shipped",
          "delivered",
          "set_up",
          "commissioned",
          "trained",
          "closed"
        ]
      },
      "stageDates": {
        "type": "object",
        "properties": {
          "received": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "in_build": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ready_to_ship": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "shipped": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "delivered": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "set_up": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "commissioned": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "trained": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "closed": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "received",
          "in_build",
          "ready_to_ship",
          "shipped",
          "delivered",
          "set_up",
          "commissioned",
          "trained",
          "closed"
        ],
        "additionalProperties": false,
        "description": "Date each stage was reached; null if not yet"
      },
      "signedQuoteDocumentId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "signedQuoteReceivedOn": {
        "anyOf": [
          {
            "type": "string",
            "format": "date",
            "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])))$",
            "description": "Date as YYYY-MM-DD"
          },
          {
            "type": "null"
          }
        ]
      },
      "totalCents": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991,
        "description": "Amount in integer US cents (zero or more)"
      },
      "balanceRemainingCents": {
        "anyOf": [
          {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          {
            "type": "null"
          }
        ],
        "description": "Null until someone records it; 0 means paid in full"
      },
      "isValid": {
        "type": "boolean"
      },
      "financingPartner": {
        "type": "string",
        "enum": [
          "none",
          "commercial_capital",
          "northland_capital",
          "other"
        ]
      },
      "financingStatus": {
        "type": "string",
        "enum": [
          "not_applicable",
          "pending",
          "approved",
          "declined",
          "funded"
        ]
      },
      "financingNotes": {
        "type": [
          "string",
          "null"
        ]
      },
      "poNumber": {
        "type": [
          "string",
          "null"
        ]
      },
      "expectedShipOn": {
        "anyOf": [
          {
            "type": "string",
            "format": "date",
            "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])))$",
            "description": "Date as YYYY-MM-DD"
          },
          {
            "type": "null"
          }
        ]
      },
      "ownerUserId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "notes": {
        "type": [
          "string",
          "null"
        ]
      },
      "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"
      },
      "updatedAt": {
        "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"
      },
      "siteName": {
        "type": [
          "string",
          "null"
        ]
      },
      "missing": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "signed_quote",
            "signed_quote_received_on",
            "balance_remaining"
          ]
        }
      },
      "nextStage": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "lineCount": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      },
      "machineCount": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      },
      "validity": {
        "type": "object",
        "properties": {
          "isValid": {
            "type": "boolean",
            "description": "True when the order has the signed quote, its received date and the balance remaining"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "signed_quote",
                "signed_quote_received_on",
                "balance_remaining"
              ]
            },
            "description": "Requirements still missing; empty when valid"
          },
          "missingLabels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Human-readable names of the missing requirements"
          }
        },
        "required": [
          "isValid",
          "missing",
          "missingLabels"
        ],
        "additionalProperties": false
      },
      "lines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "orderId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "productId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "sku": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": {
              "type": "string"
            },
            "quantity": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "unitPriceCents": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "Amount in integer US cents (zero or more)"
            },
            "totalCents": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "Amount in integer US cents (zero or more)"
            },
            "position": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "id",
            "orderId",
            "productId",
            "sku",
            "description",
            "quantity",
            "unitPriceCents",
            "totalCents",
            "position"
          ],
          "additionalProperties": false
        }
      },
      "events": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "orderId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "fromStage": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "received",
                    "in_build",
                    "ready_to_ship",
                    "shipped",
                    "delivered",
                    "set_up",
                    "commissioned",
                    "trained",
                    "closed"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "toStage": {
              "type": "string",
              "enum": [
                "received",
                "in_build",
                "ready_to_ship",
                "shipped",
                "delivered",
                "set_up",
                "commissioned",
                "trained",
                "closed"
              ]
            },
            "occurredOn": {
              "type": "string",
              "format": "date",
              "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])))$",
              "description": "Date as YYYY-MM-DD"
            },
            "note": {
              "type": [
                "string",
                "null"
              ]
            },
            "actorUserId": {
              "type": [
                "string",
                "null"
              ]
            },
            "actorName": {
              "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",
            "orderId",
            "fromStage",
            "toStage",
            "occurredOn",
            "note",
            "actorUserId",
            "actorName",
            "createdAt"
          ],
          "additionalProperties": false
        }
      },
      "timeline": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "stage": {
              "type": "string",
              "enum": [
                "received",
                "in_build",
                "ready_to_ship",
                "shipped",
                "delivered",
                "set_up",
                "commissioned",
                "trained",
                "closed"
              ]
            },
            "label": {
              "type": "string"
            },
            "state": {
              "type": "string",
              "enum": [
                "done",
                "current",
                "upcoming"
              ]
            },
            "date": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "ownerName": {
              "description": "Who moved the order into this stage",
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "stage",
            "label",
            "state",
            "date",
            "ownerName"
          ],
          "additionalProperties": false
        },
        "description": "All nine stages in order with state and date"
      },
      "documents": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "kind": {
              "type": "string",
              "enum": [
                "signed_quote",
                "quote",
                "purchase_order",
                "drawing",
                "manual",
                "inspection_report",
                "photo",
                "training_record",
                "invoice",
                "email_attachment",
                "export",
                "other"
              ]
            },
            "title": {
              "type": "string"
            },
            "filename": {
              "type": "string"
            },
            "contentType": {
              "type": "string"
            },
            "sizeBytes": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "status": {
              "type": "string",
              "enum": [
                "pending",
                "stored"
              ],
              "description": "pending until the file bytes are stored"
            },
            "accountId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "customerVisible": {
              "type": "boolean",
              "description": "Whether the customer can open it in the portal"
            },
            "source": {
              "type": "string",
              "enum": [
                "upload",
                "email",
                "portal",
                "system",
                "import"
              ]
            },
            "links": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "entityType": {
                    "type": "string",
                    "enum": [
                      "account",
                      "contact",
                      "site",
                      "order",
                      "machine",
                      "ticket",
                      "warranty_claim",
                      "parts_order",
                      "part",
                      "opportunity",
                      "check_in"
                    ]
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "Record id (UUID)"
                  }
                },
                "required": [
                  "entityType",
                  "entityId"
                ],
                "additionalProperties": false
              }
            },
            "uploadedByName": {
              "type": [
                "string",
                "null"
              ]
            },
            "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",
            "kind",
            "title",
            "filename",
            "contentType",
            "sizeBytes",
            "status",
            "accountId",
            "customerVisible",
            "source",
            "links",
            "uploadedByName",
            "createdAt"
          ],
          "additionalProperties": false
        }
      },
      "machines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "serialNumber": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "plant",
                "mixer",
                "silo",
                "feeder",
                "power_pack"
              ]
            },
            "model": {
              "type": "string"
            },
            "configuration": {
              "type": [
                "string",
                "null"
              ]
            },
            "options": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "accountId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Current owner"
            },
            "siteId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Current site"
            },
            "orderId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Order the machine was built for"
            },
            "productId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "in_build",
                "in_transit",
                "operating",
                "down",
                "idle",
                "retired"
              ]
            },
            "builtOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "shippedOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "commissionedOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "warrantyStart": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "warrantyEnd": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "warrantyState": {
              "type": "string",
              "enum": [
                "none",
                "active",
                "expiring",
                "expired"
              ],
              "description": "Computed from the warranty dates and today's date"
            },
            "warrantyDaysLeft": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ],
              "description": "Days until the warranty ends; negative once expired; null if not started"
            },
            "notes": {
              "type": [
                "string",
                "null"
              ]
            },
            "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"
            },
            "updatedAt": {
              "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",
            "serialNumber",
            "type",
            "model",
            "configuration",
            "options",
            "accountId",
            "siteId",
            "orderId",
            "productId",
            "status",
            "builtOn",
            "shippedOn",
            "commissionedOn",
            "warrantyStart",
            "warrantyEnd",
            "warrantyState",
            "warrantyDaysLeft",
            "notes",
            "createdAt",
            "updatedAt"
          ],
          "additionalProperties": false
        }
      },
      "account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "name": {
            "type": "string"
          },
          "normalizedName": {
            "type": "string",
            "description": "Lower-cased name without punctuation or company suffixes; used for duplicate checks"
          },
          "segment": {
            "type": "string",
            "enum": [
              "concrete_producer",
              "multiservice"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "prospect",
              "inactive"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "hqLine1": {
            "type": [
              "string",
              "null"
            ]
          },
          "hqLine2": {
            "type": [
              "string",
              "null"
            ]
          },
          "hqCity": {
            "type": [
              "string",
              "null"
            ]
          },
          "hqState": {
            "description": "Two-letter US state or region code",
            "type": [
              "string",
              "null"
            ]
          },
          "hqPostalCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "hqCountry": {
            "type": [
              "string",
              "null"
            ]
          },
          "hubspotCompanyId": {
            "type": [
              "string",
              "null"
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Staff user who owns the account"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastContactedAt": {
            "anyOf": [
              {
                "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"
              },
              {
                "type": "null"
              }
            ],
            "description": "Most recent call, email, text or visit"
          },
          "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"
          },
          "updatedAt": {
            "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",
          "name",
          "normalizedName",
          "segment",
          "status",
          "phone",
          "website",
          "hqLine1",
          "hqLine2",
          "hqCity",
          "hqState",
          "hqPostalCode",
          "hqCountry",
          "hubspotCompanyId",
          "ownerUserId",
          "notes",
          "lastContactedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "site": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              "name": {
                "type": "string"
              },
              "line1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "line2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "postalCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "latitude": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "longitude": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "powerSource": {
                "description": "For example utility 480V three-phase, or generator",
                "type": [
                  "string",
                  "null"
                ]
              },
              "waterSource": {
                "description": "For example municipal, well, hauled",
                "type": [
                  "string",
                  "null"
                ]
              },
              "activeFrom": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "activeTo": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Set when the site is no longer used"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "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"
              },
              "updatedAt": {
                "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",
              "accountId",
              "name",
              "line1",
              "line2",
              "city",
              "state",
              "postalCode",
              "country",
              "latitude",
              "longitude",
              "powerSource",
              "waterSource",
              "activeFrom",
              "activeTo",
              "notes",
              "createdAt",
              "updatedAt"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "id",
      "orderNumber",
      "accountId",
      "siteId",
      "title",
      "stage",
      "stageDates",
      "signedQuoteDocumentId",
      "signedQuoteReceivedOn",
      "totalCents",
      "balanceRemainingCents",
      "isValid",
      "financingPartner",
      "financingStatus",
      "financingNotes",
      "poNumber",
      "expectedShipOn",
      "ownerUserId",
      "notes",
      "createdAt",
      "updatedAt",
      "accountName",
      "siteName",
      "missing",
      "nextStage",
      "lineCount",
      "machineCount",
      "validity",
      "lines",
      "events",
      "timeline",
      "documents",
      "machines",
      "account",
      "site"
    ],
    "additionalProperties": false
  }
}
            

orders.create

Create a production order

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

Open a production order for an account at stage received. The order number is assigned automatically unless given. Lines can be added now or later. The order stays not valid, and cannot leave received, until it has the signed quote document, the date it was received and the balance remaining.

Input (object)

FieldTypeDescription
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdstring | nullDelivery sitemin length 1, max length 64
orderNumberstringmin length 1, max length 40
titlestring | nullmax length 200
receivedOnstring (date)Date the production order arrived; defaults to today
poNumberstring | nullmax length 60
expectedShipOnstring (date) | nullDate as YYYY-MM-DD
balanceRemainingCentsinteger | nullAmount in integer US cents (zero or more)min 0, max 9007199254740991
signedQuoteReceivedOnstring (date) | nullDate as YYYY-MM-DD
financingPartner"none" | "commercial_capital" | "northland_capital" | "other"default "none"
financingStatus"not_applicable" | "pending" | "approved" | "declined" | "funded"default "not_applicable"
ownerUserIdstring | nullDefaults to the callermin length 1, max length 64
notesstring | nullmax length 20000
linesobject[]default []
productIdstringProduct from the 2026.11 price list; fills sku, description and price when givenmin length 1, max length 64
descriptionstringRequired when there is no productIdmin length 1, max length 500
quantityintegerdefault 1, min 1, max 9007199254740991
unitPriceCentsintegerOverrides the list pricemin 0, max 9007199254740991

Output (object)

FieldTypeDescription
orderrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
linesrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
orderIdrequiredstringRecord id (UUID)min length 1, max length 64
productIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
skurequiredstring | null
descriptionrequiredstring
quantityrequiredintegermin 1, max 9007199254740991
unitPriceCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
positionrequiredintegermin -9007199254740991, max 9007199254740991
validityrequiredobject
isValidrequiredbooleanTrue when the order has the signed quote, its received date and the balance remaining
missingrequired("signed_quote" | "signed_quote_received_on" | "balance_remaining")[]Requirements still missing; empty when valid
missingLabelsrequiredstring[]Human-readable names of the missing requirements
Example request
                curl https://api.cemco.app/v1/ops/orders.create \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"accountId":"00000000-0000-4000-8000-000000000000"}'
              
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)"
      },
      "siteId": {
        "description": "Delivery site",
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "orderNumber": {
        "type": "string",
        "minLength": 1,
        "maxLength": 40
      },
      "title": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 200
          },
          {
            "type": "null"
          }
        ]
      },
      "receivedOn": {
        "description": "Date the production order arrived; defaults to today",
        "type": "string",
        "format": "date",
        "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])))$"
      },
      "poNumber": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 60
          },
          {
            "type": "null"
          }
        ]
      },
      "expectedShipOn": {
        "anyOf": [
          {
            "type": "string",
            "format": "date",
            "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])))$",
            "description": "Date as YYYY-MM-DD"
          },
          {
            "type": "null"
          }
        ]
      },
      "balanceRemainingCents": {
        "anyOf": [
          {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          {
            "type": "null"
          }
        ]
      },
      "signedQuoteReceivedOn": {
        "anyOf": [
          {
            "type": "string",
            "format": "date",
            "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])))$",
            "description": "Date as YYYY-MM-DD"
          },
          {
            "type": "null"
          }
        ]
      },
      "financingPartner": {
        "default": "none",
        "type": "string",
        "enum": [
          "none",
          "commercial_capital",
          "northland_capital",
          "other"
        ]
      },
      "financingStatus": {
        "default": "not_applicable",
        "type": "string",
        "enum": [
          "not_applicable",
          "pending",
          "approved",
          "declined",
          "funded"
        ]
      },
      "ownerUserId": {
        "description": "Defaults to the caller",
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "notes": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 20000
          },
          {
            "type": "null"
          }
        ]
      },
      "lines": {
        "default": [],
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "productId": {
              "description": "Product from the 2026.11 price list; fills sku, description and price when given",
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "description": {
              "description": "Required when there is no productId",
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "quantity": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "unitPriceCents": {
              "description": "Overrides the list price",
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        }
      }
    },
    "required": [
      "accountId"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
          },
          "updatedAt": {
            "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",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "lines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "orderId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "productId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "sku": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": {
              "type": "string"
            },
            "quantity": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "unitPriceCents": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "Amount in integer US cents (zero or more)"
            },
            "totalCents": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "Amount in integer US cents (zero or more)"
            },
            "position": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "id",
            "orderId",
            "productId",
            "sku",
            "description",
            "quantity",
            "unitPriceCents",
            "totalCents",
            "position"
          ],
          "additionalProperties": false
        }
      },
      "validity": {
        "type": "object",
        "properties": {
          "isValid": {
            "type": "boolean",
            "description": "True when the order has the signed quote, its received date and the balance remaining"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "signed_quote",
                "signed_quote_received_on",
                "balance_remaining"
              ]
            },
            "description": "Requirements still missing; empty when valid"
          },
          "missingLabels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Human-readable names of the missing requirements"
          }
        },
        "required": [
          "isValid",
          "missing",
          "missingLabels"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "order",
      "lines",
      "validity"
    ],
    "additionalProperties": false
  }
}
            

orders.update

Update an order

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

Change order fields: delivery site, title, PO number, expected ship date, balance remaining, the signed-quote received date, owner or notes. Only the fields you send are changed. This does not change the stage (use orders.advance) or attach the signed quote file (use orders.attach_signed_quote). Returns the new validity.

Input (object)

FieldTypeDescription
idrequiredstringRecord id (UUID)min length 1, max length 64
siteIdstring | nullRecord id (UUID)min length 1, max length 64
titlestring | nullmax length 200
poNumberstring | nullmax length 60
expectedShipOnstring (date) | nullDate as YYYY-MM-DD
balanceRemainingCentsinteger | null0 means paid in full; null clears itmin 0, max 9007199254740991
signedQuoteReceivedOnstring (date) | nullDate as YYYY-MM-DD
ownerUserIdstring | nullRecord id (UUID)min length 1, max length 64
notesstring | nullmax length 20000
stageDateobjectCorrect the date of a stage the order has already reached
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
daterequiredstring (date)Date as YYYY-MM-DD

Output (object)

FieldTypeDescription
orderrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
validityrequiredobject
isValidrequiredbooleanTrue when the order has the signed quote, its received date and the balance remaining
missingrequired("signed_quote" | "signed_quote_received_on" | "balance_remaining")[]Requirements still missing; empty when valid
missingLabelsrequiredstring[]Human-readable names of the missing requirements
Example request
                curl https://api.cemco.app/v1/ops/orders.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)"
      },
      "siteId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "title": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 200
          },
          {
            "type": "null"
          }
        ]
      },
      "poNumber": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 60
          },
          {
            "type": "null"
          }
        ]
      },
      "expectedShipOn": {
        "anyOf": [
          {
            "type": "string",
            "format": "date",
            "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])))$",
            "description": "Date as YYYY-MM-DD"
          },
          {
            "type": "null"
          }
        ]
      },
      "balanceRemainingCents": {
        "description": "0 means paid in full; null clears it",
        "anyOf": [
          {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          {
            "type": "null"
          }
        ]
      },
      "signedQuoteReceivedOn": {
        "anyOf": [
          {
            "type": "string",
            "format": "date",
            "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])))$",
            "description": "Date as YYYY-MM-DD"
          },
          {
            "type": "null"
          }
        ]
      },
      "ownerUserId": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          {
            "type": "null"
          }
        ]
      },
      "notes": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 20000
          },
          {
            "type": "null"
          }
        ]
      },
      "stageDate": {
        "description": "Correct the date of a stage the order has already reached",
        "type": "object",
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "date": {
            "type": "string",
            "format": "date",
            "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])))$",
            "description": "Date as YYYY-MM-DD"
          }
        },
        "required": [
          "stage",
          "date"
        ]
      }
    },
    "required": [
      "id"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
          },
          "updatedAt": {
            "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",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "validity": {
        "type": "object",
        "properties": {
          "isValid": {
            "type": "boolean",
            "description": "True when the order has the signed quote, its received date and the balance remaining"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "signed_quote",
                "signed_quote_received_on",
                "balance_remaining"
              ]
            },
            "description": "Requirements still missing; empty when valid"
          },
          "missingLabels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Human-readable names of the missing requirements"
          }
        },
        "required": [
          "isValid",
          "missing",
          "missingLabels"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "order",
      "validity"
    ],
    "additionalProperties": false
  }
}
            

orders.add_line

Add a line item to an order

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

Add one line to an order, normally a product from the 2026.11 equipment price list (give productId), or a free-text line with a description and unit price. The order total is recalculated.

Input (object)

FieldTypeDescription
productIdstringProduct from the 2026.11 price list; fills sku, description and price when givenmin length 1, max length 64
descriptionstringRequired when there is no productIdmin length 1, max length 500
quantityintegerdefault 1, min 1, max 9007199254740991
unitPriceCentsintegerOverrides the list pricemin 0, max 9007199254740991
orderIdrequiredstringRecord id (UUID)min length 1, max length 64

Output (object)

FieldTypeDescription
linerequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderIdrequiredstringRecord id (UUID)min length 1, max length 64
productIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
skurequiredstring | null
descriptionrequiredstring
quantityrequiredintegermin 1, max 9007199254740991
unitPriceCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
positionrequiredintegermin -9007199254740991, max 9007199254740991
orderrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
Example request
                curl https://api.cemco.app/v1/ops/orders.add_line \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"orderId":"00000000-0000-4000-8000-000000000000"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "productId": {
        "description": "Product from the 2026.11 price list; fills sku, description and price when given",
        "type": "string",
        "minLength": 1,
        "maxLength": 64
      },
      "description": {
        "description": "Required when there is no productId",
        "type": "string",
        "minLength": 1,
        "maxLength": 500
      },
      "quantity": {
        "default": 1,
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "unitPriceCents": {
        "description": "Overrides the list price",
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      },
      "orderId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      }
    },
    "required": [
      "orderId"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "line": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "productId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "unitPriceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "position": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "orderId",
          "productId",
          "sku",
          "description",
          "quantity",
          "unitPriceCents",
          "totalCents",
          "position"
        ],
        "additionalProperties": false
      },
      "order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
          },
          "updatedAt": {
            "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",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "line",
      "order"
    ],
    "additionalProperties": false
  }
}
            

orders.update_line

Change an order line

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

Change the quantity, unit price or description of an order line. The order total is recalculated.

Input (object)

FieldTypeDescription
lineIdrequiredstringRecord id (UUID)min length 1, max length 64
quantityintegermin 1, max 9007199254740991
unitPriceCentsintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
descriptionstringmin length 1, max length 500

Output (object)

FieldTypeDescription
linerequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderIdrequiredstringRecord id (UUID)min length 1, max length 64
productIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
skurequiredstring | null
descriptionrequiredstring
quantityrequiredintegermin 1, max 9007199254740991
unitPriceCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
positionrequiredintegermin -9007199254740991, max 9007199254740991
orderrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
Example request
                curl https://api.cemco.app/v1/ops/orders.update_line \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"lineId":"00000000-0000-4000-8000-000000000000"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "lineId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "quantity": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "unitPriceCents": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991,
        "description": "Amount in integer US cents (zero or more)"
      },
      "description": {
        "type": "string",
        "minLength": 1,
        "maxLength": 500
      }
    },
    "required": [
      "lineId"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "line": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "productId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "unitPriceCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "position": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "orderId",
          "productId",
          "sku",
          "description",
          "quantity",
          "unitPriceCents",
          "totalCents",
          "position"
        ],
        "additionalProperties": false
      },
      "order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
          },
          "updatedAt": {
            "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",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "line",
      "order"
    ],
    "additionalProperties": false
  }
}
            

orders.remove_line

Remove an order line

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

Delete one line from an order and recalculate the total.

Input (object)

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

Output (object)

FieldTypeDescription
okrequiredtrue
idrequiredstringRecord id (UUID)min length 1, max length 64
orderrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
Example request
                curl https://api.cemco.app/v1/ops/orders.remove_line \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"lineId":"00000000-0000-4000-8000-000000000000"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "lineId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      }
    },
    "required": [
      "lineId"
    ]
  },
  "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)"
      },
      "order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
          },
          "updatedAt": {
            "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",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "ok",
      "id",
      "order"
    ],
    "additionalProperties": false
  }
}
            

orders.attach_signed_quote

Attach the signed quote to an order

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

Record the customer's signed quote on an order. Either point at a document already uploaded (documentId) or send the file inline (file). Sets the signed-quote received date (today unless receivedOn is given) and, optionally, the balance remaining, so one call can make the order valid. Returns the new validity.

Input (object)

FieldTypeDescription
orderIdrequiredstringRecord id (UUID)min length 1, max length 64
documentIdstringAn existing document to use as the signed quotemin length 1, max length 64
fileobjectUpload the signed quote in this call instead
filenamerequiredstringmin length 1, max length 255
contentTypestringdefault "application/pdf", max length 100
contentBase64requiredstringFile bytes, base64 encoded (max 10 MB)min length 1
receivedOnstring (date)Date the signed quote was received; defaults to today
balanceRemainingCentsintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991

Output (object)

FieldTypeDescription
orderrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
documentIdrequiredstringRecord id (UUID)min length 1, max length 64
validityrequiredobject
isValidrequiredbooleanTrue when the order has the signed quote, its received date and the balance remaining
missingrequired("signed_quote" | "signed_quote_received_on" | "balance_remaining")[]Requirements still missing; empty when valid
missingLabelsrequiredstring[]Human-readable names of the missing requirements
Example request
                curl https://api.cemco.app/v1/ops/orders.attach_signed_quote \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"orderId":"00000000-0000-4000-8000-000000000000","documentId":"00000000-0000-4000-8000-000000000000"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "orderId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "documentId": {
        "description": "An existing document to use as the signed quote",
        "type": "string",
        "minLength": 1,
        "maxLength": 64
      },
      "file": {
        "description": "Upload the signed quote in this call instead",
        "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"
        ]
      },
      "receivedOn": {
        "description": "Date the signed quote was received; defaults to today",
        "type": "string",
        "format": "date",
        "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])))$"
      },
      "balanceRemainingCents": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991,
        "description": "Amount in integer US cents (zero or more)"
      }
    },
    "required": [
      "orderId"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
          },
          "updatedAt": {
            "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",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "documentId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "validity": {
        "type": "object",
        "properties": {
          "isValid": {
            "type": "boolean",
            "description": "True when the order has the signed quote, its received date and the balance remaining"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "signed_quote",
                "signed_quote_received_on",
                "balance_remaining"
              ]
            },
            "description": "Requirements still missing; empty when valid"
          },
          "missingLabels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Human-readable names of the missing requirements"
          }
        },
        "required": [
          "isValid",
          "missing",
          "missingLabels"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "order",
      "documentId",
      "validity"
    ],
    "additionalProperties": false
  }
}
            

orders.advance

Advance an order to the next stage

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

Move an order one step along the lifecycle: received, in_build, ready_to_ship, shipped, delivered, set_up, commissioned, trained, closed. An order cannot leave received until it is valid; otherwise the call fails with an invalid_order error whose details.missing lists what is needed. Each move writes an order event, emails the customer a status update and is audited. Moving to commissioned sets warranty start and end (12 months) on every machine of the order and creates the 30, 90 and 365-day check-ins. Pass toStage to state the stage you expect to reach; the call fails with a conflict if that is not the next stage.

Input (object)

FieldTypeDescription
idrequiredstringRecord id (UUID)min length 1, max length 64
toStage"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"Guard: must equal the next stage
occurredOnstring (date)Date the stage was reached; defaults to today
notestring | nullmax length 2000
notifyCustomerbooleanSend the status email to the account's primary contactdefault true

Output (object)

FieldTypeDescription
orderrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
eventrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderIdrequiredstringRecord id (UUID)min length 1, max length 64
fromStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed" | null
toStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
occurredOnrequiredstring (date)Date as YYYY-MM-DD
noterequiredstring | null
actorUserIdrequiredstring | null
actorNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
fromStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
toStagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
machinesrequiredobject[]Machines whose status or warranty changed
idrequiredstringRecord id (UUID)min length 1, max length 64
serialNumberrequiredstring
typerequired"plant" | "mixer" | "silo" | "feeder" | "power_pack"
modelrequiredstring
configurationrequiredstring | null
optionsrequiredstring[]
accountIdrequiredstringCurrent ownermin length 1, max length 64
siteIdrequiredstring | nullCurrent sitemin length 1, max length 64
orderIdrequiredstring | nullOrder the machine was built formin length 1, max length 64
productIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
statusrequired"in_build" | "in_transit" | "operating" | "down" | "idle" | "retired"
builtOnrequiredstring (date) | nullDate as YYYY-MM-DD
shippedOnrequiredstring (date) | nullDate as YYYY-MM-DD
commissionedOnrequiredstring (date) | nullDate as YYYY-MM-DD
warrantyStartrequiredstring (date) | nullDate as YYYY-MM-DD
warrantyEndrequiredstring (date) | nullDate as YYYY-MM-DD
warrantyStaterequired"none" | "active" | "expiring" | "expired"Computed from the warranty dates and today's date
warrantyDaysLeftrequiredinteger | nullDays until the warranty ends; negative once expired; null if not startedmin -9007199254740991, max 9007199254740991
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
checkInsrequiredobject[]Check-ins created (only when moving to commissioned)
idrequiredstringRecord id (UUID)min length 1, max length 64
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
machineIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
orderIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
kindrequired"day_30" | "day_90" | "day_365" | "pre_season" | "ad_hoc"
dueOnrequiredstring (date)Date as YYYY-MM-DD
statusrequired"scheduled" | "completed" | "skipped"
completedOnrequiredstring (date) | nullDate as YYYY-MM-DD
outcomerequiredstring | nullWhat was learned on the call or visit
taskIdrequiredstring | nullTask that puts the check-in on the agenda and calendarmin length 1, max length 64
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
emailQueuedrequiredboolean
Example request
                curl https://api.cemco.app/v1/ops/orders.advance \
  -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)"
      },
      "toStage": {
        "description": "Guard: must equal the next stage",
        "type": "string",
        "enum": [
          "received",
          "in_build",
          "ready_to_ship",
          "shipped",
          "delivered",
          "set_up",
          "commissioned",
          "trained",
          "closed"
        ]
      },
      "occurredOn": {
        "description": "Date the stage was reached; defaults to today",
        "type": "string",
        "format": "date",
        "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])))$"
      },
      "note": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 2000
          },
          {
            "type": "null"
          }
        ]
      },
      "notifyCustomer": {
        "default": true,
        "description": "Send the status email to the account's primary contact",
        "type": "boolean"
      }
    },
    "required": [
      "id"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
          },
          "updatedAt": {
            "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",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "fromStage": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "received",
                  "in_build",
                  "ready_to_ship",
                  "shipped",
                  "delivered",
                  "set_up",
                  "commissioned",
                  "trained",
                  "closed"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "toStage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "occurredOn": {
            "type": "string",
            "format": "date",
            "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])))$",
            "description": "Date as YYYY-MM-DD"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "actorUserId": {
            "type": [
              "string",
              "null"
            ]
          },
          "actorName": {
            "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",
          "orderId",
          "fromStage",
          "toStage",
          "occurredOn",
          "note",
          "actorUserId",
          "actorName",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "fromStage": {
        "type": "string",
        "enum": [
          "received",
          "in_build",
          "ready_to_ship",
          "shipped",
          "delivered",
          "set_up",
          "commissioned",
          "trained",
          "closed"
        ]
      },
      "toStage": {
        "type": "string",
        "enum": [
          "received",
          "in_build",
          "ready_to_ship",
          "shipped",
          "delivered",
          "set_up",
          "commissioned",
          "trained",
          "closed"
        ]
      },
      "machines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "serialNumber": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "plant",
                "mixer",
                "silo",
                "feeder",
                "power_pack"
              ]
            },
            "model": {
              "type": "string"
            },
            "configuration": {
              "type": [
                "string",
                "null"
              ]
            },
            "options": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "accountId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Current owner"
            },
            "siteId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Current site"
            },
            "orderId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Order the machine was built for"
            },
            "productId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "in_build",
                "in_transit",
                "operating",
                "down",
                "idle",
                "retired"
              ]
            },
            "builtOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "shippedOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "commissionedOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "warrantyStart": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "warrantyEnd": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "warrantyState": {
              "type": "string",
              "enum": [
                "none",
                "active",
                "expiring",
                "expired"
              ],
              "description": "Computed from the warranty dates and today's date"
            },
            "warrantyDaysLeft": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ],
              "description": "Days until the warranty ends; negative once expired; null if not started"
            },
            "notes": {
              "type": [
                "string",
                "null"
              ]
            },
            "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"
            },
            "updatedAt": {
              "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",
            "serialNumber",
            "type",
            "model",
            "configuration",
            "options",
            "accountId",
            "siteId",
            "orderId",
            "productId",
            "status",
            "builtOn",
            "shippedOn",
            "commissionedOn",
            "warrantyStart",
            "warrantyEnd",
            "warrantyState",
            "warrantyDaysLeft",
            "notes",
            "createdAt",
            "updatedAt"
          ],
          "additionalProperties": false
        },
        "description": "Machines whose status or warranty changed"
      },
      "checkIns": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "accountId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "Record id (UUID)"
            },
            "machineId": {
              "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"
                }
              ]
            },
            "kind": {
              "type": "string",
              "enum": [
                "day_30",
                "day_90",
                "day_365",
                "pre_season",
                "ad_hoc"
              ]
            },
            "dueOn": {
              "type": "string",
              "format": "date",
              "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])))$",
              "description": "Date as YYYY-MM-DD"
            },
            "status": {
              "type": "string",
              "enum": [
                "scheduled",
                "completed",
                "skipped"
              ]
            },
            "completedOn": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "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])))$",
                  "description": "Date as YYYY-MM-DD"
                },
                {
                  "type": "null"
                }
              ]
            },
            "outcome": {
              "description": "What was learned on the call or visit",
              "type": [
                "string",
                "null"
              ]
            },
            "taskId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Record id (UUID)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Task that puts the check-in on the agenda and calendar"
            },
            "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"
            },
            "updatedAt": {
              "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",
            "accountId",
            "machineId",
            "orderId",
            "kind",
            "dueOn",
            "status",
            "completedOn",
            "outcome",
            "taskId",
            "createdAt",
            "updatedAt"
          ],
          "additionalProperties": false
        },
        "description": "Check-ins created (only when moving to commissioned)"
      },
      "emailQueued": {
        "type": "boolean"
      }
    },
    "required": [
      "order",
      "event",
      "fromStage",
      "toStage",
      "machines",
      "checkIns",
      "emailQueued"
    ],
    "additionalProperties": false
  }
}
            

orders.set_financing

Set order financing

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

Record the lender for an order (Commercial Capital, Northland Capital, other, or none) and the approval status (pending, approved, declined, funded). There is no link to the lender's systems; this is a record only.

Input (object)

FieldTypeDescription
idrequiredstringRecord id (UUID)min length 1, max length 64
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesstring | nullmax length 2000

Output (object)

FieldTypeDescription
orderrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
orderNumberrequiredstring
accountIdrequiredstringRecord id (UUID)min length 1, max length 64
siteIdrequiredstring | nullDelivery sitemin length 1, max length 64
titlerequiredstring | null
stagerequired"received" | "in_build" | "ready_to_ship" | "shipped" | "delivered" | "set_up" | "commissioned" | "trained" | "closed"
stageDatesrequiredobjectDate each stage was reached; null if not yet
receivedrequiredstring (date) | nullDate as YYYY-MM-DD
in_buildrequiredstring (date) | nullDate as YYYY-MM-DD
ready_to_shiprequiredstring (date) | nullDate as YYYY-MM-DD
shippedrequiredstring (date) | nullDate as YYYY-MM-DD
deliveredrequiredstring (date) | nullDate as YYYY-MM-DD
set_uprequiredstring (date) | nullDate as YYYY-MM-DD
commissionedrequiredstring (date) | nullDate as YYYY-MM-DD
trainedrequiredstring (date) | nullDate as YYYY-MM-DD
closedrequiredstring (date) | nullDate as YYYY-MM-DD
signedQuoteDocumentIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
signedQuoteReceivedOnrequiredstring (date) | nullDate as YYYY-MM-DD
totalCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
balanceRemainingCentsrequiredinteger | nullNull until someone records it; 0 means paid in fullmin 0, max 9007199254740991
isValidrequiredboolean
financingPartnerrequired"none" | "commercial_capital" | "northland_capital" | "other"
financingStatusrequired"not_applicable" | "pending" | "approved" | "declined" | "funded"
financingNotesrequiredstring | null
poNumberrequiredstring | null
expectedShipOnrequiredstring (date) | nullDate as YYYY-MM-DD
ownerUserIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
notesrequiredstring | null
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
Example request
                curl https://api.cemco.app/v1/ops/orders.set_financing \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"id":"00000000-0000-4000-8000-000000000000","financingPartner":"none","financingStatus":"not_applicable"}'
              
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)"
      },
      "financingPartner": {
        "type": "string",
        "enum": [
          "none",
          "commercial_capital",
          "northland_capital",
          "other"
        ]
      },
      "financingStatus": {
        "type": "string",
        "enum": [
          "not_applicable",
          "pending",
          "approved",
          "declined",
          "funded"
        ]
      },
      "financingNotes": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 2000
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "id",
      "financingPartner",
      "financingStatus"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "orderNumber": {
            "type": "string"
          },
          "accountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Record id (UUID)"
          },
          "siteId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Delivery site"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ]
          },
          "stageDates": {
            "type": "object",
            "properties": {
              "received": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "in_build": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ready_to_ship": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "shipped": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivered": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "set_up": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "commissioned": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trained": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "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])))$",
                    "description": "Date as YYYY-MM-DD"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "received",
              "in_build",
              "ready_to_ship",
              "shipped",
              "delivered",
              "set_up",
              "commissioned",
              "trained",
              "closed"
            ],
            "additionalProperties": false,
            "description": "Date each stage was reached; null if not yet"
          },
          "signedQuoteDocumentId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "signedQuoteReceivedOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "totalCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in integer US cents (zero or more)"
          },
          "balanceRemainingCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in integer US cents (zero or more)"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until someone records it; 0 means paid in full"
          },
          "isValid": {
            "type": "boolean"
          },
          "financingPartner": {
            "type": "string",
            "enum": [
              "none",
              "commercial_capital",
              "northland_capital",
              "other"
            ]
          },
          "financingStatus": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "approved",
              "declined",
              "funded"
            ]
          },
          "financingNotes": {
            "type": [
              "string",
              "null"
            ]
          },
          "poNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedShipOn": {
            "anyOf": [
              {
                "type": "string",
                "format": "date",
                "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])))$",
                "description": "Date as YYYY-MM-DD"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerUserId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Record id (UUID)"
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
          },
          "updatedAt": {
            "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",
          "orderNumber",
          "accountId",
          "siteId",
          "title",
          "stage",
          "stageDates",
          "signedQuoteDocumentId",
          "signedQuoteReceivedOn",
          "totalCents",
          "balanceRemainingCents",
          "isValid",
          "financingPartner",
          "financingStatus",
          "financingNotes",
          "poNumber",
          "expectedShipOn",
          "ownerUserId",
          "notes",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "order"
    ],
    "additionalProperties": false
  }
}
            

orders.export

Export an order

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

Produce one order as a file: json (all fields), csv (line items) or html (a printable order summary with the timeline). The content is returned as text.

Input (object)

FieldTypeDescription
idrequiredstringRecord id (UUID)min length 1, max length 64
format"json" | "csv" | "html"default "html"

Output (object)

FieldTypeDescription
filenamerequiredstring
contentTyperequiredstring
contentrequiredstringThe exported file as text (JSON, CSV or printable HTML)
Example request
                curl https://api.cemco.app/v1/ops/orders.export \
  -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)"
      },
      "format": {
        "default": "html",
        "type": "string",
        "enum": [
          "json",
          "csv",
          "html"
        ]
      }
    },
    "required": [
      "id"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "filename": {
        "type": "string"
      },
      "contentType": {
        "type": "string"
      },
      "content": {
        "type": "string",
        "description": "The exported file as text (JSON, CSV or printable HTML)"
      }
    },
    "required": [
      "filename",
      "contentType",
      "content"
    ],
    "additionalProperties": false
  }
}
            

orders.add_document

Attach a document to an order

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

Link an existing document (purchase order, drawing, inspection report, photo) to an order, or upload one inline. For the signed quote use orders.attach_signed_quote instead.

Input (object)

FieldTypeDescription
orderIdrequiredstringRecord id (UUID)min length 1, max length 64
documentIdstringRecord id (UUID)min length 1, max length 64
fileobject
filenamerequiredstringmin length 1, max length 255
contentTypestringdefault "application/pdf", max length 100
contentBase64requiredstringFile bytes, base64 encoded (max 10 MB)min length 1
kind"signed_quote" | "quote" | "purchase_order" | "drawing" | "manual" | "inspection_report" | "photo" | "training_record" | "invoice" | "email_attachment" | "export" | "other"default "other"
customerVisiblebooleandefault true

Output (object)

FieldTypeDescription
documentIdrequiredstringRecord id (UUID)min length 1, max length 64
Example request
                curl https://api.cemco.app/v1/ops/orders.add_document \
  -H "x-api-key: $CEMCO_API_KEY" \
  -H "content-type: application/json" \
  -d '{"orderId":"00000000-0000-4000-8000-000000000000","documentId":"00000000-0000-4000-8000-000000000000"}'
              
JSON Schema
              {
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "orderId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "documentId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      },
      "file": {
        "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"
        ]
      },
      "kind": {
        "default": "other",
        "type": "string",
        "enum": [
          "signed_quote",
          "quote",
          "purchase_order",
          "drawing",
          "manual",
          "inspection_report",
          "photo",
          "training_record",
          "invoice",
          "email_attachment",
          "export",
          "other"
        ]
      },
      "customerVisible": {
        "default": true,
        "type": "boolean"
      }
    },
    "required": [
      "orderId"
    ]
  },
  "output": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "documentId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "description": "Record id (UUID)"
      }
    },
    "required": [
      "documentId"
    ],
    "additionalProperties": false
  }
}