Catalog / Cloudflare Developer Platform
Workflows, Workers - Delete Workflow instances individually or in batches
You can now delete one or up to 100 Workflow instances and their stored state via the Workflows API or Wrangler 4.125.0 and later. Deleting an instance frees its stored state and stops its current execution. Storage billing is based on the average daily peak.
Delete one instance by calling delete() on its handle:
const instance = await env.MY_WORKFLOW.get("instance-abc");
await instance.delete();
If a Workflow deletes its own instance, execution stops during await instance.delete(). Code after the call does not run.
Delete multiple instances by calling deleteBatch() on the Workflow binding:
const result = await env.MY_WORKFLOW.deleteBatch([
"instance-abc",
"instance-def",
]);
console.log(result.deleted);
console.log(result.errors);
The batch result contains { id } entries for successful deletions and per-instance errors. IDs that do not exist are returned as errors. Duplicate IDs count toward the limit and are deleted once, with the result repeated for each input position.
Wrangler accepts positional instance IDs, a file containing a top-level JSON array of strings, or both, up to 100 IDs total. Use latest to delete the most recently created instance. Use --local against a local wrangler dev session:
["instance-abc", "instance-def"]
npx wrangler workflows instances delete my-workflow <INSTANCE_ID>
npx wrangler workflows instances delete my-workflow <INSTANCE_ID> <INSTANCE_ID>
npx wrangler workflows instances delete my-workflow latest
npx wrangler workflows instances delete my-workflow --filename ./instance-ids.json
npx wrangler workflows instances delete my-workflow <INSTANCE_ID> --local
For more information, refer to Delete Workflow instances, delete, and deleteBatch.