# Шаблоны и блоки

> Создание шаблонов и управление их блоками.

Базовый адрес: `https://api.legalstack.ru`. Спецификация: [openapi/smartdoc.json](https://docs.legalstack.ru/openapi/smartdoc.json).

## Операции

| Метод | Путь | Операция |
| --- | --- | --- |
| `POST` | `/api/v1/smartdoc/blocks/batch` | [Получить блоки по списку id](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-blocks-batch) |
| `POST` | `/api/v1/smartdoc/blocks/parent-documents` | [Родительские шаблоны для блоков](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-blocks-parent-documents) |
| `GET` | `/api/v1/smartdoc/blocks/{blockId}` | [Получить блок по id](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-blocks-blockid) |
| `GET` | `/api/v1/smartdoc/blocks/{blockId}/references` | [Ссылки на блок из других шаблонов](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-blocks-blockid-references) |
| `POST` | `/api/v1/smartdoc/decline-name` | [Просклонять ФИО по падежам](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-decline-name) |
| `POST` | `/api/v1/smartdoc/decline-role` | [Просклонять роль стороны по падежам](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-decline-role) |
| `GET` | `/api/v1/smartdoc/documents` | [Список шаблонов](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-documents) |
| `POST` | `/api/v1/smartdoc/documents` | [Создать шаблон](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents) |
| `POST` | `/api/v1/smartdoc/documents/from-template` | [Создать шаблон из библиотеки](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-from-template) |
| `DELETE` | `/api/v1/smartdoc/documents/{id}` | [Удалить шаблон](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/delete-smartdoc-documents-id) |
| `GET` | `/api/v1/smartdoc/documents/{id}` | [Получить шаблон](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-documents-id) |
| `PUT` | `/api/v1/smartdoc/documents/{id}` | [Обновить шаблон](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/put-smartdoc-documents-id) |
| `POST` | `/api/v1/smartdoc/documents/{id}/blocks` | [Добавить блок в шаблон](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-blocks) |
| `DELETE` | `/api/v1/smartdoc/documents/{id}/blocks/{blockId}` | [Удалить блок шаблона](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/delete-smartdoc-documents-id-blocks-blockid) |
| `PATCH` | `/api/v1/smartdoc/documents/{id}/blocks/{blockId}` | [Обновить блок шаблона](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/patch-smartdoc-documents-id-blocks-blockid) |
| `POST` | `/api/v1/smartdoc/documents/{id}/copy` | [Копировать шаблон](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-copy) |
| `POST` | `/api/v1/smartdoc/documents/{id}/link` | [Связать дочерний шаблон](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-link) |
| `PATCH` | `/api/v1/smartdoc/documents/{id}/move` | [Переместить шаблон в папку](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/patch-smartdoc-documents-id-move) |
| `POST` | `/api/v1/smartdoc/documents/{id}/project-now` | [Применить накопленные правки совместного редактирования к блокам](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-project-now) |
| `POST` | `/api/v1/smartdoc/documents/{id}/restore/{versionId}` | [Восстановить шаблон из версии](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-restore-versionid) |
| `POST` | `/api/v1/smartdoc/documents/{id}/save` | [Сохранить шаблон целиком](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-save) |
| `GET` | `/api/v1/smartdoc/documents/{id}/suggestions` | [Нерассмотренные предложения агента](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-documents-id-suggestions) |
| `POST` | `/api/v1/smartdoc/documents/{id}/suggestions/resolve-all` | [Принять или отклонить все предложения агента](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-suggestions-resolve-all) |
| `POST` | `/api/v1/smartdoc/documents/{id}/suggestions/{suggestionId}/accept` | [Принять предложение агента](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-suggestions-suggestionid-accept) |
| `POST` | `/api/v1/smartdoc/documents/{id}/suggestions/{suggestionId}/reject` | [Отклонить предложение агента](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-suggestions-suggestionid-reject) |
| `POST` | `/api/v1/smartdoc/documents/{id}/unlink` | [Отвязать дочерний шаблон](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-unlink) |
| `GET` | `/api/v1/smartdoc/documents/{id}/versions` | [Версии шаблона](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-documents-id-versions) |
| `POST` | `/api/v1/smartdoc/documents/{id}/versions` | [Создать версию шаблона](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-documents-id-versions) |
| `GET` | `/api/v1/smartdoc/documents/{id}/versions/compare` | [Сравнить две версии шаблона](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-documents-id-versions-compare) |
| `GET` | `/api/v1/smartdoc/documents/{id}/versions/{versionId}` | [Получить версию шаблона](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-documents-id-versions-versionid) |
| `GET` | `/api/v1/smartdoc/documents/{id}/versions/{versionId}/compare-current` | [Сравнить версию с текущим состоянием](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-documents-id-versions-versionid-compare-current) |
| `GET` | `/api/v1/smartdoc/parties/{recordId}/documents` | [Шаблоны с участием контрагента](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/get-smartdoc-parties-recordid-documents) |
| `POST` | `/api/v1/smartdoc/resync` | [Пересинхронизировать шаблоны команды](https://docs.legalstack.ru/api/smartdoc/smartdoc-documents/post-smartdoc-resync) |
