---
title: "Undo Learning"
method: POST
path: "/api/domains/{domain_id}/agent-desk/learnings/{version_id}/undo"
tags: ["agent_desk"]
---

# Undo Learning

`POST /api/domains/{domain_id}/agent-desk/learnings/{version_id}/undo`

## Request

- Base URL: `https://api-v1.unusual.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api-v1.unusual.ai/api/domains/{domain_id}/agent-desk/learnings/{version_id}/undo`
- Auth: OAuth 2
  - Password
  - Token URL: `/auth/login`

"Undo": put the previous wording back, and stop asking the test it attached.

D28's other half. A knowledge learning applies itself the moment it is drafted,
which is only a safe trade because taking it back is one tap. This is that tap. It
works for every lane that applies something — an auto-applied knowledge learning, a
rules learning the owner tapped "Apply it" on, and (AGENTDESK-RD(w4)) an automatic
SITE UPDATE the changed-page watch published — because the thing being undone is an
ACTIVATION, and all of them activate through the same door and carry the same
applied stamp.

THREE THINGS HAPPEN, and the order is the order of what matters:

1. **The previous wording goes back live**, as a NEW version
   (`control_documents.roll_back_to_previous` — the same "Go back to this
   wording" mechanism the document history offers). Activating it supersedes the
   version being undone, which is exactly the state a second undo has to be
   refused on, so the guard closes itself.
2. **The attached test is retired**, by its `source_review_id` link. A test that
   keeps asking about a wording the desk no longer uses is a check that fails
   forever by design.
3. **The review is left as it is.** It IS incorporated — a version really did
   fold it in — and `reviews.update_review` refuses to reopen a review on
   purpose ("A review cannot be reopened"): the record of why v8 said what it
   said must survive v9. "Correct it again" writes a NEW correction, which is
   what the surface offers and what the loop is built for.

THREE REFUSALS, all 409 with a sentence the owner can act on:

* not a memory — neither a learning nor a site update (nothing to undo in one tap),
* not the live version any more — something newer is active, and silently
  rolling THAT back is the one thing an undo button must never do,
* there is no earlier wording to go back to (the first Knowledge Document a
  desk ever had).

(There were four until Will retired the 24-hour window on 2026-08-07. The one that
went is "expired", and with it the only refusal an owner could not have predicted
from what was on their screen.)

`get_user` is required for the same reason the approval endpoint requires it:
this writes to a live document, and an unattributed write on an authenticated
surface is not something to leave possible.

## Path parameters

- `version_id` string, required
- `domain_id` string, required

## Headers

- `x-view-as` string, nullable

## Response `200`

Successful Response

- LearningUndoOut: What the undo did, in the words the row can render.
  - `undone` boolean, required
  - `kind` string, required
  - `undone_version_number` integer, required
  - `restored_version_number` integer, required
  - `rollback_version_number` integer, required
  - `retired_test_ids` string[]
  - `detail` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/unusual/apis/dashboard-server.md) - [All operations](https://skmtc.dev/unusual/apis/dashboard-server/llms.txt) - [OpenAPI document](https://skmtc.dev/unusual/apis/dashboard-server/revisions/89f716930ead?raw)
