---
title: Cleanup
description: Remove the records an apply receipt proves DomainKit created, with the same review the customer gave the plan.
---

`Cleanup.Flow` plans the removal from an apply receipt and reviews it the same way provisioning
does.

<ReactExample story="cleanup" />

## Usage

<Snippet file="examples/react/catalog.tsx" region="cleanup" title="The cleanup step" />

## What it removes

Only records the receipt proves DomainKit created, and only while they still match exactly. A
record someone edited by hand becomes a conflict and is left alone, and the dialog says so.

Pass `receiptId` to clean a specific apply. Without one, the controller uses the domain's latest
provisioning receipt, which is what `Domain.Flow` does.

## Parts

The same set as provisioning: `Cleanup.Dialog`, `Cleanup.Actions`, `Cleanup.Status`, and
`Cleanup.Outcome`, wording adjusted for removal.

## Composing it yourself

`Cleanup.useController({ domain, receiptId?, onCleaned? })` runs the same machine as
`Provision.useController`. See [controllers](/docs/react/controllers).
