<!-- source: https://docs.dreamlake.ai/api/archival @ 0.1.192 b2f973b1 -->
# Memo and folder archival

Archiving removes completed work from active listings while preserving its identity,
content, permissions, project filings and Bindr membership. It is separate from
deletion and tags. Memos and folders expose a nullable `archivedAt` timestamp;
`null` means that the item is not independently archived.

The initial HTTP and web controls are deployed. The complete client contract
targets CLI/TypeScript 0.97.1 and Python 0.33.1 with the matching archive-capable
server. Verify installed versions and the target server independently; upgrading
a client alone does not deploy its server requirements.

## Archive or unarchive

| Resource | Request | Authority |
| --- | --- | --- |
| Memo | `PATCH /namespaces/:slug/notes/:noteId` | The Memo's rename permission |
| Folder | `PATCH /nodes/:id` | Existing project content-write permission |

Send only `{"archived":true}` to archive or `{"archived":false}` to unarchive.
Do not combine the archive field with a rename, visibility change or other edit.
The node route accepts archive changes for folders, not Memo mount nodes, files
or projects. Address a filed Memo through its Memo ID and owning namespace.

```http
PATCH /namespaces/example-team/notes/000000000000000000000001
Authorization: Bearer <token>
Content-Type: application/json

{"archived":true}
```

The successful metadata response includes `archivedAt`. Archive changes use no
body revision and must not discard a client's cached source, baseline or draft.
Before archiving a Memo, the server saves pending collaboration content. If it
cannot safely do so, it refuses the request; a `409` can require a later retry.
An absent collaboration document is safe when no live edits need saving; the
retained body is preserved. Authorization and missing-resource errors retain the
endpoint's normal behavior. A lost response requires reading current state before
deciding whether another mutation is needed.

**CLI**

```bash
dl memos archive "$NOTE_ID" --namespace example-team
dl memos unarchive "$NOTE_ID" --namespace example-team
dl memos list --namespace example-team --include-archived
```

**TypeScript**

```typescript
// dl is an authenticated DreamLake client.
const notes = dl.notes("example-team")
const archived = await notes.archive(noteId)
console.log(archived.archivedAt)
await notes.unarchive(noteId)
const page = await notes.list({ includeArchived: true })
```

**Python**

```python
import dreamlake as dl

note = dl.note("example-team/design-doc")
archived = note.archive()
print(archived.archived_at)
note.unarchive()
notes = dl.list_notes("example-team", include_archived=True)
```

**Tool call**

```javascript
dreamlake_note_update({ noteId, archived: true })
dreamlake_note_update({ noteId, archived: false })
dreamlake_notes_list({ includeArchived: true })
```

Tool examples refer to DreamLake's registered built-in agent tools, with namespace
and authority supplied by their invocation context. They do not claim a portable
MCP registration. The general [Memos API design](/notes/api/) still describes a
future unified handle interface; the current TS namespace call above selects a
namespace, while Python's `note(...)` selects a Memo.

## Active listings and archived folders

`includeArchived=true` includes both active and archived items. It does not mean
"archived only," reveal deleted objects, or bypass permissions. Filtering occurs
before totals, offsets and continuation cursors on filtered discovery endpoints.

| Read | Archive filtering |
| --- | --- |
| `GET /namespaces/:slug/notes` | Active Memos by default; accepts `includeArchived` with catalog search `q` |
| `GET /me/notes/shared` | Active shared Memos by default; accepts `includeArchived` |
| `GET /namespaces/:slug/notes/search` | Content matches use the same filter; continuation binds the archive choice |
| `GET /nodes` | Active node discovery by default; accepts `includeArchived` |
| `GET /nodes/:id/contents` | Legacy complete episode/file inventory when omitted; pass `includeArchived=false` for active-only browsing |
| `GET /namespaces/:slug/projects/:projectSlug/episodes` | Active episode browsing by default; accepts `includeArchived` |
| `GET /nodes/children` | Active children or recursive search results; accepts `includeArchived` |
| `GET /nodes/:id/descendants` | Legacy complete inventory when omitted; pass `includeArchived=false` for active-only descendants |
| `GET /namespaces/:slug/projects/:projectSlug/resources` | Active folder, project or Bindr rows; accepts `includeArchived` |

An archived folder hides its subtree from active project listings without setting
every child's own `archivedAt`. A child can therefore have `archivedAt: null` and
still be hidden through an ancestor. A Memo filed in another active folder remains
discoverable there unless the Memo itself is archived. Association reads continue
to report the Memo's filings: archiving does not unfile it.

Direct authorized reads by ID remain available. Resolving an archived Memo for an
explicit read or unarchive operation must include archived candidates rather than
silently creating a replacement. Keep the archive filter unchanged when continuing
a search cursor; restart the search to change it.

The contents and descendants endpoints preserve their historical complete-inventory
default when `includeArchived` is omitted, so older download clients do not silently
lose archived files or episodes. Browsing callers should send `includeArchived=false`
explicitly. Complete recursive downloads request `true`, including archived paths;
downloading does not restore them. These inventory exceptions do not change the
active-only defaults of node children, resource listings, or episode discovery.

## Folder clients

```bash
dl folders archive "$FOLDER_ID"
dl folders unarchive "$FOLDER_ID"
dl folders list --namespace example-team --project research --include-archived
```

```typescript
await dl.nodes.archive(folderId)
await dl.nodes.unarchive(folderId)
```

```python
from dreamlake.api._client import DreamLakeClient

client = DreamLakeClient()
client.archive_folder(folder_id)
client.unarchive_folder(folder_id)
children = client.get_node_children(folder_id, include_archived=True)
members = client.projects.resources("example-team", "research",
                                   bindr=bindr_id, include_archived=True)
```

The registered folder tool is:

```javascript
dreamlake_folder_archive({ projectId, folderId, archived: true })
dreamlake_folder_archive({ projectId, folderId, archived: false })
```

Folder mutations in built-in tools require `projects:write` scope and the existing
write-tools opt-in. A read-only tool session cannot archive a folder. The server
still checks the authenticated project grant and the target folder. Built-in
Memo update requires its existing write scope and the Memo management permission.

## GraphQL reads

`Note.archivedAt` and `Node.archivedAt` expose independent archival state.
`Node.children(includeArchived: true)` includes archived children and paths;
the default is active-only. The root `episodes` query accepts the same filter.
Memo location and Bindr association fields retain
their associations. Archive mutations remain REST; no GraphQL archive mutation
is introduced.

```graphql
query ArchivedChildren($namespace: String!, $project: String!) {
  project(namespaceSlug: $namespace, projectSlug: $project) {
    id
    children(includeArchived: true) { id name archivedAt }
  }
}
```

## Saved edits restore the path

A successful changed content, metadata or attachment save restores the Memo.
Editing a folder or file, or adding a child, restores its archived folder path.
Memo edits restore the paths of its valid live project filings; explicit unarchive
also restores the path needed to find the item.

Opening, reading, watching or synchronizing unchanged content leaves archive state
intact. Content restoration occurs on durable save, not on a local keystroke or
local RTC commit. A failed write does not restore the item. Independently archived
siblings remain archived, and deleted resources remain deleted.

The web app offers Archive/Unarchive in memo toolbars and note/folder rows, plus
Show archived in listings. See the [Memos reference](/notes/browsing/#archive-notes-and-folders)
for the browsing behavior, and the owning client guides for complete command and
method signatures.

For complete installed-client signatures, see the [CLI and TypeScript archive guide](https://cli.dreamlake.ai/notes/archival/) and [Python archive guide](https://py.dreamlake.ai/notes/archive/).
