Cloudflare Workflows deleteBatch: clean up after a Sume job

Cloudflare Workflows can delete up to 100 instances per deleteBatch call. Delete only after the Sume job reaches a terminal event, and keep the job id first.

4 min readSume
All posts

Delete a Workflow instance only after its Sume job has sent a terminal event (job.completed, job.failed or job.canceled) and you have stored the job_id and result. Cloudflare's deleteBatch() removes up to 100 instances per call, along with their stored state, so anything you did not copy out is gone.

What did Cloudflare add?

The changelog entry dated Sep 17, 2026 says delete() removes a single instance and its stored state, and deleteBatch() handles up to 100 instances per call. Read 2026-10-01.

Cleanup calls as written in the Cloudflare changelog, read 2026-10-01.
CallScope
delete()One instance and its stored state
deleteBatch()Up to 100 instances per call

When is a Sume job safe to forget?

Sume sends terminal job events only; there are no progress or partial deliveries. The job events list also includes webhook.delivery, so a delivery attempt is visible on the job. A job can be terminal while its webhook delivery failed, so a Workflow should not treat a missing callback as a lost job. Read it with status_url before deleting, as in Jobs and results.

How do I avoid deleting a duplicate or live instance?

Dedupe on job_id: the webhook docs say to use it as the idempotency key, and delivery is retried up to 10 attempts, so the same terminal event can arrive more than once. Verify the signature before acting; verifyWebhook is importable from Workers because it uses WebCrypto. Then record job_id, status and artifact URLs in storage that outlives the instance, and only then add the instance id to a batch of at most 100.

Retention of the instance itself is a separate question, covered in Cloudflare Workflows 7-day retention.

What should the cleanup order be?

Terminal event received, signature verified, result persisted by job_id, instance ids queued, then deleteBatch() in chunks of 100. If a delivery never arrives, poll status_url rather than deleting an instance that may still be waiting.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume