Preview an undo
const url = 'http://127.0.0.1:8080/v1/actions/example/undo/preview';const options = { method: 'POST', headers: { 'Deedglass-Version': '2026-10-01', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"allow_triggers":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:8080/v1/actions/example/undo/preview \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Deedglass-Version: 2026-10-01' \ --data '{ "allow_triggers": true }'Plans the undo of a Postgres write from what Postgres committed (the decoder’s row images, never the agent’s report), and runs the twelve safety checks without taking a lock. It writes nothing. available is true when no check failed; steps.data holds the first 20 steps (?steps_limit= up to 1,000); policy is a dry run for the console system agent. A signed-in admin or owner (with Deedglass-CSRF) or an org admin key; agent keys get 403 insufficient_scope. Another org’s action is 404 not_found.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The action to undo (act_…).
Header Parameters
Section titled “Header Parameters”The API version (YYYY-MM-DD). Leave it out to use your org’s pinned version (public routes use the latest). An unknown version is 400 api_version_invalid.
Needed when the request uses a Console session (it changes state); without it the answer is 403 csrf_failed. Not sent with an API key.
Query Parameters
Section titled “Query Parameters”Steps to list
Request Body
Section titled “Request Body”object
Let triggers fire again (the triggers check is then a warning).
Examplegenerated
{ "allow_triggers": true}Responses
Section titled “Responses”The preview.
object
The original action’s tool.
No check failed.
“301 rows in public.orders · 301 updates”
Sha256: of the plan; send it to POST /v1/actions/{id}/undo.
object
object
object
object
One step of the plan as a person reads it: expect is the row now (what the action wrote), set what the undo writes back. A sensitive column shows as •••; NULL is null. The full UndoStep schema is in openapi.yaml.
object
One of the twelve safety checks (S23 §3.3). Available means no check failed. The full UndoCheck schema is in openapi.yaml.
object
Columns marked sensitive, “schema.table.column”: shown as ••• and compared by digest.
object
Example
{ "object": "undo_preview", "steps": { "object": "list" }, "policy": { "decision": "allow" }}Headers
Section titled “Headers”This request’s id. Quote it to support; it matches error.request_id.
The API version this response follows.
default
Section titled “default”An error. Every error has this envelope; doc_url explains the code.
object
object
One or more calm sentences with the next step.
The request field, query parameter or header the error is about.
On policy_invalid only. Each problem with its line, code and hint.
One finding about a policy file, with its position and the next step. Codes are stable and listed in docs/POLICY_ERRORS.md. In the policy_invalid error envelope each diagnostic also carries object: policy_diagnostic. The full PolicyDiagnostic schema is in openapi.yaml.
object
One agent action. Its sections mirror the deed’s. status is the one field an agent needs; state is the exact lifecycle state (docs/GATE.md). The Gate’s own responses (POST /v1/actions and its result report) add execution.result and witness.reasons; lists leave both out. The full Action schema is in openapi.yaml.
object
On undo_unavailable only. Every check of the undo, each with its fix. Additive (S23).
One of the twelve safety checks (S23 §3.3). Available means no check failed. The full UndoCheck schema is in openapi.yaml.
object
Example
{ "error": { "type": "invalid_request_error", "code": "not_found", "message": "There's no endpoint at GET /v1/helth. Did you mean /v1/health?", "param": null, "request_id": "req_01j9zr3m5k8q2w7x4t6v0b1c9d", "doc_url": "https://docs.deedglass.com/errors/not_found" }}Headers
Section titled “Headers”This request’s id. Quote it to support; it matches error.request_id.
The API version this response follows.