# Vectors

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

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



This reference covers **6 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/ml/vector/create` | [Vector create](#post-v1-ml-vector-create) |
| `POST` | `/v1/ml/vector/add`    | [Vector add](#post-v1-ml-vector-add)       |
| `POST` | `/v1/ml/vector/search` | [Vector search](#post-v1-ml-vector-search) |
| `POST` | `/v1/ml/vector/save`   | [Vector save](#post-v1-ml-vector-save)     |
| `GET`  | `/v1/ml/vector`        | [Vector list](#get-v1-ml-vector)           |
| `GET`  | `/v1/vector/health`    | [Vector health](#get-v1-vector-health)     |

<a id="post-v1-ml-vector-create" />

## POST `/v1/ml/vector/create` [#post-v1mlvectorcreate]

Vector create

| Availability         | Source contract                            |
| -------------------- | ------------------------------------------ |
| Registration         | `config.enable_vector`                     |
| Runtime service      | `vector`                                   |
| Handler dependencies | See handler source and return expressions. |

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

### Request [#request]

**Json** — `VectorCreateRequest`

| Field    | Rust type | Required on input | Notes |
| -------- | --------- | ----------------- | ----- |
| `name`   | `String`  | Yes               |       |
| `dims`   | `usize`   | Yes               |       |
| `metric` | `String`  | Yes               |       |

```rust
struct VectorCreateRequest {
    name: String,
    dims: usize,
    metric: String,
}
```

### 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::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 vector_create(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<VectorCreateRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        let _metric = parse_metric(&req.metric)?;
        db.vector_create_index(&req.name, req.dims, &req.metric)
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"ok": true})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:2896`. Registration: `akasha-daemon/src/main.rs:4570`.

<a id="post-v1-ml-vector-add" />

## POST `/v1/ml/vector/add` [#post-v1mlvectoradd]

Vector add

| Availability         | Source contract                            |
| -------------------- | ------------------------------------------ |
| Registration         | `config.enable_vector`                     |
| Runtime service      | `vector`                                   |
| 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** — `VectorAddRequest`

| Field    | Rust type  | Required on input | Notes |
| -------- | ---------- | ----------------- | ----- |
| `name`   | `String`   | Yes               |       |
| `id`     | `String`   | Yes               |       |
| `vector` | `Vec<f32>` | Yes               |       |

```rust
struct VectorAddRequest {
    name: String,
    id: String,
    vector: Vec<f32>,
}
```

### 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::json!({"ok": true})
```

### 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 vector_add(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<VectorAddRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        let id = uuid::Uuid::parse_str(&req.id)
            .map_err(|_| DaemonError::InvalidRequest("invalid id".into()))?;
        db.vector_add(&req.name, id, &req.vector)
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"ok": true})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:2915`. Registration: `akasha-daemon/src/main.rs:4571`.

<a id="post-v1-ml-vector-search" />

## POST `/v1/ml/vector/search` [#post-v1mlvectorsearch]

Vector search

| Availability         | Source contract                            |
| -------------------- | ------------------------------------------ |
| Registration         | `config.enable_vector`                     |
| Runtime service      | `vector`                                   |
| 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** — `VectorSearchRequest`

| Field    | Rust type  | Required on input | Notes |
| -------- | ---------- | ----------------- | ----- |
| `name`   | `String`   | Yes               |       |
| `vector` | `Vec<f32>` | Yes               |       |
| `k`      | `usize`    | Yes               |       |

```rust
struct VectorSearchRequest {
    name: String,
    vector: Vec<f32>,
    k: usize,
}
```

### 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!({"matches": results})
```

### 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 vector_search(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<VectorSearchRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        state.usage_emitter.emit_vector_search();
        let results = db
            .vector_search(&req.name, &req.vector, req.k)
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"matches": results})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:2935`. Registration: `akasha-daemon/src/main.rs:4572`.

<a id="post-v1-ml-vector-save" />

## POST `/v1/ml/vector/save` [#post-v1mlvectorsave]

Vector save

| Availability         | Source contract                            |
| -------------------- | ------------------------------------------ |
| Registration         | `config.enable_vector`                     |
| Runtime service      | `vector`                                   |
| 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** — `VectorSaveRequest`

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

```rust
struct VectorSaveRequest {
    name: 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 vector_save(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
        Json(req): Json<VectorSaveRequest>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        db.vector_save(&req.name)
            .map_err(|e| DaemonError::InvalidRequest(e.to_string()))?;
        Ok(Json(serde_json::json!({"ok": true})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:2953`. Registration: `akasha-daemon/src/main.rs:4573`.

<a id="get-v1-ml-vector" />

## GET `/v1/ml/vector` [#get-v1mlvector]

Vector list

| Availability         | Source contract                            |
| -------------------- | ------------------------------------------ |
| Registration         | `config.enable_vector`                     |
| Runtime service      | `vector`                                   |
| 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::json!({"indices": db.vector_list()})
```

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

Directly referenced error variants: none in the handler body. 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 vector_list(
        State(state): State<AppState>,
        Extension(db): Extension<Arc<AkashaDB>>,
    ) -> Result<impl IntoResponse, DaemonError> {
        state.record_http_request();
        Ok(Json(serde_json::json!({"indices": db.vector_list()})))
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:2964`. Registration: `akasha-daemon/src/main.rs:4574`.

<a id="get-v1-vector-health" />

## GET `/v1/vector/health` [#get-v1vectorhealth]

Vector health

| Availability         | Source contract                            |
| -------------------- | ------------------------------------------ |
| Registration         | `config.enable_vector`                     |
| Runtime service      | `vector`                                   |
| 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>`

Serialization is delegated or the handler returns a raw response. Consult the exact handler below; the OpenAPI response intentionally remains unconstrained.

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

Directly referenced error variants: none in the handler body. 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 vector_health(State(state): State<AppState>) -> Result<impl IntoResponse, DaemonError> {
        service_health_payload(&state, "vector").await
    }
    ```
  </Accordion>
</Accordions>

Source: `akasha-daemon/src/main.rs:10289`. Registration: `akasha-daemon/src/main.rs:4575`.
