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

Create Cycle Api V1 Workstreams Cycles Post

post/api/v1/workstreams/cycles

Start new cycle

Starts a new execution cycle from a work plan, a blueprint or a single workstream and returns the queued cycle with its identifier and status. Creates a new cycle and queues it for execution. **Authentication Required:** JWT Bearer token

Request bodyapplication/json

FieldTypeDescription
blueprint_idstring (uuid) | nullBlueprint UUID (legacy path; use job_definition_id for new WorkPlans)
job_definition_idstring (uuid) | nullWorkPlan (job_definition) UUID β€” preferred for WorkPlans created via POST /workplans
workstream_idstring (uuid) | nullRun-once: launch THIS WorkStream for one client with no WorkPlan and no blueprint. Mutually exclusive with blueprint_id/job_definition_id.
client_idstring (uuid) | nullClient to run for (job_definition path only; overrides target_selector)
input_dataobjectInput data for the cycle
show nested
Empty object.
priorityintegerExecution priority (1=highest)
topic_idstring (uuid) | nullOptional Topic UUID this cycle belongs to. Stamped onto workstreams.cycle.topic_id so topic→run linkage resolves (the reverse link of platform.topics.workstream_id). NULL for cycles launched outside a topic context — no behaviour change.

Responses

201Cycle started successfully
FieldTypeDescription
idrequiredstring (uuid)Cycle UUID
permakeystring | nullStable human-readable cycle key for the deep-link URL /workstreams/{ws}/cycles/{permakey}/instance/{task}. Null on legacy rows.
workstream_idstring (uuid) | nullParent workstream UUID. Populated for every cycle launched against a workstream definition; only null for legacy agentic/v2 cycles that have no workstream parent.
workstream_permakeystring | nullParent workstream's stable human-readable key (workstreams.workstream.permakey), resolved by joining on the same COALESCE(cycle.workstream_id, blueprint.workstream_id) that backs workstream_id. Lets the list/detail surfaces build the permakey-prefixed deep link /workstreams/{workstream_permakey}/cycles/{permakey} without a second fetch. Null when no workstream parent resolves (legacy agentic/v2 cycles, or a workstream that no longer exists).
workstream_slugstring | nullParent workstream's URL slug (workstreams.workstream.slug), resolved via the same join as workstream_permakey. Null when no workstream parent resolves.
workstream_versioninteger | nullThe WorkStream version this cycle ran β€” the integer version it resolved, written in the INSERT that created it (the pinned version on a pinned WorkPlan, a blueprint's own version, else the head). The database refuses to change it afterwards. Null on cycles that recorded none (every cycle created before this was recorded); never the WorkStream's current version.
current_workstream_versioninteger | nullThe version the WorkStream is at now (workstreams.workstream.version). Compare with workstream_version to see whether the WorkStream has moved on since this cycle ran. Null when the cycle has no WorkStream parent.
accounting_ledger"off" | "optional" | "required" | nullThe Accounting Ledger mode this cycle was launched with β€” stamped into blueprint_snapshot.settings.accounting_ledger at launch (resolve_accounting_ledger_mode) and read back here verbatim. Immutable after launch, same pattern as workstream_version: a WorkStream edited after this cycle launched does not retroactively add or remove its Ledger tab. Resolves to 'off'/'optional'/'required' for every well-formed snapshot β€” 'off' for any legacy cycle whose snapshot predates this setting. Also null (read as not declared, same as 'off' for gating purposes) when the stored value fails resolve_accounting_ledger_mode's validation β€” a read site never errors the whole list/detail response over one malformed cycle β€” or when a caller never ran this resolution at all (e.g. a hand-built response in a test).
cycle_launch_idstring (uuid) | nullThe cycle_launch (the product's Cycle - one launch of a plan) this instance (per-client cycle row) belongs to. Card 'Cycle URLs open cycles, WorkPlan URLs open WorkPlans': an instance nests under its cycle (/workstreams/{ws}/cycles/{cycle}/instances/{instance}), and the cycle segment is the cycle_launch's permakey. Null on legacy rows that predate the backfill (20260902_0100).
cycle_launch_permakeystring | nullThe cycle_launch's stable permakey - the canonical cycle URL segment the instance nests under. Lets the instance page build its breadcrumb cycle crumb (/workstreams/{ws}/cycles/{cycle}) without a second fetch. Null when the instance has no parent launch (a pre-backfill orphan).
definition_hashstring | nullThe fingerprint of the WorkStream version this cycle ran (`wsdef-v1:<sha>` or `steps-v0:<sha>`), written with workstream_version and never changed afterwards. Null when that version holds no fingerprint or the cycle recorded none. Distinct from code_sha (the launching-code git SHA used by the deploy-race guard).
source_commitstring | nullThe head commit (40 lower-case hex characters) of the WorkStream's working branch when this cycle was launched, written with the cycle and never changed afterwards. Null for a WorkStream that is not git-managed and for a cycle launched before this was recorded.
workplan_idstring (uuid) | nullWorkplan UUID (null for agentic cycles)
workplan_namestring | nullWorkplan name (from join)
client_idstring (uuid) | nullClient UUID (from workplan join)
client_namestring | nullClient name (from workplan join)
statusrequired"created" | "planning" | "queued" | "running" | "paused" | "blocked" | "completed" | "failed" | "cancelled" | "skipped" | "pending" | "needs_guidance" | "abandoned" | "debug_paused"Status for execution cycles - matches DB check constraint.
createdplanningqueuedrunningpausedblockedcompletedfailedcancelledskippedpendingneeds_guidanceabandoneddebug_paused
progress_pctnumber`completed_steps / total_steps * 100` β€” work that RAN AND FINISHED, over the whole ladder. Skipped steps are excluded from the numerator and stay in the denominator, so a run that stopped early can never reach 100%. It is a record of how far the run got, not a live fraction: pair it with `status` and `current_step_index` before rendering, and never read it alone as 'nearly done'.
blueprint_snapshotobjectWorkplan snapshot at cycle start
show nested
Empty object.
error_contextobject | nullError context if failed
started_atstring (date-time) | nullStart timestamp
completed_atstring (date-time) | nullCompletion timestamp
started_bystring (uuid) | nullInitiator user ID (started_by in DB)
created_atrequiredstring (date-time)Creation timestamp
updated_atrequiredstring (date-time)Last update timestamp
current_step_namestring | nullName of the ONE current step every FE view should render verbatim (banner, Steps tab, Approvals tab, batch matrix). Resolved by _compute_run_progress: the earliest in-flight/awaiting step, else (when the cycle has failed) the last failed step. Never the literal 'Unknown' β€” an unnamed step falls back to a humanized blueprint step id or 'Step N'. Null only when no step can be resolved at all (e.g. a cycle with zero tasks).
current_step_indexinteger | null1-based position of current_step_name within the cycle's steps. Null exactly when current_step_name is null β€” the two are always resolved together so a view never pairs a real index with a missing name (or vice versa) β€” see pilot run-through defect B1 ('Step 0: Unknown').
failure_reasonstring | nullHuman-readable reason the run is errored/blocked, populated whenever status is failed/cancelled/blocked β€” even when no current step could be resolved (e.g. 'The run stopped before any step could be identified.'). FE should show this INSTEAD OF a step placeholder, never alongside a fabricated 'Step ?'. Written for an accountant: no step ids, no raw floats where money is meant, no internal certification vocabulary. The engine's or the approver's own words are on failure_details.
failure_detailsstring | nullThe engine's or the approver's own words, verbatim and unshortened, behind the surface's Details affordance. NEVER rendered inline β€” failure_reason is the sentence a person reads. Null when the reason IS already the whole of what was recorded.
retryablebooleanWhether a Retry action applies to this run (status is failed/cancelled).
needs_approvalbooleanTrue when this run is parked on a human sign-off nobody has given yet: a task with approved_at NULL that is awaiting_approval (by status or by outputs.status), on a cycle that is not already over. Same predicate as the swarm/jobs read, so a run cannot report differently depending on which endpoint served it. The FE pairs it with `status` to choose the amber 'Needs you' pill over the grey 'Blocked' one β€” a blocked cycle with no open gate is genuinely just blocked.
held_reasonstring | nullWhy this run is WAITING, composed for an accountant from the cycle's OWN measured outputs β€” several short lines: what is happening, whose work it is, the amount as money, where it is written down, and what un-blocks it. Populated from the HOLD STATE (an approval gate with approved_at NULL, parked at awaiting_approval, on a cycle that is not over) β€” never by parsing a rejection string, which a held run does not have. A hold is NOT a failure: it never populates `failure_reason` and never writes cycle.error_context.
held_detailsstring | nullThe reviewer's own words for the hold (workstreams.task.outputs.hold_metadata.question on the parked gate), verbatim and unshortened, for a Details affordance. Never rendered inline and never mined for facts β€” every figure in `held_reason` comes from a step's own recorded output.
completed_stepsintegerSteps that RAN AND FINISHED (completed/approved/done). Skipped steps are NOT counted here β€” they never ran. Card #263: until this field was corrected, a run halted at step 7 of 18 with the remaining steps skipped reported 16 of 18 and rendered a nearly-full bar. Read together with `skipped_steps` and `current_step_index`, which say how far the run actually got and where it stopped.
skipped_stepsintegerSteps that NEVER RAN β€” the run stopped upstream, or a condition excluded them. Not progress and not failure: reported in its own right so a refusal reads as a refusal. `completed_steps + skipped_steps` is NOT a progress figure and must never be rendered as one; the pair exists precisely so the two are not added together again.
total_stepsintegerTotal number of steps in cycle
customer_cost_gbpnumber | nullCustomer-facing cost in GBP: Β£19/hr x elapsed time since cycle start. NULL when the cycle has not yet started. Uses completed_at if available, otherwise current wall-clock time. The real compute cost is never served (CR-COST-01).
tokens_total_inputinteger | nullTotal input tokens across all steps. NULL when none recorded.
tokens_total_outputinteger | nullTotal output tokens across all steps. NULL when none recorded.
artifactsCycleArtifactSummary[]Artifacts produced by this cycle (workstreams.cycle_artifact, non-deleted), newest first, each with a download_url. Surfaced at CYCLE level — step→artifact attribution is a follow-up. Empty when the cycle produced no artifacts.
item shape
workbookCycleWorkbookRefThe workbook a run produced, with its review state (card 011). The API does the fallback, not the frontend: the cycle GET payload carries this field so the Workbook tab renders from it directly β€” a frontend-only guess at step outputs is rejected. ``document_id`` is the file_uploads id of the workbook the latest fill/compile step wrote (``task.outputs.document_id``, which the workbook operations return today); ``state`` is ``reviewed`` when a run-level sign-off record exists, ``not_yet_reviewed`` when that document_id exists but no sign-off does, and ``none`` otherwise.
show nested
input_dataobjectLaunch inputs the cycle was started with (period, file refs, run_mode, etc.), read from workstreams.cycle.runtime_vars β€” the canonical input dict written verbatim on both the inline and containerized launch paths. Empty when the cycle has no recorded launch inputs. Within-workspace only (the endpoint is FGA- + workspace-scoped); redact file names / conversation_id before surfacing this on any cross-org surface.
show nested
Empty object.
400Invalid request or blueprint not found
401Unauthorized
422Validation Error
FieldTypeDescription
detailValidationError[]β€”
item shape
curl https://api.dev.arch.ie/api/v1/workstreams/cycles \
  -X POST \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{
       "input_data": {
         "period": "2025-01"
       },
       "job_definition_id": "550e8400-e29b-41d4-a716-446655440000",
       "priority": 5
     }'
API Reference Β· Archie for developers