Evolutrix CRM Rest API | Шаблоны документов (1.0.0)
Download OpenAPI specification:Download
Описание Rest API — методов для взаимодействия с шаблонами документов.
config
Возвращает конфигурацию модуля: доступные типы секций, действия, лимиты.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
Responses
Response samples
- 200
- 401
- 403
{- "success": true,
- "data": {
- "available_section_types": [
- "client",
- "event",
- "general"
], - "available_actions": [
- "download"
], - "has_default_disk": true,
- "max_templates_count": 50,
- "current_templates_count": 12
}, - "message": "ОК"
}index
Возвращает список шаблонов документов с пагинацией.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
query Parameters
| page | integer Номер страницы (для постраничной пагинации). |
| cursor | string Курсор (для курсорной пагинации). |
| sort_by | string Default: "id" Enum: "id" "title" "created_at" Поле сортировки. |
| descending | boolean Флаг обратного направления сортировки. |
| per_page | integer Default: 10 Enum: 10 25 50 Кол-во отображаемых записей на странице. |
| search | string Произвольный текстовый запрос для поиска записей. |
| status | string Enum: "draft" "published" Фильтр по статусу шаблона (draft, published). |
| type_id | integer Фильтр по ID типа шаблона. |
| types | Array of integers Массив ID типов для фильтрации. |
| has_tags | Array of integers Массив ID меток, которые ДОЛЖНЫ быть у шаблона. |
Responses
Response samples
- 200
- 400
- 401
- 403
{- "success": true,
- "data": {
- "doc_templates": [
- {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "type": {
- "id": 8,
- "title": "Название типа",
- "class": "TYPE_CLASS",
- "position": 7,
- "color": "#4C75A3",
- "icon": "fa-brands fa-type-class",
- "is_system": false,
- "created_at": "2024-01-18T14:41:42.000000Z",
- "updated_at": "2024-01-18T14:41:42.000000Z"
}, - "tags": [
- {
- "id": 224,
- "title": "Название тега",
- "class": "TAG_CLASS",
- "position": 24,
- "color": "#915935",
- "created_at": "2024-01-18T14:41:47.000000Z",
- "updated_at": "2024-01-18T14:41:47.000000Z"
}
], - "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}
], - "meta": {
- "current_page": 3,
- "from": 1,
- "last_page": 5,
- "links": [
- {
- "label": "« Назад",
- "active": false
}, - {
- "url": "/resource?per_page=10&page=2",
- "label": "2",
- "active": false
}, - {
- "url": "/resource?per_page=10&page=3",
- "label": "3",
- "active": false
}, - {
- "url": "/resource?per_page=10&page=2",
- "label": "Вперёд »",
- "active": false
}
], - "path": "/resource/resource",
- "per_page": 15,
- "to": 15,
- "total": 75
}, - "links": {
- "first": "/resource?per_page=10&page=1",
- "last": "/resource?per_page=10&page=10",
- "next": "/resource?per_page=10&page=2"
}
}, - "message": "ОК"
}store
Создаёт новый шаблон документа. Файл .docx обязателен при публикации.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
Request Body schema: multipart/form-datarequired
Данные создаваемого шаблона
| file | string <binary> Файл шаблона (.docx) |
| status | string Enum: "draft" "published" Статус (draft, published) |
| title | string Название шаблона (обязательно при публикации) |
| description | string Описание шаблона |
| type_id | integer ID типа шаблона |
| tag_ids | Array of integers Массив ID меток |
Array of objects | |
| default_action | string Enum: "download" "save_to_storage" "save_and_download" Действие по умолчанию |
| save_to_storage | boolean Сохранять ли на внешний диск |
| save_path | string Путь сохранения |
| default_file_type_id | integer ID типа файла по умолчанию |
| default_file_tag_ids | Array of integers Массив ID меток файла |
Array of objects |
Responses
Request samples
- Payload
{ "title": "Договор оказания услуг", "status": "draft", "file": "template.docx" }
Response samples
- 200
- 400
- 401
- 403
{- "success": true,
- "data": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "type": {
- "id": 8,
- "title": "Название типа",
- "class": "TYPE_CLASS",
- "position": 7,
- "color": "#4C75A3",
- "icon": "fa-brands fa-type-class",
- "is_system": false,
- "created_at": "2024-01-18T14:41:42.000000Z",
- "updated_at": "2024-01-18T14:41:42.000000Z"
}, - "tags": [
- {
- "id": 224,
- "title": "Название тега",
- "class": "TAG_CLASS",
- "position": 24,
- "color": "#915935",
- "created_at": "2024-01-18T14:41:47.000000Z",
- "updated_at": "2024-01-18T14:41:47.000000Z"
}
], - "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "sections": [
- {
- "id": 1,
- "section_type": "client"
}
], - "custom_variables": [
- {
- "id": 1,
- "name": "Номер договора",
- "slug": "contract_number",
- "placeholder": "${custom.contract_number}",
- "description": "Номер договора клиента",
- "data_type": "string",
- "is_required": true,
- "sort_order": 0
}
], - "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}my draft
Возвращает черновик текущего пользователя. 404 если черновика нет.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
Responses
Response samples
- 200
- 401
- 404
{- "success": true,
- "data": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "type": {
- "id": 8,
- "title": "Название типа",
- "class": "TYPE_CLASS",
- "position": 7,
- "color": "#4C75A3",
- "icon": "fa-brands fa-type-class",
- "is_system": false,
- "created_at": "2024-01-18T14:41:42.000000Z",
- "updated_at": "2024-01-18T14:41:42.000000Z"
}, - "tags": [
- {
- "id": 224,
- "title": "Название тега",
- "class": "TAG_CLASS",
- "position": 24,
- "color": "#915935",
- "created_at": "2024-01-18T14:41:47.000000Z",
- "updated_at": "2024-01-18T14:41:47.000000Z"
}
], - "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "sections": [
- {
- "id": 1,
- "section_type": "client"
}
], - "custom_variables": [
- {
- "id": 1,
- "name": "Номер договора",
- "slug": "contract_number",
- "placeholder": "${custom.contract_number}",
- "description": "Номер договора клиента",
- "data_type": "string",
- "is_required": true,
- "sort_order": 0
}
], - "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}detect sections
Детекция разделов по плейсхолдерам ${section.key} в .docx файле.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
Request Body schema: multipart/form-datarequired
Загрузка .docx файла для анализа
| file required | string <binary> Файл .docx для анализа (макс. 5MB) |
Responses
Request samples
- Payload
{ "file": "template.docx" }
Response samples
- 200
- 400
- 401
{- "success": true,
- "data": {
- "sections": [
- "client",
- "event"
], - "variables": {
- "client": [
- "full_name",
- "phone",
- "email"
], - "event": [
- "date",
- "title"
]
}, - "custom_slugs": [
- "contract_number"
], - "function_variables": [
- {
- "function": "date_diff",
- "formula": "date_diff(${client.birthday}, ${event.date}, d)",
- "slug": "age_days"
}
]
}, - "message": "ОК"
}auto generate
Автогенерация шаблона: анализ загруженного .docx, распознавание полей и секций.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
Request Body schema: multipart/form-datarequired
Загрузка .docx файла для анализа
| file required | string <binary> Файл .docx для анализа (макс. 5MB) |
Responses
Request samples
- Payload
{ "file": "template.docx" }
Response samples
- 200
- 400
- 401
{- "success": true,
- "data": {
- "fields": [
- {
- "key": "full_name",
- "label": "ФИО",
- "section": "client"
}
], - "sections": [
- "client",
- "event"
], - "stats": {
- "total_placeholders": 12,
- "matched": 10,
- "unmatched": 2
}, - "temp_file_path": "auto_generated/abc123.docx",
- "original_name": "template.docx"
}, - "message": "ОК"
}auto generate save
Сохранение автогенерированного шаблона как нового шаблона.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
Request Body schema: application/jsonrequired
Данные для сохранения автогенерированного шаблона
| temp_file_path required | string Путь к temp-файлу автогенерации |
| title required | string Название шаблона |
| description | string Описание шаблона |
Array of objects | |
| default_action | string Enum: "download" "save_to_storage" "save_and_download" Действие по умолчанию |
Array of objects |
Responses
Request samples
- Payload
{- "temp_file_path": "auto_generated/abc123.docx",
- "title": "Автогенерированный шаблон"
}Response samples
- 200
- 400
- 401
- 404
{- "success": true,
- "data": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "type": {
- "id": 8,
- "title": "Название типа",
- "class": "TYPE_CLASS",
- "position": 7,
- "color": "#4C75A3",
- "icon": "fa-brands fa-type-class",
- "is_system": false,
- "created_at": "2024-01-18T14:41:42.000000Z",
- "updated_at": "2024-01-18T14:41:42.000000Z"
}, - "tags": [
- {
- "id": 224,
- "title": "Название тега",
- "class": "TAG_CLASS",
- "position": 24,
- "color": "#915935",
- "created_at": "2024-01-18T14:41:47.000000Z",
- "updated_at": "2024-01-18T14:41:47.000000Z"
}
], - "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "sections": [
- {
- "id": 1,
- "section_type": "client"
}
], - "custom_variables": [
- {
- "id": 1,
- "name": "Номер договора",
- "slug": "contract_number",
- "placeholder": "${custom.contract_number}",
- "description": "Номер договора клиента",
- "data_type": "string",
- "is_required": true,
- "sort_order": 0
}
], - "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}auto generate download
Скачивание обработанного .docx файла автогенерации.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
Responses
Response samples
- 200
- 401
- 404
В ответе будет возвращён word-файл
docProps/PK.@j24.docProps/app.xml.#PBwR.{nO&.docProps/core.xml}...............available variables
Возвращает список доступных переменных по указанным секциям.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
Responses
Response samples
- 200
- 400
- 401
{- "success": true,
- "data": {
- "sections": {
- "client": [
- {
- "key": "full_name",
- "label": "ФИО",
- "value": "Иванов Иван Иванович"
}, - {
- "key": "phone",
- "label": "Телефон",
- "value": "+7-999-123-45-67"
}
]
}
}, - "message": "ОК"
}preview variables
Возвращает превью значений переменных для указанного клиента/события.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
Request Body schema: application/jsonrequired
Данные для превью значений переменных
required | Array of objects Секции шаблона |
| client_id | integer ID клиента для подстановки |
| event_id | integer ID события для подстановки |
Responses
Request samples
- Payload
{- "sections": [
- {
- "section_type": "client"
}, - {
- "section_type": "event"
}
], - "client_id": 1,
- "event_id": 5
}Response samples
- 200
- 400
- 401
{- "success": true,
- "data": {
- "sections": {
- "client": [
- {
- "key": "full_name",
- "label": "ФИО",
- "value": "Иванов Иван Иванович"
}, - {
- "key": "phone",
- "label": "Телефон",
- "value": "+7-999-123-45-67"
}
]
}
}, - "message": "ОК"
}show
Возвращает данные шаблона документа.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
path Parameters
| docTemplateId required | integer Идентификатор шаблона документа |
Responses
Response samples
- 200
- 401
- 403
- 404
{- "success": true,
- "data": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "type": {
- "id": 8,
- "title": "Название типа",
- "class": "TYPE_CLASS",
- "position": 7,
- "color": "#4C75A3",
- "icon": "fa-brands fa-type-class",
- "is_system": false,
- "created_at": "2024-01-18T14:41:42.000000Z",
- "updated_at": "2024-01-18T14:41:42.000000Z"
}, - "tags": [
- {
- "id": 224,
- "title": "Название тега",
- "class": "TAG_CLASS",
- "position": 24,
- "color": "#915935",
- "created_at": "2024-01-18T14:41:47.000000Z",
- "updated_at": "2024-01-18T14:41:47.000000Z"
}
], - "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "sections": [
- {
- "id": 1,
- "section_type": "client"
}
], - "custom_variables": [
- {
- "id": 1,
- "name": "Номер договора",
- "slug": "contract_number",
- "placeholder": "${custom.contract_number}",
- "description": "Номер договора клиента",
- "data_type": "string",
- "is_required": true,
- "sort_order": 0
}
], - "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}update
Обновляет шаблон документа. Файл .docx обязателен при публикации.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
path Parameters
| docTemplateId required | integer Идентификатор шаблона документа |
Request Body schema: multipart/form-datarequired
Данные обновляемого шаблона
| file | string <binary> Новый файл шаблона (.docx, необязательный) |
| status | string Enum: "draft" "published" Статус (draft, published) |
| title | string Название шаблона |
| description | string Описание шаблона |
| type_id | integer ID типа шаблона |
| tag_ids | Array of integers |
Array of objects | |
| default_action | string Enum: "download" "save_to_storage" "save_and_download" Действие по умолчанию |
| save_to_storage | boolean |
| save_path | string |
| default_file_type_id | integer |
| default_file_tag_ids | Array of integers |
Array of objects |
Responses
Request samples
- Payload
{ "title": "Договор оказания услуг (обновлённый)", "status": "published" }
Response samples
- 200
- 400
- 401
- 403
{- "success": true,
- "data": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "type": {
- "id": 8,
- "title": "Название типа",
- "class": "TYPE_CLASS",
- "position": 7,
- "color": "#4C75A3",
- "icon": "fa-brands fa-type-class",
- "is_system": false,
- "created_at": "2024-01-18T14:41:42.000000Z",
- "updated_at": "2024-01-18T14:41:42.000000Z"
}, - "tags": [
- {
- "id": 224,
- "title": "Название тега",
- "class": "TAG_CLASS",
- "position": 24,
- "color": "#915935",
- "created_at": "2024-01-18T14:41:47.000000Z",
- "updated_at": "2024-01-18T14:41:47.000000Z"
}
], - "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "sections": [
- {
- "id": 1,
- "section_type": "client"
}
], - "custom_variables": [
- {
- "id": 1,
- "name": "Номер договора",
- "slug": "contract_number",
- "placeholder": "${custom.contract_number}",
- "description": "Номер договора клиента",
- "data_type": "string",
- "is_required": true,
- "sort_order": 0
}
], - "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}destroy
Удаляет шаблон документа (soft delete).
Требуются права доступа:
- DOC_TEMPLATE_DESTROY
Authorizations:
path Parameters
| docTemplateId required | integer Идентификатор шаблона документа |
Responses
Response samples
- 200
- 401
- 403
- 404
{- "success": true,
- "data": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "type": {
- "id": 8,
- "title": "Название типа",
- "class": "TYPE_CLASS",
- "position": 7,
- "color": "#4C75A3",
- "icon": "fa-brands fa-type-class",
- "is_system": false,
- "created_at": "2024-01-18T14:41:42.000000Z",
- "updated_at": "2024-01-18T14:41:42.000000Z"
}, - "tags": [
- {
- "id": 224,
- "title": "Название тега",
- "class": "TAG_CLASS",
- "position": 24,
- "color": "#915935",
- "created_at": "2024-01-18T14:41:47.000000Z",
- "updated_at": "2024-01-18T14:41:47.000000Z"
}
], - "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "sections": [
- {
- "id": 1,
- "section_type": "client"
}
], - "custom_variables": [
- {
- "id": 1,
- "name": "Номер договора",
- "slug": "contract_number",
- "placeholder": "${custom.contract_number}",
- "description": "Номер договора клиента",
- "data_type": "string",
- "is_required": true,
- "sort_order": 0
}
], - "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}duplicate
Дублирует шаблон документа.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
path Parameters
| docTemplateId required | integer Идентификатор шаблона документа |
Responses
Response samples
- 200
- 401
- 403
- 404
{- "success": true,
- "data": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "type": {
- "id": 8,
- "title": "Название типа",
- "class": "TYPE_CLASS",
- "position": 7,
- "color": "#4C75A3",
- "icon": "fa-brands fa-type-class",
- "is_system": false,
- "created_at": "2024-01-18T14:41:42.000000Z",
- "updated_at": "2024-01-18T14:41:42.000000Z"
}, - "tags": [
- {
- "id": 224,
- "title": "Название тега",
- "class": "TAG_CLASS",
- "position": 24,
- "color": "#915935",
- "created_at": "2024-01-18T14:41:47.000000Z",
- "updated_at": "2024-01-18T14:41:47.000000Z"
}
], - "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "sections": [
- {
- "id": 1,
- "section_type": "client"
}
], - "custom_variables": [
- {
- "id": 1,
- "name": "Номер договора",
- "slug": "contract_number",
- "placeholder": "${custom.contract_number}",
- "description": "Номер договора клиента",
- "data_type": "string",
- "is_required": true,
- "sort_order": 0
}
], - "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}download file
Скачивание исходного .docx файла шаблона.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
path Parameters
| docTemplateId required | integer Идентификатор шаблона документа |
Responses
Response samples
- 200
- 401
- 404
В ответе будет возвращён word-файл
docProps/PK.@j24.docProps/app.xml.#PBwR.{nO&.docProps/core.xml}...............custom placeholder contexts
Контекстные строки для custom-плейсхолдеров из .docx шаблона.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
path Parameters
| docTemplateId required | integer Идентификатор шаблона документа |
Responses
Response samples
- 200
- 401
- 404
{- "success": true,
- "data": {
- "contexts": {
- "contract_number": "Договор №${custom.contract_number} от ${event.date}",
- "position": "в должности ${custom.position}"
}
}, - "message": "ОК"
}generate
Генерация документа по шаблону. В зависимости от действия (action) возвращает JSON или binary файл.
Требуются права доступа:
- DOC_TEMPLATE_GENERATE
Authorizations:
Request Body schema: application/jsonrequired
Данные для генерации документа
| template_id required | integer ID шаблона |
| client_id required | integer ID клиента |
| event_id | integer ID календарного события |
| action required | string Действие (download, save_to_storage, save_and_download) |
| file_type_id | integer ID типа файла (для сохранения в хранилище) |
| file_tag_ids | Array of integers Массив ID меток файла |
Array of objects Значения пользовательских переменных | |
| event_user_id | integer ID сотрудника события |
| save_path | string Путь сохранения на внешнем диске |
Responses
Request samples
- Payload
{- "template_id": 1,
- "client_id": 14,
- "action": "download"
}Response samples
- 200
- 400
- 401
- 403
{- "success": true,
- "data": {
- "id": 1,
- "template": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "client": {
- "id": 14,
- "first_name": "Иван",
- "last_name": "Иванов",
- "middle_name": "Иванович",
- "gender": 0,
- "birthday": "1995-12-23T00:00:00.000000Z",
- "has_personal_data_consent": false,
- "created_at": "2024-01-18T14:41:48.000000Z",
- "updated_at": "2024-01-18T14:41:48.000000Z"
}, - "user": {
- "id": 1,
- "email": "test@example.com",
- "email_verified_at": "2000-01-01T00:00:00.000000Z",
- "is_2fa_active": true,
- "first_name": "Иван",
- "last_name": "Иванов",
- "middle_name": "Иванович",
- "gender": 0,
- "birthday": "1995-12-30T00:00:00.000000Z",
- "is_super_admin": true,
- "created_at": "2024-01-18T14:41:45.000000Z",
- "updated_at": "2024-01-18T14:41:45.000000Z",
- "deactivated_at": "2024-01-18T14:41:45.000000Z"
}, - "original_file_name": "Договор_Иванов.docx",
- "action_taken": "save_to_storage",
- "is_downloadable": true,
- "storage_file_id": 42,
- "created_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}preview
Генерирует превью документа (не сохраняется, отдаётся как download).
Требуются права доступа:
- DOC_TEMPLATE_GENERATE
Authorizations:
Request Body schema: application/jsonrequired
Данные для превью документа
| template_id required | integer ID шаблона |
| client_id required | integer ID клиента |
| event_id | integer ID календарного события |
| event_user_id | integer ID сотрудника события |
Array of objects Значения пользовательских переменных |
Responses
Request samples
- Payload
{- "template_id": 1,
- "client_id": 14
}Response samples
- 200
- 400
- 401
- 403
В ответе будет возвращён word-файл
docProps/PK.@j24.docProps/app.xml.#PBwR.{nO&.docProps/core.xml}...............index
Возвращает историю сгенерированных документов клиента с пагинацией.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
query Parameters
| client_id required | integer Идентификатор клиента (обязательный). |
| page | integer Номер страницы (для постраничной пагинации). |
| sort_by | string Default: "created_at" Enum: "created_at" "original_file_name" "action_taken" Поле сортировки. |
| descending | boolean Флаг обратного направления сортировки. |
| per_page | integer Default: 10 Enum: 10 25 50 100 Кол-во отображаемых записей на странице (макс. 100). |
| search | string Произвольный текстовый запрос для поиска записей. |
| types | Array of integers Массив ID типов для фильтрации. |
| has_tags | Array of integers Массив ID меток. |
Responses
Response samples
- 200
- 400
- 401
- 403
{- "success": true,
- "data": {
- "generated_documents": [
- {
- "id": 1,
- "template": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "client": {
- "id": 14,
- "first_name": "Иван",
- "last_name": "Иванов",
- "middle_name": "Иванович",
- "gender": 0,
- "birthday": "1995-12-23T00:00:00.000000Z",
- "has_personal_data_consent": false,
- "created_at": "2024-01-18T14:41:48.000000Z",
- "updated_at": "2024-01-18T14:41:48.000000Z"
}, - "user": {
- "id": 1,
- "email": "test@example.com",
- "email_verified_at": "2000-01-01T00:00:00.000000Z",
- "is_2fa_active": true,
- "first_name": "Иван",
- "last_name": "Иванов",
- "middle_name": "Иванович",
- "gender": 0,
- "birthday": "1995-12-30T00:00:00.000000Z",
- "is_super_admin": true,
- "created_at": "2024-01-18T14:41:45.000000Z",
- "updated_at": "2024-01-18T14:41:45.000000Z",
- "deactivated_at": "2024-01-18T14:41:45.000000Z"
}, - "original_file_name": "Договор_Иванов.docx",
- "action_taken": "save_to_storage",
- "is_downloadable": true,
- "storage_file_id": 42,
- "created_at": "2026-04-01T12:00:00"
}
], - "meta": {
- "current_page": 3,
- "from": 1,
- "last_page": 5,
- "links": [
- {
- "label": "« Назад",
- "active": false
}, - {
- "url": "/resource?per_page=10&page=2",
- "label": "2",
- "active": false
}, - {
- "url": "/resource?per_page=10&page=3",
- "label": "3",
- "active": false
}, - {
- "url": "/resource?per_page=10&page=2",
- "label": "Вперёд »",
- "active": false
}
], - "path": "/resource/resource",
- "per_page": 15,
- "to": 15,
- "total": 75
}, - "links": {
- "first": "/resource?per_page=10&page=1",
- "last": "/resource?per_page=10&page=10",
- "next": "/resource?per_page=10&page=2"
}
}, - "message": "ОК"
}show
Возвращает данные сгенерированного документа. При параметре ?download — скачивает файл с Яндекс Диска.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
path Parameters
| generatedDocumentId required | integer Идентификатор сгенерированного документа |
Responses
Response samples
- 200
- 401
- 403
- 404
{- "success": true,
- "data": {
- "id": 1,
- "template": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "client": {
- "id": 14,
- "first_name": "Иван",
- "last_name": "Иванов",
- "middle_name": "Иванович",
- "gender": 0,
- "birthday": "1995-12-23T00:00:00.000000Z",
- "has_personal_data_consent": false,
- "created_at": "2024-01-18T14:41:48.000000Z",
- "updated_at": "2024-01-18T14:41:48.000000Z"
}, - "user": {
- "id": 1,
- "email": "test@example.com",
- "email_verified_at": "2000-01-01T00:00:00.000000Z",
- "is_2fa_active": true,
- "first_name": "Иван",
- "last_name": "Иванов",
- "middle_name": "Иванович",
- "gender": 0,
- "birthday": "1995-12-30T00:00:00.000000Z",
- "is_super_admin": true,
- "created_at": "2024-01-18T14:41:45.000000Z",
- "updated_at": "2024-01-18T14:41:45.000000Z",
- "deactivated_at": "2024-01-18T14:41:45.000000Z"
}, - "original_file_name": "Договор_Иванов.docx",
- "action_taken": "save_to_storage",
- "is_downloadable": true,
- "storage_file_id": 42,
- "created_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}destroy
Удаляет сгенерированный документ (soft delete).
Требуются права доступа:
- DOC_TEMPLATE_DESTROY
Authorizations:
path Parameters
| generatedDocumentId required | integer Идентификатор сгенерированного документа |
Responses
Response samples
- 200
- 401
- 403
- 404
{- "success": true,
- "data": {
- "id": 1,
- "template": {
- "id": 1,
- "status": "published",
- "user_id": 5,
- "is_draft": false,
- "title": "Договор оказания услуг",
- "description": "Шаблон договора для клиентов",
- "type_id": 3,
- "file_path": "doc_templates/abc123.docx",
- "default_action": "download",
- "save_to_storage": false,
- "created_at": "2026-04-01T12:00:00",
- "updated_at": "2026-04-01T12:00:00"
}, - "client": {
- "id": 14,
- "first_name": "Иван",
- "last_name": "Иванов",
- "middle_name": "Иванович",
- "gender": 0,
- "birthday": "1995-12-23T00:00:00.000000Z",
- "has_personal_data_consent": false,
- "created_at": "2024-01-18T14:41:48.000000Z",
- "updated_at": "2024-01-18T14:41:48.000000Z"
}, - "user": {
- "id": 1,
- "email": "test@example.com",
- "email_verified_at": "2000-01-01T00:00:00.000000Z",
- "is_2fa_active": true,
- "first_name": "Иван",
- "last_name": "Иванов",
- "middle_name": "Иванович",
- "gender": 0,
- "birthday": "1995-12-30T00:00:00.000000Z",
- "is_super_admin": true,
- "created_at": "2024-01-18T14:41:45.000000Z",
- "updated_at": "2024-01-18T14:41:45.000000Z",
- "deactivated_at": "2024-01-18T14:41:45.000000Z"
}, - "original_file_name": "Договор_Иванов.docx",
- "action_taken": "save_to_storage",
- "is_downloadable": true,
- "storage_file_id": 42,
- "created_at": "2026-04-01T12:00:00"
}, - "message": "ОК"
}index
Возвращает список сохранённых формул тенанта.
Требуются права доступа:
- DOC_TEMPLATE_SHOW
Authorizations:
Responses
Response samples
- 200
- 401
{- "success": true,
- "data": {
- "id": 1,
- "title": "Разница дат",
- "formula": "date_diff(${client.birthday}, ${event.date}, d)",
- "created_at": "2026-04-01T12:00:00.000000Z",
- "updated_at": "2026-04-01T12:00:00.000000Z"
}, - "message": "ОК"
}store
Создаёт новую сохранённую формулу.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
Request Body schema: application/jsonrequired
Данные сохранённой формулы
| title required | string Название формулы (макс. 255) |
| formula required | string Тело формулы (макс. 2000) |
Responses
Request samples
- Payload
{- "title": "Разница дат",
- "formula": "date_diff(${client.birthday}, ${event.date}, d)"
}Response samples
- 200
- 400
- 401
{- "success": true,
- "data": {
- "id": 1,
- "title": "Разница дат",
- "formula": "date_diff(${client.birthday}, ${event.date}, d)",
- "created_at": "2026-04-01T12:00:00.000000Z",
- "updated_at": "2026-04-01T12:00:00.000000Z"
}, - "message": "ОК"
}update
Обновляет сохранённую формулу.
Требуются права доступа:
- DOC_TEMPLATE_STORE
Authorizations:
path Parameters
| savedFormulaId required | integer Идентификатор сохранённой формулы |
Request Body schema: application/jsonrequired
Данные сохранённой формулы
| title required | string Название формулы (макс. 255) |
| formula required | string Тело формулы (макс. 2000) |
Responses
Request samples
- Payload
{- "title": "Разница дат",
- "formula": "date_diff(${client.birthday}, ${event.date}, d)"
}Response samples
- 200
- 400
- 401
- 404
{- "success": true,
- "data": {
- "id": 1,
- "title": "Разница дат",
- "formula": "date_diff(${client.birthday}, ${event.date}, d)",
- "created_at": "2026-04-01T12:00:00.000000Z",
- "updated_at": "2026-04-01T12:00:00.000000Z"
}, - "message": "ОК"
}