1. Загрузить файл, на основании которого будет создан документ
Документация
https://docs.myhrlink.ru/public/openapi/hr-link/#tag/files/operation/upload
Запрос
curl --location 'https://••••••.••••••.ru/api/v1/files' \ --header 'Accept: application/json' \ --header 'User-Api-Token: ••••••' \ --form 'file1=@"\files\Document.docx"'
Ответ
{
"result": true,
"files": [
{
"id": "0f63fb7c-3be3-4dd6-a404-2ae0eb8adb03",
"creatorId": null,
"name": "Document.docx",
"createdDate": "2024-09-25T08:15:25.456447Z"
}
]
}
2. Создать группу документов
Документация
https://docs.myhrlink.ru/public/openapi/hr-link/#tag/documentsGroups/operation/createDocumentGroup
Запрос
curl --location 'https://••••••.••••••.ru/api/v1/clients/••••••/documentGroups' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'User-Api-Token: ••••••' \
--data '{
"name": "Документы от 25.09.2024",
"documents": [
{
"number": null,
"typeId": "5040081f-25c8-43b9-8729-6eacee1c6271",
"date": "2024-09-25T00:00:00.000Z",
"legalEntityId": "e5869c62-fa8d-4428-9a6f-19419295d32a",
"headManagerId": "b3e02b41-38d2-4586-89eb-da2a5363312a",
"employeeIds": [
"43148165-2389-4900-8527-8b2d4ab72cb6"
],
"watcherIds": [],
"signingOrder": null,
"routeTemplateId": "7bf40614-7682-4876-9c84-1785d589eecf",
"route": {
"id": "7bf40614-7682-4876-9c84-1785d589eecf",
"clientId": "82c35fdb-af4f-4c38-b174-1c957c4c2c7b",
"name": "Руководитель первый",
"signingObjectType": "DOCUMENT",
"externalId": null,
"templateKey": "MANAGER_FIRST",
"createdDate": "2024-04-24T10:12:10.815829Z",
"deactivatedDate": null,
"stages": [
{
"id": "add30200-cf49-47fe-a557-3fb799df7826",
"signingRouteTemplateId": "7bf40614-7682-4876-9c84-1785d589eecf",
"indexNumber": 0,
"type": "SIGNING",
"completenessCondition": "ALL",
"participants": [
{
"id": "4c54ec2d-803b-42a5-98a2-fe09f9b8482b",
"templateStageId": "add30200-cf49-47fe-a557-3fb799df7826",
"type": "EMPLOYER",
"actionType": "SIGNING",
"signingType": "QES",
"placeholder": null,
"required": true,
"version": 1,
"multipleSigners": false
}
]
},
{
"id": "352f0933-e641-4dea-b00c-7db35e66bf6e",
"signingRouteTemplateId": "7bf40614-7682-4876-9c84-1785d589eecf",
"indexNumber": 1,
"type": "SIGNING",
"completenessCondition": "ALL",
"participants": [
{
"id": "91e4c3a7-b8b7-4e35-b238-9f8bd0a965f7",
"templateStageId": "352f0933-e641-4dea-b00c-7db35e66bf6e",
"type": "EMPLOYEE",
"actionType": "SIGNING",
"signingType": "ANY_APPLICABLE",
"placeholder": null,
"required": true,
"version": 1,
"multipleSigners": false
}
]
}
],
"legalEntities": [
{
"name": "ЗАО Мяч",
"shortName": "ЗАО Мяч",
"externalId": "ddac7a1a-b26b-4724-85c8-dd20c63d1feb",
"id": "e5869c62-fa8d-4428-9a6f-19419295d32a"
}
]
},
"notice": null,
"fileName": "Document.docx",
"version": 0,
"valid": true,
"participants": [],
"fileId": "73932d5f-0835-4ed5-809d-23ba348bc658"
}
]
}'
Ответ
{
"result": true,
"documentGroup": {
"id": "62977a5f-4355-4e80-9c47-2d30e3b9841d",
"documents": [
{
"id": "e4a93248-6b31-4a24-8063-5cd26481cf86"
}
]
}
}
3. (опционально) Проверить корректность созданного документа перед отправкой на подписание
Документация
Запрос
curl --location 'https://••••••.••••••.ru/api/v1/clients/••••••/documents/validateBeforeSendToSigning' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'User-Api-Token: ••••••' \
--data '{
"documents": [
{
"id": "e4a93248-6b31-4a24-8063-5cd26481cf86"
}
]
}'
Ответ
{
"result": true,
"documents": [
{
"documentId": "e4a93248-6b31-4a24-8063-5cd26481cf86",
"status": "CORRECT",
"errorMessage": null,
"errorCode": null,
"documentSigners": [
{
"lastName": "Тетерина",
"firstName": "Лидия",
"patronymic": "Захаровна",
"documentSignerType": "HEAD_MANAGER",
"employeeId": "b3e02b41-38d2-4586-89eb-da2a5363312a",
"status": "CORRECT",
"errorMessage": null,
"errorCode": null
},
{
"lastName": "Авдеев",
"firstName": "Елисей",
"patronymic": "Валерианович",
"documentSignerType": "EMPLOYEE",
"employeeId": "43148165-2389-4900-8527-8b2d4ab72cb6",
"status": "CORRECT",
"errorMessage": null,
"errorCode": null
}
]
}
]
}
4. Отправить документ по маршруту
Документация
Запрос
curl --location --request PUT 'https://••••••.••••••.ru/api/v2/clients/••••••/documents/sendToSigning' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'User-Api-Token: ••••••' \
--data '{
"documents": [
{
"id": "e4a93248-6b31-4a24-8063-5cd26481cf86"
}
],
"sentToSigningPartly": true
}'
Ответ
{
"result": true,
"sendToSigningResults": [
{
"baseDocumentId": "e4a93248-6b31-4a24-8063-5cd26481cf86",
"sentDocuments": [
{
"id": "90721e44-05a1-496b-98a1-11fe54b3b7a2",
"version": 1,
"employeeSigner": {
"id": "43148165-2389-4900-8527-8b2d4ab72cb6",
"externalId": "e6a7a56d-ff3c-4c39-ad10-add616aadb78",
"lastName": "Авдеев",
"firstName": "Елисей",
"patronymic": "Валерианович"
}
}
]
}
]
}
5. Проверить статус подписания документа
Документация
https://docs.myhrlink.ru/public/openapi/hr-link/#tag/documentsGet/operation/getDocument
Запрос
curl --location 'https://••••••.••••••.ru/api/v1/clients/••••••/documents/531af760-98cd-4046-8d51-b0000e5c81f3' \ --header 'Accept: application/json' \ --header 'User-Api-Token: ••••••'
Ответ
{
"id": "531af760-98cd-4046-8d51-b0000e5c81f3",
"version": 1,
"externalId": null,
"draft": false,
"deleted": false,
"signed": false,
"rejected": false,
"convertedFileId": "8c00bc39-e8aa-439a-894b-fcf289c8d781",
"docflowFinishedDate": null,
"lastSignedDate": null,
"signingOrder": "ROUTE",
"documentGroup": {
"id": "16ce1ebd-9ee5-4fef-8537-b2e36d184852",
"name": "Документы от 25.09.2024",
"version": 1
},
"baseDocumentId": "e2d53b39-a425-40d6-ba09-9fba563a56a4",
"baseDocumentExternalId": null,
"type": {
"id": "5040081f-25c8-43b9-8729-6eacee1c6271",
"name": "Должностные инструкции"
},
"fileName": "New Microsoft Word Document.docx",
"number": null,
"date": "2024-09-25",
"createdDate": "2024-09-25T08:59:46.785713Z",
"legalEntity": {
"name": "ЗАО Мяч",
"shortName": "ЗАО Мяч",
"externalId": "ddac7a1a-b26b-4724-85c8-dd20c63d1feb",
"ogrn": "3123126024700",
"inn": "5080306706",
"kpp": "120096259",
"version": 5,
"id": "e5869c62-fa8d-4428-9a6f-19419295d32a"
},
"headManager": {
"id": "e3663816-a951-444f-a6b8-3c7bfe3b553d",
"employeeId": "b3e02b41-38d2-4586-89eb-da2a5363312a",
"externalId": "c996672f-495d-4b72-bf1f-b4eb43fd1c76",
"lastName": "Тетерина",
"firstName": "Лидия",
"patronymic": "Захаровна",
"position": {
"id": "b2dde4a9-1068-43ed-acbd-558a9a4d73a0",
"name": "Генеральный директор"
},
"participantId": "da39da69-6847-4dc6-b008-d75b1a2f7722",
"dismissedDate": null,
"number": null,
"signerType": "HEAD_MANAGER",
"seenDate": null,
"madeDecision": false,
"signedDate": null,
"signingOrder": 0,
"rejectedDate": null,
"signingAvailabilityDate": "2024-09-25T10:41:15.961000Z",
"rejectionComment": null,
"signingInfo": {
"signingByPrrInProgress": false
}
},
"employees": [
{
"id": "9f262220-33ef-4bce-bb71-887ea0db9639",
"employeeId": "43148165-2389-4900-8527-8b2d4ab72cb6",
"externalId": "e6a7a56d-ff3c-4c39-ad10-add616aadb78",
"lastName": "Авдеев",
"firstName": "Елисей",
"patronymic": "Валерианович",
"position": {
"id": "50103b82-7451-4497-9fbf-763426662f7a",
"name": "Тестировщик"
},
"participantId": "6c46c337-f8d9-48d3-807b-fff1c85bc966",
"dismissedDate": null,
"number": null,
"signerType": "EMPLOYEE",
"seenDate": null,
"madeDecision": false,
"signedDate": null,
"signingOrder": 1,
"rejectedDate": null,
"signingAvailabilityDate": null,
"rejectionComment": null,
"signingInfo": {
"signingByPrrInProgress": false
}
}
],
"watchers": [],
"participants": [],
"fileConversionFailedDate": null,
"sentDate": "2024-09-25T10:41:15.956827Z",
"pendingSigningInfo": [],
"creator": {
"id": "c3ad0964-2c87-4507-95ae-494f0fa0de04",
"lastName": "Мяч",
"firstName": "Сергей",
"patronymic": "Петрович",
"position": {
"id": "1fd51524-f0f5-4ee1-b99f-459a1b6a6856",
"name": "Упр. кадрами"
}
},
"printFormUpdatedDate": null,
"route": {
"key": "MANAGER_FIRST",
"id": "fe5bdef2-1f14-43d2-b9ce-d2ad6886c78b",
"name": "Руководитель первый",
"templateId": "7bf40614-7682-4876-9c84-1785d589eecf",
"stages": [
{
"id": "126647bb-9cac-47d2-ba0a-96e315ccff4c",
"indexNumber": 0,
"type": "SIGNING",
"completenessCondition": "ALL",
"participants": [
{
"id": "da39da69-6847-4dc6-b008-d75b1a2f7722",
"type": "EMPLOYER",
"actionType": "SIGNING",
"signingType": "QES",
"placeholder": null,
"templateId": "4c54ec2d-803b-42a5-98a2-fe09f9b8482b",
"required": true,
"multipleSigners": false
}
]
},
{
"id": "9316df5b-e2d8-4fbb-bccc-f1eb0f64808c",
"indexNumber": 1,
"type": "SIGNING",
"completenessCondition": "ALL",
"participants": [
{
"id": "6c46c337-f8d9-48d3-807b-fff1c85bc966",
"type": "EMPLOYEE",
"actionType": "SIGNING",
"signingType": "ANY_APPLICABLE",
"placeholder": null,
"templateId": "91e4c3a7-b8b7-4e35-b238-9f8bd0a965f7",
"required": true,
"multipleSigners": false
}
]
}
]
},
"hideAfterSigning": false,
"rejectionDisabled": false,
"relatedEntities": [],
"comments": null,
"normativeAct": null,
"annulledDate": null,
"failed": false,
"documentId": "531af760-98cd-4046-8d51-b0000e5c81f3"
}