Workflows, Workers - Delete Workflow instances individually or in batches
From the publisher
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.
Source Cloudflare DevelopersCC BY 4.0 · Publisher excerpt shortened and converted to plain text. Original source license applies.
Read full article

