{
	"openapi": "3.1.0",
	"info": {
		"title": "Signatus APIs",
		"contact": {
			"name": "Signatus support",
			"email": "signatus.support@anasoft.com"
		},
		"version": "1.0"
	},
	"servers": [
		{
			"url": ""
		}
	],
	"security": [
		{
			"BearerAuthentication": []
		}
	],
	"paths": {
		"/api/envelope": {
			"post": {
				"tags": [
					"Api Controller"
				],
				"summary": "Create envelope",
				"operationId": "createEnvelope",
				"requestBody": {
					"description": "dataText : Envelope data in JSON format \n\nfile1 : Upload file 1-n with key according to processes.documents.reference values in dataText json\n",
					"content": {
						"multipart/form-data": {
							"schema": {
								"$ref": "#/components/schemas/EnvelopeRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Envelope JSONObject",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EnvelopeResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				}
			},
			"patch": {
				"tags": [
					"Api Controller"
				],
				"summary": "Update envelope",
				"operationId": "updateEnvelope",
				"requestBody": {
					"description": "dataText : Envelope data in JSON format \n\nfile1 : Upload file 1-n with key according to processes.documents.reference values in dataText json\n",
					"content": {
						"multipart/form-data": {
							"schema": {
								"$ref": "#/components/schemas/EnvelopeRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Envelope JSONObject",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EnvelopeResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				}
			}
		},
		"/api/process/{id}": {
			"get": {
				"tags": [
					"Api Controller"
				],
				"summary": "Get info about process by id",
				"operationId": "getProcessInfo",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"description": "Process Id",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "Process JSONObject",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ProcessResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				}
			}
		},
		"/api/envelopeData/{id}": {
			"get": {
				"tags": [
					"Api Controller"
				],
				"summary": "Download envelope data and documents as zip",
				"operationId": "getEnvelopeData",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"description": "Envelope Id",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/zip": {
								"schema": {
									"type": "object"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				}
			}
		},
		"/api/envelope/{id}": {
			"get": {
				"tags": [
					"Api Controller"
				],
				"summary": "Get info about envelope by id",
				"operationId": "getEnvelopeInfo",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"description": "Envelope Id",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "Envelope JSONObject",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EnvelopeResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				}
			},
			"delete": {
				"tags": [
					"Api Controller"
				],
				"summary": "Delete envelope by id",
				"operationId": "deleteEnvelope",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"description": "Envelope Id",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "Delete success",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/DeleteResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				}
			}
		},
		"/api/envelope/list": {
			"get": {
				"tags": [
					"Api Controller"
				],
				"summary": "Get envelopes according to the search criteria",
				"operationId": "getEnvelopeByQuery",
				"parameters": [
					{
						"name": "createdFrom",
						"in": "query",
						"description": "Envelope created from. Datetime in dd.MM.yyyy'T'HH:mm format",
						"required": false,
						"schema": {
							"type": "string"
						},
						"example": "01.07.2024T08:00"
					},
					{
						"name": "createdTo",
						"in": "query",
						"description": "Envelope created to. Datetime in dd.MM.yyyy'T'HH:mm format",
						"required": false,
						"schema": {
							"type": "string"
						},
						"example": "31.07.2024T23:59"
					},
					{
						"name": "type",
						"in": "query",
						"description": "Envelope type",
						"required": false,
						"schema": {
							"type": "string"
						},
						"example": "inbox"
					},
					{
						"name": "archive",
						"in": "query",
						"required": false,
						"schema": {
							"type": "boolean",
							"default": false
						}
					}
				],
				"responses": {
					"200": {
						"description": "Array of Envelope JSONObject",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/EnvelopeArrayResponse"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				}
			}
		},
		"/api/envelope/complete/{id}": {
			"get": {
				"tags": [
					"Api Controller"
				],
				"summary": "Get complete info about envelope",
				"operationId": "getEnvelopeComplete",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"description": "Envelope Id",
						"required": true,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "type",
						"in": "query",
						"description": "Envelope type",
						"required": false,
						"schema": {
							"type": "string"
						},
						"example": "inbox"
					}
				],
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"application/json": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				}
			}
		}
	},
	"components": {
		"schemas": {
			"EnvelopeData": {
				"contentMediaType": "application/json",
				"properties": {
					"email": {
						"type": "string",
						"example": "employer@anasoft.com"
					},
					"envelopetype": {
						"type": "string",
						"example": "default"
					},
					"expirationtime": {
						"type": "number",
						"example": 1730395240000
					},
					"extension": {
						"example": "{}"
					},
					"folder": {
						"type": "string",
						"enum": [
							"Faktúra",
							"Objednávka",
							"Osobné",
							"Pracovné",
							"Protokol",
							"Urgentné",
							"Zmluva"
						],
						"example": "Contract"
					},
					"name": {
						"type": "string",
						"example": "Contract no. 1245726"
					},
					"processes": {
						"type": "array",
						"items": {
							"properties": {
								"documents": {
									"type": "array",
									"items": {
										"properties": {
											"method": {
												"type": "string",
												"enum": [
													"write",
													"read",
													"optional",
													"attachment"
												],
												"example": "write"
											},
											"reference": {
												"type": "string",
												"example": "file1"
											},
											"template": {
												"type": "string",
												"example": "contract"
											}
										}
									}
								},
								"signer": {
									"type": "string",
									"example": "user"
								},
								"sigtype": {
									"type": "string",
									"enum": [
										"bio",
										"data",
										"otp",
										"qes"
									],
									"example": "bio"
								}
							}
						}
					},
					"rules": {
						"example": "{}",
						"properties": {
							"emailFinal": {
								"type": "string",
								"example": "employer@company.com"
							},
							"emailFrom": {
								"type": "string",
								"example": "employer@anasoft.com"
							},
							"emailMessage": {
								"type": "string",
								"example": "E-mail additional message"
							},
							"emailTo": {
								"type": "string",
								"example": "customer@company.com"
							},
							"guiAutoEnvelopeSubmit": {
								"type": "boolean",
								"example": false
							},
							"guiAutoSubmit": {
								"type": "boolean",
								"example": false
							},
							"guiOneButton": {
								"type": "boolean",
								"example": false
							},
							"guiOpenSignature": {
								"type": "boolean",
								"example": false
							},
							"guiRemoteQRCodeEnabled": {
								"type": "boolean",
								"example": false
							},
							"guiRequestSignerName": {
								"type": "boolean",
								"example": false
							},
							"guiSignatureNumber": {
								"type": "integer",
								"format": "int32",
								"example": 1
							},
							"guiSignerName": {
								"type": "string",
								"example": "John Doe"
							},
							"lang": {
								"type": "string",
								"enum": [
									"sk",
									"en"
								],
								"example": "en"
							},
							"mouseSignature": {
								"type": "boolean",
								"example": true
							},
							"nameFrom": {
								"type": "string",
								"example": "Employer"
							},
							"notificationExpiration": {
								"type": "boolean",
								"example": true
							},
							"openOtpCode.user": {
								"type": "string",
								"example": "1234"
							},
							"openOtpEmail.user": {
								"type": "string",
								"example": "customer@company.com"
							},
							"openOtpPhone.user": {
								"type": "string",
								"example": "+421905123456"
							},
							"resulturl": {
								"type": "string",
								"example": "https://signatus.com"
							},
							"sendInfo": {
								"type": "string",
								"example": "https://sts.signatus.sk/STSTest/info"
							},
							"sendInfo.user": {
								"type": "string",
								"example": "https://sts.signatus.sk/STSTest/info"
							},
							"signAnywhereEnabled": {
								"type": "boolean",
								"example": true
							},
							"signOtpCode.user": {
								"type": "string",
								"example": "1234"
							},
							"signOtpEmail.user": {
								"type": "string",
								"example": "customer@company.com"
							},
							"signOtpPhone.user": {
								"type": "string",
								"example": "+421905123456"
							}
						}
					},
					"state": {
						"type": "string",
						"enum": [
							"ready",
							"waiting",
							"attach"
						],
						"example": "ready"
					},
					"type": {
						"type": "string",
						"example": "menu1"
					}
				}
			},
			"EnvelopeResponse": {
				"contentMediaType": "application/json",
				"properties": {
					"contact": {
						"example": "{}"
					},
					"email": {
						"type": "string",
						"example": "employer@anasoft.com"
					},
					"envelopetypeid": {
						"type": "integer",
						"format": "int32",
						"example": 27
					},
					"expirationtime": {
						"type": "number",
						"example": 1730395240000
					},
					"extension": {
						"example": "{}"
					},
					"id": {
						"type": "string",
						"example": "90523892-4bff-42e0-b151-89e967db0658"
					},
					"name": {
						"type": "string",
						"example": "Contract no. 1245726"
					},
					"processes": {
						"type": "array",
						"items": {
							"properties": {
								"envelopeid": {
									"type": "string",
									"example": "90523892-4bff-42e0-b151-89e967db0658"
								},
								"envelopetypeid": {
									"type": "integer",
									"format": "int32",
									"example": 27
								},
								"extension": {
									"example": "{}"
								},
								"id": {
									"type": "string",
									"example": "655daf4d-409d-454f-a566-b8fd92223f50"
								},
								"rules": {
									"example": "{}"
								},
								"signer": {
									"type": "string",
									"example": "user"
								},
								"sigtype": {
									"type": "string",
									"enum": [
										"bio",
										"data",
										"otp",
										"qes"
									],
									"example": "bio"
								},
								"state": {
									"type": "string",
									"enum": [
										"ready",
										"waiting",
										"attach"
									],
									"example": "ready"
								},
								"tenant": {
									"type": "string",
									"example": "anasoft"
								},
								"user": {
									"type": "string",
									"example": "proxy"
								},
								"userId": {
									"type": "string",
									"example": "proxy"
								}
							}
						}
					},
					"product": {
						"type": "array"
					},
					"rules": {
						"example": "{}"
					},
					"state": {
						"type": "string",
						"enum": [
							"ready",
							"waiting",
							"attach"
						],
						"example": "ready"
					},
					"tenant": {
						"type": "string",
						"example": "anasoft"
					},
					"type": {
						"type": "string",
						"example": "menu1"
					},
					"userId": {
						"type": "string",
						"example": "proxy"
					}
				}
			},
			"EnvelopeArrayResponse": {
				"type": "array",
				"items": {
					"contentMediaType": "application/json",
					"properties": {
						"contact": {
							"example": "{}"
						},
						"email": {
							"type": "string",
							"example": "employer@anasoft.com"
						},
						"envelopetypeid": {
							"type": "integer",
							"format": "int32",
							"example": 27
						},
						"expirationtime": {
							"type": "number",
							"example": 1730395240000
						},
						"extension": {
							"example": "{}"
						},
						"id": {
							"type": "string",
							"example": "90523892-4bff-42e0-b151-89e967db0658"
						},
						"name": {
							"type": "string",
							"example": "Contract no. 1245726"
						},
						"processes": {
							"type": "array",
							"items": {
								"properties": {
									"envelopeid": {
										"type": "string",
										"example": "90523892-4bff-42e0-b151-89e967db0658"
									},
									"envelopetypeid": {
										"type": "integer",
										"format": "int32",
										"example": 27
									},
									"extension": {
										"example": "{}"
									},
									"id": {
										"type": "string",
										"example": "655daf4d-409d-454f-a566-b8fd92223f50"
									},
									"rules": {
										"example": "{}"
									},
									"signer": {
										"type": "string",
										"example": "user"
									},
									"sigtype": {
										"type": "string",
										"enum": [
											"bio",
											"data",
											"otp",
											"qes"
										],
										"example": "bio"
									},
									"state": {
										"type": "string",
										"enum": [
											"ready",
											"waiting",
											"attach"
										],
										"example": "ready"
									},
									"tenant": {
										"type": "string",
										"example": "anasoft"
									},
									"user": {
										"type": "string",
										"example": "proxy"
									},
									"userId": {
										"type": "string",
										"example": "proxy"
									}
								}
							}
						},
						"product": {
							"type": "array"
						},
						"rules": {
							"example": "{}"
						},
						"state": {
							"type": "string",
							"enum": [
								"ready",
								"waiting",
								"attach"
							],
							"example": "ready"
						},
						"tenant": {
							"type": "string",
							"example": "anasoft"
						},
						"type": {
							"type": "string",
							"example": "menu1"
						},
						"userId": {
							"type": "string",
							"example": "proxy"
						}
					}
				}
			},
			"ProcessResponse": {
				"contentMediaType": "application/json",
				"properties": {
					"documentsProcess": {
						"type": "array",
						"items": {
							"properties": {
								"created": {
									"type": "number",
									"example": 1713529170826
								},
								"data": {
									"example": "{}"
								},
								"documentid": {
									"type": "string",
									"example": "2ccba923-e2c5-4bc6-ab0c-63feb808701a"
								},
								"envelopeid": {
									"type": "string",
									"example": "1b7b7d4f-211d-40bd-849d-10315bc34e71"
								},
								"filename": {
									"type": "string",
									"example": "file1"
								},
								"method": {
									"type": "string",
									"enum": [
										"write",
										"read",
										"optional",
										"attachment"
									],
									"example": "write"
								},
								"processid": {
									"type": "string",
									"example": "6c00e95f-0e18-4c85-bc42-13837c113d3d"
								},
								"state": {
									"type": "string",
									"enum": [
										"ready",
										"waiting",
										"attach"
									],
									"example": "ready"
								},
								"updated": {
									"type": "number",
									"example": 1713529170826
								}
							}
						}
					},
					"envelopeid": {
						"type": "string",
						"example": "1b7b7d4f-211d-40bd-849d-10315bc34e71"
					},
					"envelopetypeid": {
						"type": "integer",
						"format": "int32",
						"example": 27
					},
					"extension": {
						"example": "{}"
					},
					"id": {
						"type": "string",
						"example": "6c00e95f-0e18-4c85-bc42-13837c113d3d"
					},
					"rules": {
						"example": "{}"
					},
					"signer": {
						"type": "string",
						"example": "user"
					},
					"sigtype": {
						"type": "string",
						"enum": [
							"bio",
							"data",
							"otp",
							"qes"
						],
						"example": "bio"
					},
					"state": {
						"type": "string",
						"enum": [
							"ready",
							"waiting",
							"attach"
						],
						"example": "ready"
					},
					"tenant": {
						"type": "string",
						"example": "anasoft"
					}
				}
			},
			"DeleteResponse": {
				"contentMediaType": "application/json",
				"properties": {
					"message": {
						"type": "string",
						"example": "msg.delete.success"
					}
				}
			},
			"ErrorBody": {
				"type": "object",
				"properties": {
					"message": {
						"type": "string"
					},
					"value": {},
					"tenant": {
						"type": "string"
					}
				}
			},
			"EnvelopeRequest": {
				"type": "object",
				"properties": {
					"dataText": {
						"type": "string",
						"$ref": "#/components/schemas/EnvelopeData"
					},
					"file1": {
						"type": "string",
						"format": "binary",
						"writeOnly": true
					}
				}
			}
		},
		"securitySchemes": {
			"BearerAuthentication": {
				"type": "http",
				"scheme": "bearer",
				"bearerFormat": "JWT"
			}
		}
	}
}