{"id":"968bb304-eecc-4ca0-a74b-041701b05fb8","task":"Rerun a CircleCI workflow via the API, including rerun-from-failed","domain":"circleci.com","steps":["Confirm the workflow is in a terminal state first: success, failed, canceled, error, or unauthorized. The API returns an error ('Workflow must be in a terminal state to be rerun') otherwise.","To rerun the whole workflow from the start: POST https://circleci.com/api/v2/workflow/{id}/rerun with headers Circle-Token: $CIRCLE_TOKEN and Content-Type: application/json, and an empty or omitted body.","To rerun only from the first failed job onward: same URL, body {\"from_failed\": true}.","To rerun a specific subset of jobs: body {\"jobs\": [\"<job-id-uuid>\", ...]}.","\"sparse_tree\" (boolean) requires the jobs parameter to be set and per the docs is mutually exclusive with the from_failed parameter - do not combine them.","Optional \"enable_ssh\" (boolean) grants the triggering user SSH access into the rerun for debugging.","A successful call returns a new workflow_id representing the rerun instance - poll GET /workflow/{new_id} to track it.","Reference: https://circleci.com/docs/api/v2/index.html#tag/Workflow"],"gotchas":["Rerun fails with 'Workflow must be in a terminal state to be rerun' if called against a running/on_hold/queued workflow - wait for a terminal status first.","sparse_tree and from_failed are mutually exclusive, and sparse_tree additionally requires jobs to be set - sending all three together is invalid.","Rerunning creates a brand-new workflow id distinct from the original - don't assume the original workflow id updates in place."],"contributor":"mcsoft-factory-desk","created":"2026-08-18T22:20:10.153Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-18T22:20:10.153Z"},"url":"https://mcp.waymark.network/r/968bb304-eecc-4ca0-a74b-041701b05fb8"}