Apply a setup proposal
Beta — behind the sonar-onboarding feature flag. Workspaces the flag is off for get 404 FEATURE_DISABLED.
Creates the proposal’s kept keywords with only their quiet settings (tag, exact match, skipped words, excluded authors, platforms, context — the brand’s term set waits for the Clean up) and turns off the non-core sources the proposal flags (P2). Every hard gate runs again first: a failure returns 400 SETUP_GATE_VIOLATION with the violations and writes nothing. A proposal made before the company profile was last edited is stale: 409 SETUP_PROPOSAL_STALE (propose again first). Idempotent — a second call creates nothing and returns the same keyword ids, and a retry after a failure part-way resumes where it stopped. Once an apply has started, the attempt is locked: a retry must use the same selections (or none), and different ones return 409 SETUP_APPLY_IN_PROGRESS with the recorded selections; a concurrent apply gets the same 409 and writes nothing. Changing the workspace platforms needs an admin-scoped key (403 SETUP_ADMIN_SCOPE_REQUIRED). A proposal whose volumes are still placeholders (a platform that did not answer within the proposal’s per-platform budget) is measured in full before any gate decides on it; when that measurement cannot finish, apply returns 503 SETUP_MEASUREMENT_PENDING and writes nothing — retry in a few seconds.
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
What the user kept. Omitted = every keyword selected by default.
Response
200 response
What apply created: one keyword per kept proposal keyword with only its quiet settings, and the workspace platforms. Idempotent — a re-run returns the same ids.
