{
  "swagger": "2.0",
  "info": {
    "description": "This is description of the API provided by DigiSign Document Portal. `apiKey` for authorization is provided by DigiSign administrator.",
    "version": "1.9.0",
    "title": "DigiSign API",
    "contact": {
      "email": "digisign@ibs.bg"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "host": "<instance>.digisign.space",
  "basePath": "/api/external/v1",
  "tags": [
    {
      "name": "settings",
      "description": "System configuration"
    },
    {
      "name": "signRequest",
      "description": "Sign requests"
    }
  ],
  "schemes": [
    "https",
    "http"
  ],
  "paths": {
    "/settings/typesOfDocuments": {
      "get": {
        "tags": [
          "settings"
        ],
        "summary": "Get list of document types, configured in DigiSign",
        "operationId": "typesOfDocuments",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/TypesOfDocumentsResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/settings/channels": {
      "get": {
        "tags": [
          "settings"
        ],
        "summary": "Get list of singing channels, configured in DigiSign",
        "operationId": "channels",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/ChannelsResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/signRequests/create": {
      "post": {
        "tags": [
          "signRequest"
        ],
        "summary": "Creates new sign request",
        "operationId": "create",
        "produces": [
          "application/json"
        ],
        "consumes": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "Sign document data",
            "required": true,
            "schema": {
              "$ref": "#/definitions/SignDocumentRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/SignDocumentResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/signRequests/update": {
      "put": {
        "tags": [
          "signRequest"
        ],
        "summary": "Update sign request & initiate signing process",
        "operationId": "update",
        "produces": [
          "application/json"
        ],
        "consumes": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "Update data",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UpdateSignDocumentRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/SignDocumentResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/signRequests/status": {
      "get": {
        "tags": [
          "signRequest"
        ],
        "summary": "Information for the status of sign request",
        "operationId": "status",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "unid",
            "in": "query",
            "description": "UNID of sign request",
            "required": true,
            "type": "string"
          },
          {
            "name": "forceCheck",
            "in": "query",
            "description": "Force check the request status in DigiSign Gateway and update in portal (if needed) before returning the result. Force check will be executed only when 'forceCheck' is 'true' and status in portal is 'Processing'",
            "required": false,
            "type": "boolean"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/SignDocumentResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/signRequests/downloadSigned": {
      "get": {
        "tags": [
          "signRequest"
        ],
        "summary": "download signed content",
        "operationId": "downloadSigned",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "type": "string",
            "name": "unid",
            "in": "query",
            "description": "UNID of sign request",
            "required": true
          },
          {
            "type": "boolean",
            "name": "deleteDocument",
            "in": "query",
            "description": "Delete document from DigiSign after successful download.",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/DownloadDocumentResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/signRequests/cancel": {
      "post": {
        "tags": [
          "signRequest"
        ],
        "summary": "Cancel sign request",
        "operationId": "cancel",
        "produces": [
          "application/json"
        ],
        "consumes": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "Cancellation data",
            "required": true,
            "schema": {
              "$ref": "#/definitions/CancellationRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/CancellationResponse"
            }
          },
          "400": {
            "description": "bad request"
          },
          "401": {
            "description": "unauthorized"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/signRequests/validateOtp": {
      "post": {
        "tags": [
          "signRequest"
        ],
        "summary": "Validate OTP code for current signing participant",
        "operationId": "validateOtp",
        "produces": [
          "application/json"
        ],
        "consumes": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "OTP code validation data",
            "required": true,
            "schema": {
              "$ref": "#/definitions/OTPCodeValidationRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/OTPCodeValidationResponse"
            }
          },
          "400": {
            "description": "bad request"
          },
          "401": {
            "description": "unauthorized"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/signRequests/resendOtp": {
      "post": {
        "tags": [
          "signRequest"
        ],
        "summary": "Resend OTP code for current signing participant",
        "operationId": "resendOtp",
        "produces": [
          "application/json"
        ],
        "consumes": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "OTP code resend data",
            "required": true,
            "schema": {
              "$ref": "#/definitions/OTPCodeResendRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/OTPCodeResendResponse"
            }
          },
          "400": {
            "description": "bad request"
          },
          "401": {
            "description": "unauthorized"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    }
  },
  "securityDefinitions": {
    "api_key": {
      "type": "apiKey",
      "name": "apiKey",
      "in": "header"
    }
  },
  "definitions": {
    "TypesOfDocumentsResponse": {
      "type": "object",
      "properties": {
        "documentTypes": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DocumentTypeData"
          }
        }
      }
    },
    "DocumentTypeData": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int32",
          "description": "Unique identifier"
        },
        "shortName": {
          "type": "string",
          "description": "Short name of type"
        },
        "name": {
          "type": "string",
          "description": "Full name of type"
        },
        "description": {
          "type": "string",
          "description": "Description of type"
        },
        "active": {
          "type": "boolean"
        }
      }
    },
    "ChannelsResponse": {
      "type": "object",
      "properties": {
        "channels": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ChannelData"
          }
        }
      }
    },
    "ChannelData": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier of the channel",
          "enum": [
            "BTRUST",
            "EVROTRUST",
            "SIGNATUS",
            "DOWNLOAD_AND_UPLOAD",
            "ONE_CLICK_SIGN_EXTERNAL",
            "ONE_CLICK_SIGN_INTERNAL",
            "RECIPIENT_CHOICE"
          ]
        },
        "name": {
          "type": "string",
          "description": "Full name of type"
        },
        "priority": {
          "type": "integer",
          "description": "Priority of the channel in UI",
          "example": 1
        },
        "enabled": {
          "type": "boolean",
          "description": "Channel is enabled for use"
        },
        "hasAvailableSignings": {
          "type": "boolean",
          "description": "Channel has available singing's from packages to use"
        },
        "oneTimeSigning": {
          "type": "boolean",
          "description": "One-Time signing is enabled for the channel (Only for BTRUST and EVROTRUST)"
        },
        "signatusDevices": {
          "type": "array",
          "description": "Only for SIGNATUS channel",
          "items": {
            "$ref": "#/definitions/SignatusDeviceData"
          }
        },
        "autoSigners": {
          "type": "array",
          "description": "List of persons configured for BTrust Auto Signing and active consent. Only for BTRUST channel",
          "items": {
            "$ref": "#/definitions/AutoSignerData"
          }
        }
      }
    },
    "SignatusDeviceData": {
      "type": "object",
      "properties": {
        "deviceId": {
          "type": "string",
          "description": "Unique identifier of the device"
        },
        "location": {
          "type": "string",
          "description": "Location of the device"
        },
        "name": {
          "type": "string",
          "description": "Name of the device"
        },
        "enabled": {
          "type": "boolean",
          "description": "Channel is enabled for use"
        }
      }
    },
    "AutoSignerData": {
      "type": "object",
      "properties": {
        "identifier": {
          "type": "string",
          "description": "Unique identifier of the signer"
        },
        "names": {
          "type": "string",
          "description": "Names of person"
        }
      }
    },
    "SignDocumentRequest": {
      "type": "object",
      "properties": {
        "type": {
          "type": "integer",
          "format": "int32",
          "description": "Type ID of document in sign request"
        },
        "description": {
          "type": "string",
          "description": "Description of the document"
        },
        "employeeNumber": {
          "type": "string",
          "description": "Employee ID of registered DigiSign user. Used only if the sign request must be associated with specific user (and to be visible in their respective \"My Documents\" view)"
        },
        "documents": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DocumentData"
          }
        },
        "participants": {
          "type": "array",
          "description": "List of participants in the signing process. The order of the elements of the list is strictly observed in the signing process.",
          "items": {
            "$ref": "#/definitions/SigningParticipantData"
          }
        },
        "expiry": {
          "type": "string",
          "description": "Deadline to sign document(s). Format yyyy-MM-dd HH:mm:ss",
          "default": null,
          "example": "2022-07-27 17:23:16"
        },
        "expirationNotification": {
          "type": "integer",
          "description": "Number of hours before expiry to send reminder. Reminders templates are configured in the Settings of the DigiSign Document Portal.",
          "default": null,
          "example": 24
        },
        "autoprocess": {
          "type": "boolean",
          "description": "True if the signing process must be initiated automatically by the timer (within 5 min). False if the process will be started manually from the DigiSign Document Portal UI.",
          "default": false
        },
        "processNow": {
          "type": "boolean",
          "description": "True if the signing process must be initiated immediately.",
          "default": true
        },
        "sendSignedFileTo": {
          "type": "string",
          "description": "E-mail address where to send the document after the process is completed and all participant have applied their respective digital signatures. Comma separated list of e-mail addresses. Supported delimiters ',' and ';' ",
          "default": null,
          "example": "test1.recipient@tests.comm;test2.recipient@tests.comm"
        },
        "passwordForSendSignedFileTo": {
          "type": "string",
          "description": "Password to protect the ZIP archive with documents sent to the [sendSignedFileTo]. If value is null or empty documents will be sent without protection.",
          "default": null
        },
        "folderName": {
          "type": "string",
          "description": "Full name of the folder to upload the document into or path to the folder. The path to the folder starts from '/' (main folder) and is separated by '/'. If the value is not specified or its '/' or folder is not found the document will be uploaded into the main folder. If only a single name is passed, the first found folder with this name will be used.",
          "default": null,
          "example": "FolderName3 OR /Folder1/SubFolder2"
        },
        "tags": {
          "type": "array",
          "description": "Array of tags to be added to the document (for search)",
          "example": [
            "tag1",
            "tag2",
            "tag3"
          ]
        },
        "callbackUrl": {
          "type": "string",
          "description": "Callback URL that will be called by the DigiSign portal when the status of the signing request changes. (Http method: GET)",
          "maxLength": 2000
        }
      },
      "required": [
        "type",
        "description",
        "documents"
      ]
    },
    "UpdateSignDocumentRequest": {
      "type": "object",
      "properties": {
        "unid": {
          "type": "string",
          "description": "UNID of sign request"
        },
        "participants": {
          "type": "array",
          "description": "Signing participants with new signature positions",
          "items": {
            "$ref": "#/definitions/SigningParticipantUpdateData"
          }
        },
        "expiry": {
          "type": "string",
          "description": "Deadline to sign document(s). Format yyyy-MM-dd HH:mm:ss",
          "default": null,
          "example": "2022-07-27 17:23:16"
        },
        "processNow": {
          "type": "boolean",
          "description": "True if the signing process must be initiated immediately.",
          "default": true
        }
      },
      "required": [
        "unid"
      ]
    },
    "SignDocumentResponse": {
      "type": "object",
      "properties": {
        "unid": {
          "type": "string",
          "description": "Identifier of created sign request"
        },
        "status": {
          "type": "string",
          "description": "Status of created sign request",
          "default": "Waiting",
          "enum": [
            "Waiting",
            "Processing",
            "Signed",
            "Rejected",
            "Expired",
            "Withdrawn",
            "Locked",
            "Error"
          ]
        },
        "totalParticipants": {
          "type": "integer",
          "description": "Total count of signing participants in process"
        },
        "signedParticipants": {
          "type": "integer",
          "description": "Count of signing participants that successfully signed documents"
        },
        "errorMessage": {
          "type": "string",
          "description": "Description of error"
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "DownloadDocumentResponse": {
      "type": "object",
      "properties": {
        "unid": {
          "type": "string",
          "description": "Identifier of created sign request"
        },
        "status": {
          "type": "string",
          "description": "Status of created sign request",
          "default": "Waiting",
          "enum": [
            "Waiting",
            "Processing",
            "Signed",
            "Rejected",
            "Expired",
            "Withdrawn"
          ]
        },
        "errorMessage": {
          "type": "string",
          "description": "Description of error"
        },
        "success": {
          "type": "boolean"
        },
        "documents": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DocumentData"
          }
        }
      }
    },
    "DocumentData": {
      "type": "object",
      "properties": {
        "fileName": {
          "type": "string",
          "description": "Name of the file with extension (pdf / xml)"
        },
        "content": {
          "type": "string",
          "description": "base64 encoded file content"
        },
        "sha256sum": {
          "type": "string",
          "description": "SHA256 of signed document content. HEX format"
        }
      },
      "required": [
        "fileName",
        "content"
      ]
    },
    "SignaturePositionData": {
      "type": "object",
      "properties": {
        "fileName": {
          "type": "string",
          "description": "Name of the file with extension. Should correspond to fileName from documents array"
        },
        "pageNum": {
          "type": "integer",
          "description": "Page number on which the signature field is located (counting starts from 1)",
          "example": 1
        },
        "xAxis": {
          "type": "number",
          "description": "X coordinate of the upper left corner of the signature field. (0,0) is the top left corner of the page",
          "example": 1
        },
        "yAxis": {
          "type": "number",
          "description": "Y coordinate of the upper left corner of the signature field. (0,0) is the top left corner of the page",
          "example": 2
        }
      },
      "required": [
        "fileName",
        "pageNum",
        "xAxis",
        "yAxis"
      ]
    },
    "SigningPropertiesData": {
      "type": "object",
      "properties": {
        "fileName": {
          "type": "string",
          "description": "Name of the file with extension. Should correspond from fileName from documents array"
        },
        "optional": {
          "type": "boolean",
          "description": "false - for signing; true - for review only. First document is always false by default. (Note: if supported by the respective channel)",
          "example": false
        },
        "preview": {
          "type": "boolean",
          "description": "false - not to be offered for review; true - to be offered for review. (Note: if supported by respective channel)",
          "example": true
        },
        "visibleSignature": {
          "type": "boolean",
          "description": "true - visual annotation of the signature (application coordinates are used, if submitted); false - no visual annotation. Default: true",
          "example": true,
          "default": true
        }
      },
      "required": [
        "fileName"
      ]
    },
    "AnnotationData": {
      "type": "object",
      "properties": {
        "fileName": {
          "type": "string",
          "description": "Name of the file with extension. Should correspond to the fileName from documents array."
        },
        "annotationText": {
          "type": "string",
          "description": "Text of the annotation",
          "maxLength": 255
        },
        "pageNum": {
          "type": "integer",
          "description": "Page number on which the annotation is located (0 for all pages, 1 ... to specify the exact page number)",
          "example": 1
        },
        "xAxis": {
          "type": "number",
          "description": "X coordinate of the upper left corner of annotation. (0,0) is the top left corner of the page",
          "example": 1
        },
        "yAxis": {
          "type": "number",
          "description": "Y coordinate of the upper left corner of the annotation. (0,0) is the top left corner of the page",
          "example": 2
        },
        "fontName": {
          "type": "string",
          "description": "Font name. Optional, if not available default value will be provided by DigiSign Gateway."
        },
        "fontSize": {
          "type": "integer",
          "description": "Font size of the annotation text. Must be a whole digit between 3 and 72. Optional, if not available default value will be provided by DigiSign Gateway."
        },
        "fontColor": {
          "type": "string",
          "description": "Font color of the annotation text. Must be in CSS hex notation between “#000000” and “#ffffff” (“#000000” for black). Optional, if not available default value will be provided by DigiSign Gateway."
        }
      },
      "required": [
        "fileName",
        "annotationText",
        "pageNum",
        "xAxis",
        "yAxis"
      ]
    },
    "SigningParticipantData": {
      "type": "object",
      "properties": {
        "names": {
          "type": "string",
          "description": "Names (first, middle, last) of signing participant. Required if 'oneTimeSigning' is 'false'. When 'oneTimeSigning' is 'true' filled by DigiSign from oneTimeRecipient's data (first and last name)."
        },
        "email": {
          "type": "string",
          "description": "E-mail of the participant."
        },
        "phone": {
          "type": "string",
          "description": "Phone number of the participant."
        },
        "ipAddress": {
          "type": "string",
          "description": "IP address of the participant."
        },
        "typeOfIdentifier": {
          "type": "string",
          "description": "Type of identifier of the participant. Required if 'oneTimeSigning' is 'false'. When 'oneTimeSigning' is 'true' will be set to 'PHONE' by DigiSign.",
          "enum": [
            "EGN",
            "LNC",
            "PHONE",
            "EMAIL"
          ]
        },
        "identifier": {
          "type": "string",
          "description": "Identifier of the participant. Required if 'oneTimeSigning' is 'false'. When 'oneTimeSigning' is 'true' filled by DigiSign with 'phone' from oneTimeRecipient's data."
        },
        "channel": {
          "type": "string",
          "description": "Channel that will be used by the signing participant to sign the document(s)",
          "default": "DOWNLOAD_AND_UPLOAD",
          "enum": [
            "BTRUST",
            "EVROTRUST",
            "SIGNATUS",
            "DOWNLOAD_AND_UPLOAD",
            "ONE_CLICK_SIGN_EXTERNAL",
            "ONE_CLICK_SIGN_INTERNAL",
            "RECIPIENT_CHOICE"
          ]
        },
        "signatureVendorAlias": {
          "type": "string",
          "description": "Signature vendor alias (from account in DigiSign Gateway)"
        },
        "billingMode": {
          "type": "string",
          "description": "Who pays for the signing of the document(s)",
          "default": "RELYING_PARTY",
          "enum": [
            "RELYING_PARTY",
            "CLIENT"
          ]
        },
        "oneTimeSigning": {
          "type": "boolean",
          "description": "One-Time Signing request",
          "default": false
        },
        "oneTimeRecipient": {
          "type": "object",
          "$ref": "#/definitions/OneTimeRecipientData"
        },
        "oneTimeAgent": {
          "type": "object",
          "$ref": "#/definitions/OneTimeAgentData"
        },
        "signAllDocumentsAtOnce": {
          "type": "boolean",
          "default": null,
          "description": "Sign documents as package. Applicable for Evrotrust & BTrust vendors and when count of documents in request is more than one"
        },
        "signaturePositions": {
          "type": "array",
          "description": "Position of the signatures. For package signing.",
          "items": {
            "$ref": "#/definitions/SignaturePositionData"
          }
        },
        "signingProperties": {
          "type": "array",
          "description": "Additional signing properties. For package signing.",
          "items": {
            "$ref": "#/definitions/SigningPropertiesData"
          }
        },
        "deviceId": {
          "type": "string",
          "description": "Valid identifier of active Signatus Device. From portal's settings or deviceId from list of devices received by service /settings/channels. Required when channel is SIGNATUS and processNow/autoprocess is true"
        },
        "protectionMode": {
          "type": "string",
          "description": "Protection mode of 1-Click Signing External link. if 'password' is selected 'linkPassword' value should be provided. if 'sms' is selected 'phone' should be provided.",
          "default": "none",
          "enum": [
            "none",
            "password",
            "sms"
          ]
        },
        "linkPassword": {
          "type": "string",
          "description": "Password to protect 1-Click Signing External link or Download & Upload link"
        },
        "autoSignerId": {
          "type": "string",
          "description": "Identifier of a person with configured B-Trust auto-signing. List of auto signers is available in response from /settings/channels:BTRUST "
        },
        "coverage": {
          "type": "integer",
          "description": "Coverage of the signature. For Evrotrust channel.",
          "default": null,
          "enum": [
            0,
            500,
            2000,
            20000,
            100000,
            250000
          ]
        },
        "annotations": {
          "type": "array",
          "description": "Text annotations with positions which should be added to the specified document at signing. Supported only by Evrotrust (If used can appear up to 4 times per document).",
          "items": {
            "$ref": "#/definitions/AnnotationData"
          }
        },
        "visualSignVariant": {
          "type": "string",
          "description": "Optional, supported only by channels 1-Click Signing Internal and External. Option \"DIGISIGN\" is the default visual sign representation (will also be applied if nothing is specified for supported channels). Option \"SCRIPT\" is for a handwritten visual sign with the signer's names.",
          "enum": [
            "DIGISIGN",
            "SCRIPT"
          ],
          "default": null
        },
        "autoprocess": {
          "type": "boolean",
          "description": "Optional, supported only by channels 1-Click Signing Internal and External. If the value is 'true' the signing will be executed automatically by DigiSign, without the participation of the signer.",
          "default": null
        },
        "signedDeclaration": {
          "type": "string",
          "description": "Base64-encoded content of signed declaration (PDF) of the employee for One-Time Signing. Supported only by Evrotrust.",
          "default": null
        },
        "employee": {
          "type": "object",
          "$ref": "#/definitions/EmployeeData",
          "description": "Employee data for declaration used in One-Time Signing. Supported only by B-Trust."
        },
        "sendSignedFile": {
          "type": "boolean",
          "description": "Send copy of signed file(s) to the signing participant",
          "default": null
        },
        "passwordSendSignedFile": {
          "type": "string",
          "description": "Password to ZIP archive with signed file(s)",
          "default": null
        }
      },
      "required": [
        "names",
        "typeOfIdentifier",
        "identifier"
      ]
    },
    "OneTimeRecipientData": {
      "type": "object",
      "description": "For Bulgarian users has to be provided \"documentNumber\" and at least one of the \"identificationNumber\" or the three names. If the \"identificationNumber\" is provided, a check in the national register will be performed.",
      "properties": {
        "country": {
          "type": "string",
          "description": "Country code of the recipient. Valid values are the ISO 3166-1 alpha-2 codes. ",
          "example": "BG"
        },
        "identificationNumber": {
          "type": "string",
          "description": "Personal Identification Number (EGN) of the recipient"
        },
        "documentNumber": {
          "type": "string",
          "description": "Document Number of the recipient"
        },
        "firstName": {
          "type": "string",
          "description": "First name of the recipient. Allowed characters \"[A-Za-z' -]\""
        },
        "middleName": {
          "type": "string",
          "description": "Middle name of the recipient. It’s used only if the country is \"BG\" and no \"identificationNumber\" is provided. Allowed characters \"[A-Za-z' -]\". "
        },
        "lastName": {
          "type": "string",
          "description": "Last name of the recipient. Allowed characters \"[A-Za-z' -]\""
        },
        "phone": {
          "type": "string",
          "description": "Phone number of the recipient. Should match the following pattern \"+[0-9]\"",
          "example": "+3598800000"
        },
        "email": {
          "type": "string",
          "description": "Email address of the recipient. Optional parameter. If provided the certificate and signed documents will be sent to it."
        },
        "language": {
          "type": "string",
          "description": "Preferred language of th UI",
          "default": "bg",
          "enum": [
            "bg",
            "en",
            "de",
            "hu",
            "sq"
          ]
        },
        "codeConfirmation": {
          "type": "string",
          "description": "Code confirmation provider. Option \"VENDOR\" is default for Evrotrust. Option \"DIGISIGN\" is default for B-Trust.",
          "enum": [
            "VENDOR",
            "DIGISIGN"
          ]
        },
        "personIdentifierType": {
          "type": "string",
          "description": "Type of person identification number. REQUIRED for B-Trust.",
          "enum": [
            "EGN",
            "LNC",
            "FOREIGN",
            "FOREIGN_IC",
            "OTHER"
          ]
        },
        "personDocumentType": {
          "type": "string",
          "description": "Type of person document. REQUIRED for B-Trust.",
          "enum": [
            "ID_CARD",
            "PASSPORT",
            "FOREIGN",
            "FOREIGN_ID",
            "NAP_DOCUMENT",
            "RESIDENCE_CARD",
            "RESIDENCE_CARD_EU_MEMBER",
            "RESIDENCE_CARD_FAMILY_MEMBER",
            "RESIDENCE_PERMIT"
          ]
        },
        "firstNameCyrillic": {
          "type": "string",
          "description": "First name (Cyrillic) of the recipient."
        },
        "middleNameCyrillic": {
          "type": "string",
          "description": "Middle name (Cyrillic) of the recipient."
        },
        "lastNameCyrillic": {
          "type": "string",
          "description": "Last name (Cyrillic) of the recipient."
        },
        "birthCountryCode": {
          "type": "string",
          "description": "Person’s birth country code. Valid values are the ISO 3166-1 alpha-2 codes. REQUIRED for B-Trust.",
          "example": "BG"
        },
        "birthDate": {
          "type": "string",
          "description": "Person’s date of birth. REQUIRED for B-Trust.",
          "format": "yyyy-MM-dd",
          "example": "2023-12-21"
        },
        "documentIssueDate": {
          "type": "string",
          "description": "Identity document issue date. REQUIRED for B-Trust.",
          "format": "yyyy-MM-dd",
          "example": "2023-12-21"
        },
        "documentValidityDate": {
          "type": "string",
          "description": "Identity document validity. REQUIRED for B-Trust.",
          "format": "yyyy-MM-dd",
          "example": "2023-12-21"
        },
        "personAddress": {
          "type": "object",
          "description": "Person address data.",
          "$ref": "#/definitions/PersonAddressData"
        },
        "oneTimeOTPLINK": {
          "type": "string",
          "description": "Supported by B-Trust only. The value specify how the user will verify signing the documents. Options are OTP, LINK or OTPandLink and if not specified it defaults to OTP",
          "enum": [
            "OTP",
            "LINK",
            "OTPandLink"
          ]
        }
      },
      "required": [
        "documentNumber",
        "phone",
        "language",
        "codeConfirmation"
      ]
    },
    "OneTimeAgentData": {
      "type": "object",
      "properties": {
        "country": {
          "type": "string",
          "description": "Country code of the agent. Valid values are the ISO 3166-1 alpha-2 codes.",
          "example": "BG"
        },
        "identificationNumber": {
          "type": "string",
          "description": "Personal Identification Number (EGN) of the agent"
        },
        "phone": {
          "type": "string",
          "description": "Phone number of the agent. Should match the following pattern \"+[0-9]\"",
          "example": "+3598800000"
        }
      },
      "required": [
        "country",
        "identificationNumber",
        "phone"
      ]
    },
    "PersonAddressData": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string",
          "description": "Place of residence address - street, number, neighborhood, block, apartment etc…"
        },
        "city": {
          "type": "string",
          "description": "Place of residence city"
        },
        "countryCode": {
          "type": "string",
          "description": "Place of residence country code. Valid values are the ISO 3166-1 alpha-2 codes.",
          "example": "BG"
        }
      },
      "required": [
        "address",
        "countryCode"
      ]
    },
    "EmployeeData": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "description": "Email address of the employee"
        },
        "employeeId": {
          "type": "string",
          "description": "Employee ID"
        },
        "fullNameCyrillic": {
          "type": "string",
          "description": "Full name of the employee in Cyrillic"
        },
        "fullNameLatin": {
          "type": "string",
          "description": "Full name of the employee in Latin"
        },
        "phone": {
          "type": "string",
          "description": "Phone number of the employee"
        },
        "position": {
          "type": "string",
          "description": "Position of the employee"
        }
      }
    },
    "OTPCodeValidationRequest": {
      "type": "object",
      "properties": {
        "unid": {
          "type": "string",
          "description": "UNID of the sign request"
        },
        "otpCode": {
          "type": "string",
          "description": "OTP code received from vendor"
        },
        "phone": {
          "type": "string",
          "description": "Optional parameter. Phone number of the current signing party. If specified will be checked against current signing party phone number. Format \"+[0-9]\".",
          "example": "+3598800000"
        }
      },
      "required": [
        "unid",
        "otpCode"
      ]
    },
    "OTPCodeValidationResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean",
          "description": "Is validation passed successfully",
          "example": true
        },
        "remainingAttempts": {
          "type": "integer",
          "description": "Remaining validation attempts",
          "example": 0
        },
        "details": {
          "type": "string",
          "description": "Additional details about occurred error"
        }
      }
    },
    "OTPCodeResendRequest": {
      "type": "object",
      "properties": {
        "unid": {
          "type": "string",
          "description": "UNID of the sign request"
        },
        "phone": {
          "type": "string",
          "description": "Optional parameter. Phone number of the current signing party. If specified will be checked against current signing party phone number. Format \"+[0-9]\".",
          "example": "+3598800000"
        }
      },
      "required": [
        "unid"
      ]
    },
    "OTPCodeResendResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean",
          "description": "Is resend passed successfully",
          "example": true
        },
        "details": {
          "type": "string",
          "description": "Additional details about occurred error"
        }
      }
    },
    "CancellationRequest": {
      "type": "object",
      "properties": {
        "unid": {
          "type": "string",
          "description": "UNID of the sign request"
        },
        "reason": {
          "type": "string",
          "description": "Reason for the cancellation. Will be set in processing signing participant"
        }
      },
      "required": [
        "unid"
      ]
    },
    "CancellationResponse": {
      "type": "object",
      "properties": {
        "unid": {
          "type": "string",
          "description": "Identifier of sign request"
        },
        "status": {
          "type": "string",
          "description": "Status of sign request after operation",
          "default": "Withdrawn",
          "enum": [
            "Waiting",
            "Processing",
            "Signed",
            "Rejected",
            "Expired",
            "Withdrawn",
            "Locked",
            "Error"
          ]
        },
        "errorMessage": {
          "type": "string",
          "description": "Description of error"
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "SigningParticipantUpdateData": {
      "type": "object",
      "properties": {
        "identifier": {
          "type": "string",
          "description": "Identifier of the participant. Specified for the participant in /create request. Email, phone, EGN or LNC. "
        },
        "signaturePositions": {
          "type": "array",
          "description": "Position of the signatures. 'fileName' in signature position item should correspond to the 'fileName' in /create request, otherwise signature position will be ignored.",
          "items": {
            "$ref": "#/definitions/SignaturePositionData"
          }
        },
        "visualSignVariant": {
          "type": "string",
          "description": "Optional, supported only by channels 1-Click Signing Internal and External. Option \"DIGISIGN\" is the default visual sign representation (will also be applied if nothing is specified for supported channels). Option \"SCRIPT\" is for a handwritten visual sign with the signer's names.",
          "enum": [
            "DIGISIGN",
            "SCRIPT"
          ],
          "default": null
        }
      },
      "required": [
        "identifier"
      ]
    }
  }
}