Skip to main content

When to use

  • Test a deployed workflow
  • Execute a workflow via the CLI instead of the platform UI
  • Automate workflow execution in scripts or CI

Prerequisites

  • Use case deployed (project.json contains devProcessInstanceId)
  • Authenticated via codika-helper login or CODIKA_API_KEY env var
  • API key with workflows:trigger scope

Resolving the workflow ID

The workflowId is the workflowTemplateId from config.ts. If the user provides a use case folder path, read config.ts to find the available workflow IDs and their trigger types. Only workflows with trigger.type === 'http' can be triggered with this command.

Command

codika-helper trigger <workflowId> [options]

Arguments

ArgumentDescription
<workflowId>The workflowTemplateId from config.ts

Options

OptionDescriptionDefault
--payload-file <path>Read payload from JSON file, or - for stdin
--process-instance-id <id>Explicit process instance IDAuto from project.json
--path <path>Path to folder with project.jsonCurrent directory
--pollWait for execution to completeFire-and-forget
--timeout <seconds>Max poll time120
-o, --output <path>Save result to file (with —poll)stdout
--jsonJSON output

Examples

codika-helper trigger search --poll --payload-file - <<'EOF'
{"query": "test"}
EOF
Using --payload-file - with a heredoc avoids shell escaping issues with inline JSON.

Fire-and-forget

codika-helper trigger search
Returns immediately with execution ID.

Payload from file

codika-helper trigger analyze --payload-file ./test-input.json --poll

Save result

codika-helper trigger search --poll -o result.json --payload-file - <<'EOF'
{"query": "test"}
EOF

Custom timeout

codika-helper trigger generate --poll --timeout 300

Process instance ID resolution

  1. --process-instance-id flag
  2. devProcessInstanceId in project.json at --path
  3. devProcessInstanceId in project.json in current directory

Result statuses

StatusMeaning
successWorkflow completed, resultData contains output
failedError occurred, errorDetails.message describes failure
pendingStill running (during polling)

Error reference

HTTPErrorFix
401Invalid API keyRe-login with codika-helper login
403Missing scopeCreate key with workflows:trigger scope
404Workflow not foundCheck workflowTemplateId in config.ts
412Instance inactiveRe-deploy or activate in platform

Important notes

  • Only HTTP-triggered workflows can be triggered via CLI
  • The workflowId is the workflowTemplateId, not the n8n ID
  • Payload is wrapped in {"payload": {...}} automatically
  • File uploads are not supported via CLI — use the platform UI