# Maintenance

Every registered maintenance instance operation, with source-derived inputs, outputs, access policy, and errors.

Source: https://docs.minds.sh/docs/api/instance/maintenance



This reference covers **9 HTTP operations** registered by the Akasha daemon. Call these paths on your instance base URL. See [authentication](/docs/api/instance/authentication), [errors](/docs/api/instance/errors), and [coverage](/docs/api/instance/coverage) before integrating.

| Method | Path                  | Operation                                  |
| ------ | --------------------- | ------------------------------------------ |
| `POST` | `/v1/backups`         | [Backup create](#post-v1-backups)          |
| `POST` | `/v1/backups/list`    | [Backup list](#post-v1-backups-list)       |
| `POST` | `/v1/backups/restore` | [Backup restore](#post-v1-backups-restore) |
| `POST` | `/v1/backups/delete`  | [Backup delete](#post-v1-backups-delete)   |
| `POST` | `/v1/analyze`         | [Analyze](#post-v1-analyze)                |
| `POST` | `/v1/compact`         | [Compact](#post-v1-compact)                |
| `POST` | `/v1/reindex`         | [Reindex](#post-v1-reindex)                |
| `POST` | `/v1/clear_cache`     | [Clear cache](#post-v1-clear-cache)        |
| `POST` | `/v1/search/text`     | [Core text search](#post-v1-search-text)   |

<a id="post-v1-backups" />

## POST `/v1/backups` [#post-v1backups]

Backup create

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request]

**Json** — `BackupCreateRequest`

| Field        | Rust type                           | Required on input         | Notes            |
| ------------ | ----------------------------------- | ------------------------- | ---------------- |
| `backup_dir` | `String`                            | Yes                       |                  |
| `options`    | `Option<akasha::CoreBackupOptions>` | No; optional or defaulted | Serde: `default` |

```rust
struct BackupCreateRequest {
    backup_dir: String,
    #[serde(default)]
    options: Option<akasha::CoreBackupOptions>,
}
```

### Response [#response]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::to_value(info).unwrap_or(serde_json::json!({"ok":true})),
```

### Errors and validation [#errors-and-validation]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn backup_create(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<BackupCreateRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        let opts = req.options.unwrap_or_default();
        let info = db
            .backup_create(std::path::Path::new(&req.backup_dir), opts)
            .await
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(
            serde_json::to_value(info).unwrap_or(serde_json::json!({"ok":true})),
        ))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3067`. Registration: `akasha-daemon/src/main.rs:4594`.

<a id="post-v1-backups-list" />

## POST `/v1/backups/list` [#post-v1backupslist]

Backup list

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request-1]

**Json** — `BackupListRequest`

| Field        | Rust type | Required on input | Notes |
| ------------ | --------- | ----------------- | ----- |
| `backup_dir` | `String`  | Yes               |       |

```rust
struct BackupListRequest {
    backup_dir: String,
}
```

### Response [#response-1]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::to_value(list).unwrap_or(serde_json::json!([])),
```

### Errors and validation [#errors-and-validation-1]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn backup_list(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<BackupListRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        let list = db
            .backup_list(std::path::Path::new(&req.backup_dir))
            .await
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(
            serde_json::to_value(list).unwrap_or(serde_json::json!([])),
        ))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3088`. Registration: `akasha-daemon/src/main.rs:4595`.

<a id="post-v1-backups-restore" />

## POST `/v1/backups/restore` [#post-v1backupsrestore]

Backup restore

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request-2]

**Json** — `BackupRestoreRequest`

| Field        | Rust type                            | Required on input         | Notes            |
| ------------ | ------------------------------------ | ------------------------- | ---------------- |
| `backup_dir` | `String`                             | Yes                       |                  |
| `id`         | `String`                             | Yes                       |                  |
| `options`    | `Option<akasha::CoreRestoreOptions>` | No; optional or defaulted | Serde: `default` |

```rust
struct BackupRestoreRequest {
    backup_dir: String,
    id: String,
    #[serde(default)]
    options: Option<akasha::CoreRestoreOptions>,
}
```

### Response [#response-2]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::json!({"ok": true})
```

### Errors and validation [#errors-and-validation-2]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn backup_restore(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<BackupRestoreRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        let opts = req.options.unwrap_or_default();
        db.backup_restore(std::path::Path::new(&req.backup_dir), &req.id, opts)
            .await
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"ok": true})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3111`. Registration: `akasha-daemon/src/main.rs:4596`.

<a id="post-v1-backups-delete" />

## POST `/v1/backups/delete` [#post-v1backupsdelete]

Backup delete

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request-3]

**Json** — `BackupDeleteRequest`

| Field        | Rust type | Required on input | Notes |
| ------------ | --------- | ----------------- | ----- |
| `backup_dir` | `String`  | Yes               |       |
| `id`         | `String`  | Yes               |       |

```rust
struct BackupDeleteRequest {
    backup_dir: String,
    id: String,
}
```

### Response [#response-3]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::json!({"ok": true})
```

### Errors and validation [#errors-and-validation-3]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn backup_delete(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<BackupDeleteRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        db.backup_delete(std::path::Path::new(&req.backup_dir), &req.id)
            .await
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"ok": true})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3130`. Registration: `akasha-daemon/src/main.rs:4597`.

<a id="post-v1-analyze" />

## POST `/v1/analyze` [#post-v1analyze]

Analyze

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request-4]

No typed JSON, query, or path extractor is declared in the handler signature. Headers or request objects may still be consumed; the signature below is authoritative.

### Response [#response-4]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::to_value(a).unwrap_or(serde_json::json!({})),
```

### Errors and validation [#errors-and-validation-4]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn analyze(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        let a = db
            .analyze()
            .await
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(
            serde_json::to_value(a).unwrap_or(serde_json::json!({})),
        ))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3305`. Registration: `akasha-daemon/src/main.rs:4598`.

<a id="post-v1-compact" />

## POST `/v1/compact` [#post-v1compact]

Compact

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request-5]

No typed JSON, query, or path extractor is declared in the handler signature. Headers or request objects may still be consumed; the signature below is authoritative.

### Response [#response-5]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::json!({"ok": true})
```

### Errors and validation [#errors-and-validation-5]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn compact(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        db.compact()
            .await
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"ok": true})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3319`. Registration: `akasha-daemon/src/main.rs:4599`.

<a id="post-v1-reindex" />

## POST `/v1/reindex` [#post-v1reindex]

Reindex

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request-6]

**Json** — `ReindexRequest`

| Field      | Rust type | Required on input | Notes |
| ---------- | --------- | ----------------- | ----- |
| `keyspace` | `String`  | Yes               |       |

```rust
struct ReindexRequest {
    keyspace: String,
}
```

### Response [#response-6]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::json!({"ok": true})
```

### Errors and validation [#errors-and-validation-6]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn reindex(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<ReindexRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        db.rebuild_index(&req.keyspace)
            .await
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"ok": true})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3340`. Registration: `akasha-daemon/src/main.rs:4600`.

<a id="post-v1-clear-cache" />

## POST `/v1/clear_cache` [#post-v1clear_cache]

Clear cache

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request-7]

No typed JSON, query, or path extractor is declared in the handler signature. Headers or request objects may still be consumed; the signature below is authoritative.

### Response [#response-7]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::json!({"ok": true})
```

### Errors and validation [#errors-and-validation-7]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn clear_cache(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        db.clear_cache()
            .await
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"ok": true})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3362`. Registration: `akasha-daemon/src/main.rs:4601`.

<a id="post-v1-search-text" />

## POST `/v1/search/text` [#post-v1searchtext]

Core text search

| Availability         | Source contract                                                  |
| -------------------- | ---------------------------------------------------------------- |
| Registration         | `config.enable_kv \|\| config.enable_analytics`                  |
| Runtime service      | No prefix-level service check; handler dependencies still apply. |
| Handler dependencies | See handler source and return expressions.                       |

**Access:** Daemon authentication and capability namespace authority; memory-domain permissions apply where mapped.

### Request [#request-8]

**Json** — `CoreTextSearchRequest`

| Field      | Rust type       | Required on input         | Notes |
| ---------- | --------------- | ------------------------- | ----- |
| `keyspace` | `String`        | Yes                       |       |
| `query`    | `String`        | Yes                       |       |
| `limit`    | `Option<usize>` | No; optional or defaulted |       |

```rust
struct CoreTextSearchRequest {
    keyspace: String,
    query: String,
    limit: Option<usize>,
}
```

### Response [#response-8]

**Declared return:** `Result<impl IntoResponse, DaemonError>`

The following are the exact JSON construction expressions in the handler. Values such as `rows`, `result`, and delegated types are runtime values, not literal example payloads.

```rust
serde_json::json!({"rows": rows})
```

### Errors and validation [#errors-and-validation-8]

Directly referenced error variants: `InvalidRequest`. Middleware and delegated services can return additional errors described in the shared error reference.

<Accordions>
  <Accordion title="Inspect implementation">
    This exact source excerpt includes validation, defaults, delegated calls, and response assembly.

    ```rust
    async fn core_text_search(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<CoreTextSearchRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        let rows = db
            .core_text_search(&req.keyspace, &req.query, req.limit.unwrap_or(10))
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"rows": rows})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:3380`. Registration: `akasha-daemon/src/main.rs:4602`.
