Operating system set to macOS
Documentation jurisdiction set to United States
Sign inConnect Claude

Update Template Api V1 Workstreams Templates Template Id Patch

patch/api/v1/workstreams/templates/{template_id}

Update template

Updates the fields you send on an existing workflow template and returns the saved template at its new version. Only provided fields will be updated. Omitted fields remain unchanged. Pass ``expected_version`` to write only if the WorkStream is still at the version you reviewed; otherwise nothing is written and the response is 409. A WorkStream whose source is managed is saved as one commit in your name, not as a new version. Send ``expected_head`` (the head you loaded) so a save made by someone else since is refused with 409 ``stale_head``; a change to the definition with neither ``expected_head`` nor ``expected_version`` is refused with 409 ``expected_head_required``. Changes to sharing, status and runner settings are written to the row and make no commit. **Authentication Required:** JWT Bearer token

Path parameters

template_idrequired
path
The template's UUID.

Query parameters

expected_head
query
The commit the caller loaded. A save of a managed WorkStream is refused with 409 `stale_head` when the working branch has moved on since; ignored for a WorkStream whose source is not managed.

Header parameters

Idempotency-Key
header
Names one save of a managed WorkStream. Sent again with the same key it makes no second commit and answers with the first; ignored for a WorkStream whose source is not managed.

Request bodyapplication/json

FieldTypeDescription
namestring | nullTemplate name
descriptionstring | nullTemplate description
source_descriptionstring | nullThe definition's own text, verbatim.
source_namestring | nullThe definition's own name, verbatim.
category"compliance" | "advisory" | "audit" | "bookkeeping" | "tax" | "internal" | nullTemplate category (closed taxonomy; off-taxonomy input is mapped)
stepsTaskStepDefinition | ToolCallStepDefinition | ArchieQueryStepDefinition | NotifyStepDefinition | ConditionalStepDefinition | LoopStepDefinition | ParallelStepDefinition | ApprovalStepDefinition | DocumentUploadStepDefinition | StageStepDefinition | GotoStepDefinition | SubWorkStreamStepDefinition | DeterministicExtractionStepDefinition | VerificationStepDefinition | EmailSendStepDefinition | WaitForReplyStepDefinition | SkillStepDefinition | AgentRunStepDefinition | WaitStepDefinition | WebhookStepDefinition | FormStepDefinition | FileStepDefinition[] | nullWDL step definitions
tagsstring[] | nullTemplate tags
input_schemaobject[] | nullDeclared workstream inputs (array of InputDef).
output_schemaobject[] | nullDeclared workstream outputs (array of OutputDef).
inputs_requiredany[] | nullDeclared inputs the WorkStream needs before it can run.
data_filesobject | nullData files kept with the WorkStream: layouts/<name>.json to a JSON object. Omit to leave them unchanged; {} removes every file.
runner_configobject | nullRunner settings.
execution_mode"inline" | "containerized" | nullHow the WorkStream runs.
jurisdictionsstring[] | nullApplicable jurisdictions.
status"draft" | "active" | "paused" | "archived" | nullTemplate status
goal_specGoalSpecPayload | nullGoal contract scored by the deterministic goal gate. Omit to leave the existing goal untouched; the tolerances a reviewer already approved must not change just because an unrelated field did.
specSpec | nullThe WSS spec (decisions + compiled bindings) for the new version. Persisted with spec_hash and definition_hash on the version snapshot. Every cited document_id must be an upload in this workspace. Omit to keep the latest version's spec (definition_hash recomputed over the new steps).
change_summarystring | nullCaller-supplied version-history note (e.g. 'Revised from cycle <id>: …'). Falls back to the auto-computed field list when omitted.
accounting_ledger"off" | "optional" | "required" | nullChange the Cycle Accounting Ledger capability. Omit to preserve it; use off for WorkStreams that do not need a Ledger.
shared_with_user_idsstring[] | nullUser IDs granted editor rights to this workstream definition.
expected_headstring | nullThe head of the working branch the caller loaded (`working_branch_head` of the read). A managed save is refused with 409 `stale_head` when the branch has moved on; the query parameter of the same name wins when both are sent.
expected_versioninteger | nullThe version the caller read and reviewed. When given, the update is written only if the WorkStream is still at exactly this version; otherwise nothing is written and the response is 409 with error_code 'template_version_changed' and the current version. Omit for the previous last-write-wins behaviour.

Responses

200Template updated successfully
FieldTypeDescription
idrequiredstring (uuid)Template UUID
slugstring | nullHuman-readable URL key (e.g. 'asc-606-review'). Stable + globally unique; resolvable by GET /templates/{id}. Link the FE here, not the UUID.
permakeystring | nullStable opaque short id (7-char); the cross-entity permalink, also resolvable.
namerequiredstringTemplate name
descriptionstring | nullTemplate description
source_descriptionstring | nullThe definition's own text, verbatim (the audit-true record of what was authored). Disclosed behind 'The definition, as written', in mono — never the firm-facing head. NULL when the definition has no prose distinct from the interpreted description.
source_namestring | nullThe definition's own name, verbatim. Disclosed alongside source_description when it differs from the firm-facing name.
category"compliance" | "advisory" | "audit" | "bookkeeping" | "tax" | "internal" | nullTemplate category (closed taxonomy: compliance/advisory/audit/bookkeeping/tax/internal). NULL = genuinely uncategorised (no category set); 'internal' = an off-taxonomy value mapped to the catch-all bucket — the two are distinct (NULL is NOT coerced to 'internal').
stepsobject[]WDL step definitions
item shape
Empty object.
default_configobjectDefault configuration
show nested
Empty object.
goal_specGoalSpecPayload-Output | object | nullThe versioned deterministic goal contract. This is definition state, not cycle output, and must round-trip through every authoring surface.
accounting_ledger"off" | "optional" | "required"The WorkStream's explicit Cycle Accounting Ledger capability.
offoptionalrequired
tagsstring[]Template tags
input_schemaobject[]Declared workstream inputs (array of InputDef: name/type/required/...).
item shape
Empty object.
familiesobject[]—
item shape
Empty object.
data_filesobject | nullThe WorkStream's data files; null on the list route.
broker_option_namesobjectMaps each family_id@version choice of a select input in input_schema to its broker family's stored display name. A family with no stored name is omitted; the choice values themselves are unchanged. Filled by the single-template route only; empty elsewhere.
show nested
Empty object.
output_schemaobject[]Declared workstream outputs for the Outputs tab (array of OutputDef: name/label/type/format/...). Empty ⇒ no Outputs tab.
item shape
Empty object.
inputs_requiredany[] | nullDeclared inputs the WorkStream needs before it can run (part of the hashed definition).
runner_configobject | nullRunner settings for the WorkStream (part of the hashed definition). {} when none.
execution_mode"inline" | "containerized" | nullHow the WorkStream runs (part of the hashed definition).
jurisdictionsstring[] | nullApplicable jurisdictions (part of the hashed definition).
forked_fromobject | nullProvenance: parent recipe {name, version} this was forked from. NULL when not a fork.
upstream_updateobject | null{version, note} when the fork's parent has advanced past the fork point. NULL when none/uncomputable.
is_templatebooleanAlways true for templates
domainstring | nullDomainAgent knowledge-key backing this recipe (e.g. 'ita_2007_eis'), resolved from the linked job_definition.domain via its most-recent cycle and surfaced ONLY when it maps to a real DomainAgent persona. NULL for fixed-step recipes and generic agentic containers (the 'workstream'/'general' placeholder domains) — which are NOT WorkPlan-able. The WorkPlan-create picker filters to `domain != null`.
statusrequired"draft" | "active" | "paused" | "archived"Status for workstream entities.
draftactivepausedarchived
versionintegerTemplate version, incremented on each update
active_blueprint_countintegerNumber of active linked workplans for this template
total_runsintegerCount of cycles ever launched from this template (run count).
total_instancesintegerAggregate instance count across all cycles. Each backend cycle is one instance run, so this equals total_runs today; kept distinct so the FE contract is stable if job-level fan-out grouping lands later.
last_run_atstring (date-time) | nullStart (or creation) timestamp of the most recent cycle. NULL if never run.
last_run_state"created" | "planning" | "queued" | "running" | "paused" | "blocked" | "completed" | "failed" | "cancelled" | "skipped" | "pending" | "needs_guidance" | "abandoned" | "debug_paused" | nullStatus of the most recent cycle, for the 'last run' badge. NULL if never run.
avg_instance_costnumberAverage customer-facing cost (GBP) across runs: mean of £19/hr x elapsed per cycle. Mirrors CycleResponse.customer_cost_gbp.
cycle_idsstring (uuid)[]Cycle ids that have run this template, most recent first (capped).
needs_you_countintegerInstances of this WorkStream parked at an approval gate, waiting on a person. APPROVALS ONLY — blocked (waiting on the client) and errored (needs a retry) are different asks and are counted elsewhere, so the orange attention number means the same thing on the list card, the WorkStream page and a cycle's triage.
needs_you_job_idstring (uuid) | nullThe batch holding the most of those approvals — the DOOR the attention chip opens, so the count is never a claim the user then has to hunt for. NULL when needs_you_count is 0, and ALSO null when the gated instances belong to no batch (a standalone run has no fan-out to open). A non-zero count with a null door is therefore expected: fall back to the WorkStream's own Cycles tab, which is always reachable — never render the count as unclickable.
source_managedbooleanThe WorkStream is saved to git (every save is a commit).
working_branch_headstring | nullThe head of the working branch (40 lower-case hex) of a managed WorkStream: send it back as `expected_head` with the next save.
publishedboolean | nullAlways false on a managed save answer: saved, not yet published.
unpublished_savesinteger | nullCommits on the working branch that main does not yet hold; null when it could not be read.
latest_versioninteger | nullThe WorkStream's own version; a save never changes it.
headstring | nullThe head after this save (a managed save only).
save_messagestring | null"Saved. Not published: N change(s) since version V." (a managed save only).
created_byrequiredstring (uuid)Creator user ID
created_by_namestring | nullCreator display name
owner_user_idstring | nullThe user who owns (and alone grants edit rights on) this definition.
shared_with_user_idsstring[]Users the owner granted edit rights on this definition.
created_atrequiredstring (date-time)Creation timestamp
updated_atrequiredstring (date-time)Last update timestamp
scopestringDistribution scope: gallery|firm|team|user|plan (provenance pill).
is_catalogbooleanTrue for curated public library recipes (the seeded catalog).
owning_team_idstring (uuid) | nullThe team a `scope='team'` workstream belongs to — lets the FE group the My WorkStreams list under the team name (#170). NULL for firm/user-scoped rows.
workspace_idstring (uuid) | nullWorkspace ID owning this template, or NULL for catalog/curated recipes
lintstring[]ADVISORY structural findings for the saved step set — duplicate ids, dangling depends_on, dependency cycles, unresolvable references. Entries prefixed `warn:` are advisory by the linter's own tiering. This NEVER blocks a save and an empty list is not a guarantee: see the note on the update handler for why a hard gate would be wrong against today's stored data.
400Invalid request data
401Unauthorized
403Not permitted to edit this WorkStream (code `not_permitted`)
404Template not found
409expected_version given and the WorkStream is at another version, or a managed save refused: `stale_head`, `expected_head_required`, `no_firm`
422A managed save refused: `content_refused`
503A managed save could not be checked: `fga_unavailable`, `could_not_check`
curl https://api.dev.arch.ie/api/v1/workstreams/templates/<template_id> \
  -X PATCH \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{
       "name": null,
       "description": null,
       "source_description": null,
       "source_name": null,
       "category": null,
       "steps": null,
       "tags": null,
       "input_schema": null,
       "output_schema": null,
       "inputs_required": null,
       "data_files": null,
       "runner_config": null,
       "execution_mode": null,
       "jurisdictions": null,
       "status": null,
       "goal_spec": null,
       "spec": null,
       "change_summary": null,
       "accounting_ledger": null,
       "shared_with_user_ids": null,
       "expected_head": null,
       "expected_version": null
     }'
API Reference · Archie for developers