API · v1 · stable
CODEMETA OSDeveloper Center
EN
Open console
Concept

Workflows & automations

Reading time · 10 minUpdated · 1 May 2026

Workflows are Codemeta OS’ engine for automated processes — similar to n8n or Zapier, but tenant-internal and with direct access to your platform data. A workflow definition consists of triggers, steps and edges; each run is a workflow instance.

The UI lives in the platform under “Workflows”; the data model and the REST API are documented under /api/workflows.

Workflow definition vs. instance

Concept Collection Meaning
Definition workflow_definitions Blueprint: triggers + steps + edges
Instance workflow_instances A concrete run of a definition (run history)
Run archive automation_run_archives Runs moved to the archive after DB retention

A definition is versioned (version++ per update) and can be active or paused (isActive). System workflows come from Codemeta itself and cannot be deleted — but they can be paused or modified.

Triggers — when a workflow starts

A workflow has at least one trigger, but can have several (e.g. manual + cron). Trigger types:

type When it fires
event On Codemeta entity changes (CREATE/UPDATE/DELETE)
manual On a manual “Execute” click
cron On a cron expression (default tz Europe/Berlin)
webhook On an incoming HTTP request at /automations/webhook/<id>

For event triggers, you filter on entityType (e.g. tickets), operation (e.g. UPDATE) and arbitrary conditions via field/operator/value. For integration triggers (e.g. a Salesforce webhook), the platform registers the external webhook with the provider automatically.

Webhook triggers in detail

Webhook triggers have their own URL, an auth configuration (none, hmac or bearer) and an optional IP allowlist (manual values or references to parties/assets). The secret is shown once when generated — never readable again afterwards. Learn more under Webhook ingress.

Steps — the building blocks

A step has an action, a unique id, free-form params and a next. A selection of the built-in actions:

Action Purpose
create-entity Create a new entity (e.g. ticket from lead)
change-field Set a field of an existing entity
lookup-entity Load an entity by ID/filter
lookup-table Apply a static mapping
send-email Transactional email from template
send-notification In-app notification
http-request Outbound HTTP call
webhook Outbound webhook to registered receivers
if-else 2-branch fork
switch n-branch fork
loop Iterate a sub-graph per item
wait Pause until a date, duration or entity event
code JavaScript snippet, run in isolation
set-variables Annotate items
aggregate-items Aggregate items
extract-items / merge-items / split-batches Item pipeline operations
transform-rows Table-style transform
parse-document Document parsing (CSV/PDF/…)
dms-fetch Load DMS content
fetch-integration Third-party API via integration provider

Items, n8n-style

Steps process data as items — an array of records. The output of one step becomes the items of the next. By default, a step runs once per item (runMode: 'each'); with runMode: 'all' it runs once with all items together.

outputKey stores the output under a key instead of flat in variables — useful for {{steps.<ref>.<field>}} templates.

Branches: if-else, switch, loop

  • if-else has trueBranch and falseBranch with target step IDs.
  • switch has a list branches[] with conditions; the first match wins, otherwise fallback.
  • loop is a container — body steps carry parentLoopId and are excluded from the main DAG. The runtime executes them once per item in loopConfig.itemsExpression.

Trigger inputs: inputs & inputFields

Manual and webhook triggers can define inputs (inputFields[]): text, number, date, boolean, select, entity picker. When the workflow instance is invoked, the values land as inputs.<key> in the templating context of all steps.

// In a step param value
'{{ inputs.customerEmail }}';

Permissions & licenses

When saving a definition, the platform checks two things:

  1. Editor permissions: each step action is assigned a permission set (e.g. ticket_create for create-entity on tickets). If a permission is missing, 403 is returned.
  2. Licensed modules: if a step references a schema in a module that is not included in the plan, 403 is returned with module-not-licensed.

In addition, a tier quota applies to the number of active workflows per tenant; when exceeded, the API responds with 429.

Run retention & archive

For each workflow you can configure how long run data stays in the database (retentionConfig.dbDays, 1–7) and whether it is archived afterwards (retentionConfig.archive). Archives can be listed via the workflow API and downloaded as JSON with a presigned URL.

Manual execution & re-run

POST /api/v1/workflows/<id>/execute starts a run manually. The body can contain:

  • inputs — values for inputFields
  • triggerId — if the definition has multiple triggers
  • startFromStepId / stopAfterStepId — partial re-runs
  • initialItems — records pre-loaded as items

The response contains the instanceId, with which you can follow the live logs via SSE or cancel the run.

Search