> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/de/apis/embedding-spaces-api.md).

# Embedding Spaces API

Embedding Spaces API von Unitlab: Embedding Spaces anlegen, Vektoren schreiben und per HTTP eine Ähnlichkeitssuche über Dateien und Frames ausführen.

Alle Routen liegen unter `https://api.unitlab.ai/api/sdk/embedding-spaces/` und erfordern **Manage data**. Die Suche funktioniert auch mit **View labeling interface**.

| Methode und Route                     | Body                                                                        |
| ------------------------------------- | --------------------------------------------------------------------------- |
| `GET embedding-spaces/`               |                                                                             |
| `POST embedding-spaces/`              | `{"name", "dimensions", "model_name"}`; `dimensions` 1 bis 4.096            |
| `GET embedding-spaces/{id}/`          |                                                                             |
| `DELETE embedding-spaces/{id}/`       |                                                                             |
| `POST embedding-spaces/{id}/vectors/` | `{"items": [{"asset_id", "vector", "frame_index"}]}`, bis zu 1.000 Einträge |
| `POST embedding-spaces/{id}/search/`  | `{"vector", "limit", "project_id", "level"}`                                |

```bash
curl -s -X POST "https://api.unitlab.ai/api/sdk/embedding-spaces/$SPACE_ID/search/" \
  -H "Authorization: Api-Key $UNITLAB_API_KEY" -H "Content-Type: application/json" \
  -d @query.json
```

```json
{
  "results": [
    {"asset_id": "3f2b...", "frame_index": null, "score": 0.912345, "file_name": "cell04_0117_front.jpg"}
  ],
  "count": 1
}
```

| Suchfeld     | Standard | Werte                         |
| ------------ | -------- | ----------------------------- |
| `vector`     | Pflicht  | Die Länge des Space           |
| `limit`      | 20       | 1 bis 100                     |
| `project_id` | Keiner   | Nur Dateien in diesem Projekt |
| `level`      | `asset`  | `asset` oder `frame`          |

`score` ist die Kosinus-Ähnlichkeit. Ein Vektor für eine Datei oder einen Frame, die bereits einen haben, ersetzt den vorhandenen; die Antwort zählt `created` und `updated`. Während der Index aufgebaut wird, antwortet die Suche mit 409 und `index_status`. Ein Workspace kann standardmäßig 32 Spaces enthalten.

## Verwandte Themen <a href="#related" id="related"></a>

[SDK: Embedding Spaces](https://docs.unitlab.ai/api-sdk-cli/de/sdks/embedding-spaces.md) · [SDK: Upsert und Suche](https://docs.unitlab.ai/api-sdk-cli/de/sdks/upsert-and-search-vectors.md)
