> 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/ru/apis/ontologies-api.md). Agents can also search and read this documentation through its [MCP server](https://docs.unitlab.ai/~gitbook/mcp).

# API онтологий

Как по HTTP получать список онтологий рабочего пространства, читать, создавать и заменять их.

| Метод и маршрут                 | Что делает                                                                  | Право доступа     |
| ------------------------------- | --------------------------------------------------------------------------- | ----------------- |
| `GET /api/sdk/ontologies/`      | Список онтологий (постранично)                                              | View ontology     |
| `POST /api/sdk/ontologies/`     | Создает онтологию                                                           | Manage ontologies |
| `GET /api/sdk/ontologies/{id}/` | Возвращает онтологию                                                        | View ontology     |
| `PUT /api/sdk/ontologies/{id}/` | Заменяет название, описание и структуру онтологии и сохраняет новую ревизию | Manage ontologies |

Фильтры списка: `title_eq`, `title_like`, `desc_eq`, `desc_like`, `created_before`, `created_after`, `edited_before`, `edited_after` (ISO 8601).

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

```json
{
  "title": "Robot cell QA",
  "description": "Grippers and parts",
  "data_type": "image",
  "structure": {"objects": [], "classifications": [], "skeleton_templates": []}
}
```

`ontology_hash` из ответа — это ID онтологии; передайте его при создании проекта. Соберите `structure` с помощью `OntologyStructure` и `to_dict()` из SDK или скопируйте из существующей онтологии. Подробнее — в разделе [Создание онтологий на Python](https://docs.unitlab.ai/api-sdk-cli/ru/sdks/build-ontologies-in-python.md).

## Связанные материалы <a href="#related" id="related"></a>

[SDK: работа с онтологиями](https://docs.unitlab.ai/api-sdk-cli/ru/sdks/ontology-resources.md) · [API проектов](https://docs.unitlab.ai/api-sdk-cli/ru/apis/projects-api.md)
