Clean up an applied setup
Beta — behind the sonar-onboarding feature flag. Workspaces the flag is off for get 404 FEATURE_DISABLED.
After the first collection, applies the whole clean-up proposal (decision: cleanup, the default): writes its settings through the keyword update path, removes the collected posts they cover (the usage meter is unchanged — first-collection posts are not billed) and writes the setup’s feeds. keep records Keep everything and changes no setting (always allowed — nothing about the collection’s size can refuse it); both write the feeds. undo restores the settings and the removed posts and deletes the feeds the decision created (never a view that was there before or one you made) while the draft lives; deciding again writes them again. Idempotent — repeating a decision returns the same result and creates nothing. A setup that was never applied returns 412 SETUP_NOT_APPLIED; before every collected post is scored the clean-up is not ready and cleanup / keep return 412 SETUP_COLLECTION_NOT_LANDED. The feeds are the setup’s own: a workspace view that happens to share a name is never reused (the new feed gets a numbered suffix).
Authorizations
Clerk API key. Create one in Settings → API Keys. Pass as Authorization: Bearer <key>. Keys carry a scope — read, write (implies read) or admin (implies write) — chosen when the key is minted. Each operation's security requirement (and its x-required-scope extension) names the minimum scope it needs; request the least-privileged key that covers the operations you call.
Path Parameters
The setup draft id (draft_…) or the proposal id it carries.
1 - 191"draft_x2Yk9…"
Body
cleanup (default) applies the whole clean-up proposal and removes the posts it covers; keep = Keep everything (records the decision, changes nothing); undo reverses a Clean up.
cleanup, keep, undo Response
200 response
The outcome of the Clean up commit, Keep everything, or an undo.
cleanup = the proposal was applied and the posts it covers were removed; keep = Keep everything (nothing changed); undone = a Clean up that was reversed.
cleanup, keep, undone 0 <= x <= 90071992547409910 <= x <= 9007199254740991The settings apply wrote without asking, one plain line each.
pending while the feeds are still being planned and written after the decision; ready once feeds is final.
ready, pending Undo skipped these because they changed after the Clean up (kept as they are now).
