# Cancel a Running Workstream Run

> Stops a workstream cycle that is running, so an accountant can halt work that was started by mistake or is no longer needed. It needs the cycleid and…

POST /api/v1/skills/workstream.cancel/invoke

Stops a workstream cycle that is running, so an accountant can halt work that was started by mistake or is no longer needed. It needs the cycle_id and accepts an optional reason that is kept in the audit trail, and a person is asked to confirm before Archie cancels the cycle. It returns the cycle_id and its status, which is cancelled on success.

Body parameters

cycle_id string · uuid or string Required

The cycle to cancel (UUID or permakey). Identified by `cycle_id` from `workstream_run`.

reason string

Audit trail. Strongly recommended.

idempotency_key string

Caller-supplied stable token. Replaying within 24h returns the same cancellation result rather than erroring on the already-cancelled cycle.

Returns

Skill executed successfully

skill string Required

Example workstream_cancel

output object Required

Cycle state after cancellation.

output.stub_fields array of strings

output.warnings array of strings

output.cycle_id string · uuid

The cycle that was cancelled.

output.run_id string · uuid Deprecated

output.status enum · default cancelled

`cancelled` on success; `failed` if the cancel signal could not be delivered.

cancelled failed

output.error string Deprecated

output.error_envelope

Canonical structured error. Populated when `status == 'failed'`.

correlation_id string Required

Errors

Status Type When

401 AUTH.TOKEN_INVALID Authentication required

403 PERMISSION.CAPABILITY_DENIED Insufficient permissions

404 SKILL.NOT_FOUND Skill not found

422 VALIDATION.INVALID_FORMAT Validation error

429 RATE_LIMIT.USER Rate limit exceeded

5XX INTERNAL.UNKNOWN Internal server error

[Previous ← Advance a Paused or Awaiting-Approval Workstream Run](https://heyarchie.com/en-gb/developers/api-reference/workstreams/advance-a-paused-or-awaiting-approval-workstream-run/)[Next Delete a Workstream →](https://heyarchie.com/en-gb/developers/api-reference/workstreams/delete-a-workstream/)

```
curl https://uk.heyarchie.com/api/v1/skills/workstream.cancel/invoke \
  -X POST \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{
       "cycle_id": null,
       "reason": null,
       "idempotency_key": null
     }'
```

```
from heyarchie import Archie
archie = Archie(api_key="sk_...")
result = archie.skills.invoke(
    "workstream.cancel",
    cycle_id=None,
    reason=None,
    idempotency_key=None,
)
print(result)
```

```
import { Archie } from "heyarchie";

const archie = new Archie({ apiKey: "sk_..." });
const result = await archie.skills.invoke("workstream.cancel", {
  "cycle_id": null,
  "reason": null,
  "idempotency_key": null
});
console.log(result);
```

Response

```
{
  "skill": "workstream_cancel",
  "output": {
    "cycle_id": "b7d4e2a1-9c3f-4e58-a6b2-1f0d3c5e7a94",
    "status": "cancelled"
  },
  "correlation_id": "<string>"
}
```

```
{
  "error": {
    "type": "<string>",
    "code": "<string>",
    "message": "<string>",
    "param": "<string>",
    "retry_after_seconds": "<integer>"
  }
}
```

Every response also carries X-Request-ID. Quote it if you write to us about a call.
