---
title: "Undo a memory-evolution auto-archive within the configured window"
method: POST
path: "/api/contexts/{id}/undo-archive"
tags: ["Contexts"]
---

# Undo a memory-evolution auto-archive within the configured window

`POST /api/contexts/{id}/undo-archive`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/contexts/{id}/undo-archive`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

Restores the row's pre-archive lifecycle (default `working` when the original value can't be recovered). Window defaults to 72h (`EVOLUTION_ARCHIVE_UNDO_WINDOW_HOURS`, clamped to [1h, 720h]).

## Path parameters

- `id` integer, required

## Response `200`

Restored.

- object
  - `id` integer
  - `lifecycle` string
  - `archived_at` string, date-time, nullable

## Other responses

- `400`: Invalid id.
- `401`: Missing or invalid credentials.
- `404`: Context not found, or no archive event found to undo.
- `410`: The undo window has expired.

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
