{
	"openapi": "3.1.0",
	"info": {
		"title": "Signatus APIs",
		"contact": {
			"name": "Signatus support",
			"email": "signatus.support@anasoft.com"
		},
		"version": "1.10"
	},
	"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"
								}
							}
						}
					}
				}
			}
		},
		"/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",
				"description": "Downloads the content of the envelope. The content parameter selects what is included: `envelope` (default) - envelope data as envelope.json and all documents; `documents` - documents only; `data` - technical export of envelope data, audit trail and server logs (password-protected zip). If `documents` contains exactly one PDF, the PDF is returned directly, not zipped.",
				"operationId": "getEnvelopeData",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"description": "Envelope Id",
						"required": true,
						"schema": {
							"type": "string"
						}
					},
					{
						"name": "content",
						"in": "query",
						"description": "Zip contents: `envelope` - envelope.json and documents, `documents` - documents only, `data` - technical export (envelope data, audit, logs; password-protected zip)",
						"required": false,
						"schema": {
							"type": "string",
							"default": "envelope",
							"enum": [
								"envelope",
								"documents",
								"data"
							]
						},
						"example": "envelope"
					}
				],
				"responses": {
					"200": {
						"description": "Zip archive (or a single PDF file)",
						"content": {
							"application/zip": {}
						}
					},
					"400": {
						"description": "err.missing.id - missing envelope id",
						"content": {
							"application/zip": {
								"schema": {
									"type": "object"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"403": {
						"description": "err.userId.not.match - the envelope does not belong to the user",
						"content": {
							"application/zip": {
								"schema": {
									"type": "object"
								}
							}
						}
					},
					"404": {
						"description": "err.file.empty - nothing to export (e.g. unsupported content value)",
						"content": {
							"application/zip": {
								"schema": {
									"type": "object"
								}
							}
						}
					},
					"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": "state",
						"in": "query",
						"description": "Envelope state",
						"required": false,
						"schema": {
							"type": "string"
						},
						"example": "ready"
					},
					{
						"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"
								}
							}
						}
					}
				}
			}
		},
		"/api/counters": {
			"get": {
				"tags": [
					"Api Controller"
				],
				"summary": "Get envelope and document size counters of the logged user",
				"description": "Returns usage counters of the logged user: created envelopes and stored documents size (in total and in the current month), the envelope limit for API source and the number of envelopes still available (envelopesApiLimit - envelopesAll). Sizes are in kB.",
				"operationId": "getUserCounters",
				"responses": {
					"200": {
						"description": "Counters JSONObject",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CountersResponse"
								}
							}
						}
					},
					"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"
											}
										}
									}
								},
								"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": "{}"
					},
					"created": {
						"type": "number",
						"example": 1730308840000
					},
					"email": {
						"type": "string",
						"example": "employer@anasoft.com"
					},
					"envelopetypeid": {
						"type": "integer",
						"format": "int32",
						"example": 27
					},
					"expirationtime": {
						"type": "number",
						"example": 1730395240000
					},
					"extension": {
						"example": "{}"
					},
					"folder": {
						"type": "string",
						"enum": [
							"Faktúra",
							"Objednávka",
							"Osobné",
							"Pracovné",
							"Protokol",
							"Urgentné",
							"Zmluva"
						],
						"example": "Contract"
					},
					"id": {
						"type": "string",
						"example": "90523892-4bff-42e0-b151-89e967db0658"
					},
					"name": {
						"type": "string",
						"example": "Contract no. 1245726"
					},
					"processes": {
						"type": "array",
						"items": {
							"properties": {
								"created": {
									"type": "number",
									"example": 1730308840000
								},
								"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"
								},
								"updated": {
									"type": "number",
									"example": 1730308840000
								},
								"user": {
									"type": "string",
									"example": "user"
								},
								"userId": {
									"type": "string",
									"example": "user"
								}
							}
						}
					},
					"product": {
						"type": "array"
					},
					"rules": {
						"example": "{}"
					},
					"source": {
						"type": "string",
						"example": "api"
					},
					"state": {
						"type": "string",
						"enum": [
							"ready",
							"waiting",
							"attach"
						],
						"example": "ready"
					},
					"tenant": {
						"type": "string",
						"example": "anasoft"
					},
					"type": {
						"type": "string",
						"example": "menu1"
					},
					"updated": {
						"type": "number",
						"example": 1730308840000
					},
					"userId": {
						"type": "string",
						"example": "user"
					}
				}
			},
			"EnvelopeArrayResponse": {
				"type": "array",
				"items": {
					"contentMediaType": "application/json",
					"properties": {
						"contact": {
							"example": "{}"
						},
						"created": {
							"type": "number",
							"example": 1730308840000
						},
						"email": {
							"type": "string",
							"example": "employer@anasoft.com"
						},
						"envelopetypeid": {
							"type": "integer",
							"format": "int32",
							"example": 27
						},
						"expirationtime": {
							"type": "number",
							"example": 1730395240000
						},
						"extension": {
							"example": "{}"
						},
						"folder": {
							"type": "string",
							"enum": [
								"Faktúra",
								"Objednávka",
								"Osobné",
								"Pracovné",
								"Protokol",
								"Urgentné",
								"Zmluva"
							],
							"example": "Contract"
						},
						"id": {
							"type": "string",
							"example": "90523892-4bff-42e0-b151-89e967db0658"
						},
						"name": {
							"type": "string",
							"example": "Contract no. 1245726"
						},
						"processes": {
							"type": "array",
							"items": {
								"properties": {
									"created": {
										"type": "number",
										"example": 1730308840000
									},
									"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"
									},
									"updated": {
										"type": "number",
										"example": 1730308840000
									},
									"user": {
										"type": "string",
										"example": "user"
									},
									"userId": {
										"type": "string",
										"example": "user"
									}
								}
							}
						},
						"product": {
							"type": "array"
						},
						"rules": {
							"example": "{}"
						},
						"source": {
							"type": "string",
							"example": "api"
						},
						"state": {
							"type": "string",
							"enum": [
								"ready",
								"waiting",
								"attach"
							],
							"example": "ready"
						},
						"tenant": {
							"type": "string",
							"example": "anasoft"
						},
						"type": {
							"type": "string",
							"example": "menu1"
						},
						"updated": {
							"type": "number",
							"example": 1730308840000
						},
						"userId": {
							"type": "string",
							"example": "user"
						}
					}
				}
			},
			"ProcessResponse": {
				"contentMediaType": "application/json",
				"properties": {
					"created": {
						"type": "number",
						"example": 1713529170826
					},
					"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"
					},
					"updated": {
						"type": "number",
						"example": 1713529170826
					},
					"userId": {
						"type": "string",
						"example": "user"
					}
				}
			},
			"DeleteResponse": {
				"contentMediaType": "application/json",
				"properties": {
					"message": {
						"type": "string",
						"example": "msg.delete.success"
					}
				}
			},
			"CountersResponse": {
				"contentMediaType": "application/json",
				"properties": {
					"envelopesAll": {
						"type": "integer",
						"format": "int32",
						"example": 12
					},
					"envelopesApiLimit": {
						"type": "integer",
						"format": "int32",
						"example": 100
					},
					"envelopesAvailable": {
						"type": "integer",
						"format": "int32",
						"example": 88
					},
					"envelopesMonth": {
						"type": "integer",
						"format": "int32",
						"example": 3
					},
					"sizeDocsAll": {
						"type": "integer",
						"format": "int32",
						"example": 4096
					},
					"sizeDocsMonth": {
						"type": "integer",
						"format": "int32",
						"example": 1024
					},
					"tenant": {
						"type": "string",
						"example": "anasoft"
					},
					"updated": {
						"type": "number",
						"example": 1753434716882
					},
					"userId": {
						"type": "string",
						"example": "user"
					}
				}
			},
			"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"
			}
		}
	}
}