workflows

Publish workflow

Snapshot draft_steps into a new immutable workflow_versions row (version = max+1) and repoint published_version_sid, one transaction. Status is unchanged: publishing while active hot-swaps the version for new enrollments only, in-flight records stay pinned to theirs. Rejected while archived (409 invalid_transition). A draft identical to the published version mints nothing: result.unchanged true, result.version the live one, no event, no validation; a repeated call is a no-op.

A changed draft is validated whole first; failures are 422 validation_failed with every error at once in field_errors keyed steps[id=N].{field} (array position for id-less new steps), each with a fix hint; non-blocking lints ride as warnings. Checks: 1..100 steps nested included, depth <= 3, end last in its array, id carry and uniqueness; send steps need a non-empty sender pool; {{...}} variables resolve to known namespaces and {{ai.<key>}} follows a preceding ask_ai on every path; condition when is a valid filter AST; ask_ai and api_call output_key unique and {{api.<key>}} follows an api_call that named its answer; api_call URLs https; durations 1m..365d; required_fields.refs resolve like variables. Field slugs resolve at runtime, not at publish.

result is the version row (the live one when unchanged), previous_version_sid and unchanged; workflows.published fires only when a version was minted. Free dry run: validate_workflow. Go-live is a separate intent: resume_workflow after.

Contract:

  • MCP tool publish_workflow, registry package mcp.playtables/workflows, mount playtables.workflows.
  • Operation action, response envelope action.
  • Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.
post/api/workflows/{sid}/publish

Request

  • Base URL
    https://beta.getsales.io/playtables/v1
  • Auth
    HTTP bearer and API key in header Team-SID

Path parameters

sidstring required

Workflow whose saved draft to publish. Archived → 409 invalid_transition (unarchive first).

Response

action success envelope.

successtrue required
operation'action' required
actionstring required

kebab-case verb; matches the route segment.

Changes

No recorded changes to this operation across all 1 revision of this API.