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

Create Workplan Api V1 Workstreams Workplans Post

post/api/v1/workstreams/workplans

Create workplan (writes job_definition)

Creates a new WorkPlan from a template or a domain, with its full definition, and returns the saved job definition with its identifier. Only ``name`` is required, and one of ``template_id``, ``domain`` or ``goal_template`` must be given. With ``template_id`` the WorkPlan runs that template's steps; with a ``domain`` it runs that domain's goal. Tools, deliverables, limits, input bindings, per-client overrides, default context, trigger and target selector are all optional and default as ``POST /jobs`` does, except ``max_turns`` 40, ``max_cost_usd`` 10.0 and ``source_tracing`` false. **Stage-5 convergence (2026-07-02):** this endpoint writes a ``job_definition`` row (the canonical WorkPlan model) instead of the legacy ``blueprint`` table, through the same insert as ``POST /jobs``; the response is ``JobDefinitionResponse``. ``client_ids`` (multi-client roster) maps to ``target_selector.type = 'client_list'``; ``client_id`` maps to ``target_selector.type = 'single_client'``; neither maps to ``target_selector.type = 'manual'``. ``client_id``, ``client_ids`` and an explicit ``target_selector`` are mutually exclusive. **Authentication Required:** JWT Bearer token

Request bodyapplication/json

FieldTypeDescription
template_idstring (uuid) | nullSource template UUID (workstream_id). Optional: omit it to create the workplan from a domain instead.
namerequiredstringWorkplan name
descriptionstring | nullWorkplan description
domainstring | nullDomain knowledge key (e.g. 'vat_return'). Names the domain the workplan runs in when no template_id is given; defaults to 'general' with a template.
goal_templatestring | nullGoal template with {{variable}} placeholders. When omitted it is defaulted from the domain's DomainAgent persona.
toolsstring[] | nullTool names the workplan may use
deliverablesobject[] | nullDeliverables the workplan produces
max_turnsinteger | nullMaximum agent turns per run (default 40)
max_cost_usdnumber | nullMaximum cost in US dollars per run (default 10.0)
source_tracingboolean | nullWhether runs trace the source of each figure (default false)
input_bindingsobject | nullCross-cycle input bindings.
per_client_overridesobject | nullPer-client overrides, keyed by client id
default_contextobject | nullDefault context handed to every run
trigger_type"manual" | "schedule" | "webhook" | "email" | "api" | nullHow the workplan runs: manual, schedule, webhook, email or api
schedule_specobject | nullStructured schedule specification (round-trip source for the editor)
target_selectorobject | nullWho to run for: an object with a 'type' (manual, all_active, client_list, tag, single) and its ids. Mutually exclusive with client_id and client_ids.
client_idstring (uuid) | nullClient UUID (optional; references platform.clients)
client_idsstring (uuid)[] | nullClient UUIDs for a multi-client roster β€” maps to target_selector.type='client_list'. Mutually exclusive with client_id.
config_overridesobjectConfiguration overrides
show nested
Empty object.
schedulestring | nullCron schedule expression (folded into configuration; null = unscheduled)
schedule_timezonestring | nullIANA timezone for the schedule (folded into configuration)
skip_weekendsbooleanShift a fire time landing on Sat/Sun to the next business day
holiday_calendarstring | nullShift a fire time landing on a holiday to the next business day: 'UK', 'US', or 'AU'
max_duration_minutesinteger | nullPer-instance duration guardrail in minutes (folded into configuration)
human_checkpointsstring[] | nullSign-off gate checkpoints (folded into configuration); [] clears the gate
run_modestring | nullRun posture: propose|auto_run (folded into configuration)
not_ready_policystringFan-out ready-gating policy for a client whose inputs are not ready at a scheduled fire: 'hold_and_wait' (skip that client, retry next cycle), 'run_and_flag' (fire anyway, flag the cycle β€” legacy default), or 'skip_cycle' (write a terminal skipped-cycle tombstone).
schedule_overridesobjectPer-client schedule override map (clientId -> {cron_expr, timezone, skip_weekends, holiday_calendar}). An entry REPLACES the plan-level schedule for that client at fan-out; absent clients use the plan schedule.
show nested
Empty object.

Responses

201WorkPlan (job_definition) created successfully
FieldTypeDescription
idrequiredstring (uuid)β€”
permakeystring | nullStable human-readable key for the batch/fan-out deep-link URL /workstreams/{ws}/cycles/{permakey}/… (#173). Null on legacy rows.
namerequiredstringβ€”
descriptionstring | nullβ€”
domainrequiredstringβ€”
goal_templaterequiredstringβ€”
toolsrequiredstring[]β€”
deliverablesrequiredobject[]β€”
item shape
Empty object.
max_turnsrequiredintegerβ€”
max_cost_usdrequirednumberβ€”
max_duration_minutesrequiredintegerβ€”
target_selectorrequiredobjectβ€”
show nested
Empty object.
per_client_overridesrequiredobjectβ€”
show nested
Empty object.
input_bindingsrequiredobjectβ€”
show nested
Empty object.
default_contextrequiredobjectβ€”
show nested
Empty object.
source_tracingrequiredbooleanβ€”
human_checkpointsrequiredstring[]β€”
schedulestring | nullβ€”
schedule_timezonerequiredstringβ€”
skip_weekendsbooleanβ€”
holiday_calendarstring | nullβ€”
not_ready_policystringFan-out ready-gating policy for a not-ready client at a scheduled fire.
schedule_overridesobjectPer-client schedule override map (clientId -> override spec).
show nested
Empty object.
trigger_typestringPersisted 'How it runs' trigger choice (manual/schedule/webhook/email/api).
schedule_specobject | nullStructured ScheduleEditor spec (opaque JSONB round-trip; cron stays the execution shape).
is_enabledrequiredbooleanβ€”
next_run_atany | nullβ€”
last_run_atany | nullβ€”
statusrequiredstringβ€”
created_byrequiredstringβ€”
created_by_namestring | nullDisplay name behind created_by, for the detail header's 'Created <date> by <who>'. Null when the id no longer resolves to a user β€” render the date alone rather than an id.
created_atrequiredanyβ€”
updated_bystring | nullUser id of whoever last edited this WorkPlan. Null for edits predating the column.
updated_by_namestring | nullDisplay name behind updated_by, for 'Edited <date> by <who>'.
updated_atrequiredanyβ€”
current_versioninteger | nullThe WorkPlan's own latest config version in job_definition_version; null if no history yet. Not a WorkStream version: see workstream_current_version.
workstream_current_versioninteger | nullHighest workstreams.workstream_version.version of the WorkPlan's WorkStream (default_context.source_workstream_id); null when the WorkPlan has no WorkStream or it has no saved version.
pinned_workstream_versioninteger | nullPinned version of the WorkPlan's WorkStream: workstreams.workstream_version.version for default_context.source_workstream_id; null = follow the latest.
upstream_update_availablebooleanTrue when pinned_workstream_version is set AND the WorkPlan's WorkStream has a version row with a higher number (workstream_current_version).
cost_so_far_gbpnumber | nullSum of customer-facing GBP cost (hourly_rate_gbp x elapsed) across all cycles for this job definition. Null when no cycles exist.
hourly_rate_gbpnumberThis customer's WorkStream hourly rate in GBP (platform.organizations.workstream_hourly_rate_gbp). Their cost, our revenue β€” never our compute cost. Serialized because the client RENDERS the rate beside the total ('Β£X total Β· Β£Y avg / client Β· Β£Z/hr rate'); without it the frontend had to hardcode 19, which silently disagrees with a total computed at any other rate.
total_runsintegerCount of cycles launched from this job definition. When the list was filtered by workstream_id, this count is scoped to that workstream.
active_runsintegerCount of cycles currently in flight (see ACTIVE_CYCLE_STATUSES). Same scoping rule as total_runs. Exists so a caller that only needs 'how many are running' does not have to fetch every cycle of every job to count them client-side β€” the shell rail did exactly that, at one request per job on every authenticated page load.
last_cycle_atany | nullStart timestamp of the most recent cycle (scoped to the requested workstream if filtered).
last_cycle_statestring | nullStatus of the most recent cycle (scoped to the requested workstream if filtered).
latest_cycle_launch_idstring (uuid) | nullThe most recent cycle_launch (the product's Cycle - one launch of a plan) for this job_definition, so list consumers (the shell rail 'Running cycles', the @ 'cycle' picker, the TopicLivePage cycle mention) can link the plan's latest cycle directly. Card 'Every link the app emits uses the cycle's own address': emitting the plan's job id in the cycle slot redirected to the WorkPlan, not the cycle. Null when the plan has no cycle_launch yet.
latest_cycle_launch_permakeystring | nullThe permakey of the most recent cycle_launch - the canonical CYCLE address (/workstreams/{ws}/cycles/{permakey}). List consumers link THIS (not the plan's job permakey) for the cycle slot. Card 'Every link the app emits uses the cycle's own address'.
latest_cycle_launch_workstream_idstring (uuid) | nullThe workstream id of the most recent cycle_launch - the parent WorkStream for the nested cycle URL. Null when the launch has none (should not happen; cycle_launch.workstream_id is NOT NULL).
latest_cycle_launch_workstream_permakeystring | nullThe workstream permakey of the most recent cycle_launch - the canonical WorkStream segment for the nested cycle URL, so a list consumer can build /workstreams/{ws_permakey}/cycles/{launch_permakey} without a second fetch.
run_modeWorkplanRunModeThe WorkPlan's effective run posture (S2-READ Β§1a). ``effective`` resolves: plan-level ``configuration.run_mode`` β†’ the workstream default β†’ ``propose``. ``source`` tells the FE whether the value was set on this plan or inherited. ``locked`` is the firm-lock governance flag β€” always ``False`` in S2.
show nested
autonomy_configAutonomyConfig | nullFine-grained autonomy controls from default_context.autonomy_config, or null if unset.
cohortWorkplanCohortStructural facts about the WorkPlan's bound client set (S2-READ Β§1b). Live exception/ready counts live on the roster's ``summary`` (one authoritative source); this object carries only the cohort's size + shape. With no multi-client cohort writer yet, ``total_clients`` resolves to 0/1 and ``selector_kind`` to ``single`` β€” the shape is frozen, the populating data is S2-write BE work behind it.
show nested
400Workstream template not found
401Unauthorized
422Validation Error
FieldTypeDescription
detailValidationError[]β€”
item shape
curl https://api.dev.arch.ie/api/v1/workstreams/workplans \
  -X POST \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{
       "client_id": "b7a9c2d4-1e3f-4a5b-8c6d-7e9f0a1b2c3d",
       "config_overrides": {
         "currency": "GBP",
         "materiality_threshold": 1000
       },
       "holiday_calendar": "UK",
       "name": "Monthly bookkeeping close",
       "schedule": "0 9 1 * *",
       "schedule_timezone": "Europe/London",
       "skip_weekends": true,
       "template_id": "3c8e5a17-6d29-4f0b-8e4a-91b2c3d4e5f6"
     }'
API Reference Β· Archie for developers