---
title: "Restore Context"
method: POST
path: "/api/v1/admin/contexts/{context_id}/restore"
tags: ["admin"]
---

# Restore Context

`POST /api/v1/admin/contexts/{context_id}/restore`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/admin/contexts/{context_id}/restore`
- Auth: none declared

Restore a soft-deleted context and the memories its deletion tombstoned.

#1804: clears ``deleted_at`` on the context and on the memories deleted
with it, and marks those memories ``pending`` so the embedding sweep
rebuilds their vectors (about 2,400 an hour; until then recall does not
find them). Memories forgotten before the deletion,
Sleep tombstones and rows the tombstone purge already removed stay gone,
as do the context's neural edges, members' ``allowed_context_ids``
entries and revoked resource tokens.

Default is dry_run=True. 404 for a context with no row (see
``/contexts/recover``), 409 for one that is not deleted, is in a deleted
workspace, or whose name or resource a live context now uses.

## Path parameters

- `context_id` string, uuid, required

## Request body

- ContextRestoreRequest: Restore a soft-deleted context from its rows.
  - `dry_run` boolean: Count only (default); false restores.
  - `new_name` string, nullable: Restore under this name when a live context has taken the old one.

## Response `200`

Successful Response

- ContextRestoreResponse: What a context restore did, or would do on a dry run.
  - `context_id` string, required
  - `workspace_id` string, required
  - `name` string, required
  - `renamed_from` string, nullable, required
  - `deleted_at` string, required
  - `deleted_by` string, nullable, required
  - `memories_restored` integer, required
  - `memories_left_deleted` integer, required
  - `files_restored` integer: Files the deletion purged that come back with the context (#1960)
  - `file_bytes_restored` integer: Their bytes, re-added to the storage usage
  - `warnings` string[], required
  - `dry_run` boolean, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/aa9df1a21db9?raw)
