Skip to main content
A dry run runs the same request as the real one and stops before it saves anything. The response shows what would change. An agent should preview every change that it cannot undo, show the preview to the person, and run the real request only after the person agrees. This recipe previews and then deletes a custom detection rule pack. Deleting a pack stops its rules within about 60 seconds. The findings it already made stay. Both steps need findings:write.

Operations that support dry runs

Add dry_run=true to the query of these operations. Each one returns a preview and changes nothing. The OpenAPI contract lists the parameter on each of them.

Preview the delete

Find the pack ID with squasher detections list. The built-in pack cannot be deleted.
The status is 200, and nothing is deleted. The response is the pack that would be deleted, with the rules that would stop running:
Check enabled and rules. A pack with enabled: true is running now, so a delete removes live detection. If you want to keep the rules, turn the pack off instead with detections.disable.

Run the delete

The real delete needs an Idempotency-Key, so that a retry after a network error deletes once and returns the first response. Use a new key for each change. A request without a key returns 400 with This operation needs an Idempotency-Key header. The CLI sends a new key for you. Pass --idempotency-key to choose it.
Without --yes, the command asks you to confirm. In a script, an agent, or CI, it fails with exit code 2 and the code confirmation_required instead of asking.
Check the result with squasher detections list. The pack is gone. A repeat of the same request with the same key returns the first response. The same key with a different request returns 422.
Deleting a pack cannot be undone. The rules stop at ingest within about 60 seconds. To restore them, create the pack again from your rule files.

Next steps

Detections API

Every pack operation, with its access and idempotency rules.

Detection rules

Keep rule packs as code and test them with a backtest.