Skip to main content

When to use

  • Promote a deployed use case from dev to production
  • Make a process available to end users for the first time
  • Configure visibility (private, organizational, public) on first publish
  • Enable dev/prod auto-toggle to pause dev when prod is running

Prerequisites

  • codika CLI installed and authenticated
  • A deployed use case with project.json containing a deployments map (run deploy use-case first)
  • API key with deploy:use-case scope

Command

codika publish <templateId> [options]

Arguments

ArgumentDescription
<templateId>Deployment template ID (from project.json deployments map)

Options

OptionDescriptionDefault
--path <path>Path to use case folder with project.jsonCurrent directory
--project-file <path>Custom project file pathproject.json
--project-id <id>Override project IDproject.json
--visibility <scope>private, organizational, or public (first publish only)
--shared-with <scope>owner_only, admins, or everyone (org processes only)
--auto-toggle-dev-prodPause dev instance when prod is activeOff (both run simultaneously)
--skip-prod-instanceDon’t auto-create/update prod instance
--api-url <url>Override API URL
--api-key <key>Override API key
--profile <name>Use a specific profile instead of the active one
--jsonJSON output

Finding the template ID

After each deploy, project.json stores a deployments map keyed by version:
{
  "projectId": "abc123",
  "devProcessInstanceId": "pi_dev_456",
  "deployments": {
    "1.0": { "templateId": "tmpl_abc", "createdAt": "2026-03-04T14:30:00Z" },
    "1.1": { "templateId": "tmpl_def", "createdAt": "2026-03-04T15:00:00Z" }
  }
}
Use the templateId from the version you want to publish.

What happens on publish

  1. Resolve project ID: --project-id > --project-file > project.json
  2. Resolve API key: --api-key > env > active profile
  3. Send publish request to platform with templateId, projectId, and options
  4. Platform publishes the deployment template (status: inactive → published)
  5. Platform deprecates any previously published templates for this project
  6. Platform auto-creates or updates the owner’s prod process instance
  7. If --auto-toggle-dev-prod, deactivates dev instance
  8. On success: saves prodProcessInstanceId to project.json

Visibility

Set on first publish only. Subsequent publishes inherit the existing visibility.
LevelWho can see and install
privateOnly the owner
organizationalAll org members
publicAnyone on the platform

Shared with

Controls who can use the prod instance. Applies to organizational processes only.
ScopeWho can use the prod instance
owner_onlyOnly the process owner
adminsOrganization admins (default for org processes)
everyoneAll organization members

Dev/Prod toggle

By default, both dev and prod instances run simultaneously. Use --auto-toggle-dev-prod to pause the dev instance when production becomes active:
codika publish tmpl_abc123 --auto-toggle-dev-prod
This keeps production as the single active instance, avoiding duplicate executions from scheduled or webhook triggers. To disable the toggle after publishing, re-publish without the flag or update the setting in the platform UI.

Examples

# Publish the latest deployment
codika publish tmpl_abc123

# Publish with visibility (first publish)
codika publish tmpl_abc123 --visibility organizational --shared-with admins

# Publish from a specific directory
codika publish tmpl_abc123 --path ./my-use-case

# JSON output
codika publish tmpl_abc123 --json

# Pause dev when prod runs
codika publish tmpl_abc123 --auto-toggle-dev-prod

Output

✓ Published successfully!

  Version:              1.1
  Template ID:          tmpl_abc123
  Prod Instance ID:     pi_prod_789
  Webhook URL:          https://...
Need to change parameters without a new version? After publishing, use codika redeploy to update deployment parameters on the prod instance without creating a new template version. Only the parameters you specify are changed — everything else stays the same.

Error reference

HTTPErrorFix
401Invalid API keyRe-login with codika login
403Missing scopeCreate key with deploy:use-case scope
404Template not foundCheck templateId in project.json deployments
400Invalid statusTemplate already published or not in inactive state

Exit codes

CodeMeaning
0Publish successful
1API error
2CLI validation error (missing templateId, no project ID)