{
	"openapi": "3.1.0",
	"info": {
		"title": "Signatus API",
		"description": "Signatus integration API",
		"contact": {
			"name": "Support",
			"email": "signatus.support@anasoft.com"
		},
		"version": "1.0"
	},
	"servers": [
		{
			"url": "http://localhost:8080",
			"description": "Generated server url"
		}
	],
	"paths": {
		"/rest/state": {
			"post": {
				"tags": [
					"sts-controller"
				],
				"summary": "Acknowledge download - Change document state",
				"description": "Updates the state of a document (e.g., download, open, cancel). Consumes form data. This service is optional. When using `cookieAuth`, the `JSESSIONID` cookie from the `/api/login` response should be used.",
				"operationId": "changeState",
				"requestBody": {
					"content": {
						"multipart/form-data": {
							"schema": {
								"$ref": "#/components/schemas/ChangeState"
							}
						}
					},
					"required": true
				},
				"responses": {
					"200": {
						"description": "State change successful",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Result"
								},
								"examples": {
									"Response Example": {
										"description": "Response Example",
										"value": {
											"message": "msg.document.move.success",
											"result": "rorBJvTZ_-qsm8101I4DfaD7PJQDbl0sUnmAF4r8Vmm4vFDJV8rRvSGoYf3e24UZVzkq6_5fYkX6d1Sgtm1eYd7tq9pXjp3tJluzKgJBIzg"
										}
									}
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"404": {
						"description": "Document not found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"409": {
						"description": "Conflict",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				},
				"security": [
					{
						"basicAuth": []
					},
					{
						"cookieAuth": []
					}
				]
			}
		},
		"/rest/document": {
			"post": {
				"tags": [
					"sts-controller"
				],
				"summary": "Upload a new or update existing document",
				"description": "Uploads a document with metadata. The endpoint consumes data in multipart/form-data format. When using `cookieAuth`, the `JSESSIONID` cookie from the `/api/login` response should be used.",
				"operationId": "uploadFile",
				"requestBody": {
					"content": {
						"multipart/form-data": {
							"schema": {
								"$ref": "#/components/schemas/UploadRequest"
							}
						}
					},
					"required": true
				},
				"responses": {
					"200": {
						"description": "Document upload successful",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/Result"
								},
								"examples": {
									"Response Example": {
										"description": "Response Example",
										"value": {
											"message": "msg.document.upload",
											"result": "rorBJvTZ_-qsm8101I4DfaD7PJQDbl0sUnmAF4r8Vmm4vFDJV8rRvSGoYf3e24UZVzkq6_5fYkX6d1Sgtm1eYd7tq9pXjp3tJluzKgJBIzg"
										}
									}
								}
							}
						}
					},
					"400": {
						"description": "Bad request",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"404": {
						"description": "Document not found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				},
				"security": [
					{
						"basicAuth": []
					},
					{
						"cookieAuth": []
					}
				]
			}
		},
		"/rest/list/flat": {
			"get": {
				"tags": [
					"sts-controller"
				],
				"summary": "List documents",
				"description": "Lists documents for signing. When using `cookieAuth`, the `JSESSIONID` cookie from the `/api/login` response should be used.",
				"operationId": "getFlatList",
				"responses": {
					"200": {
						"description": "List of documents",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ListResponse"
								},
								"examples": {
									"Response Example": {
										"description": "Response Example",
										"value": [
											{
												"date": 1776858989931,
												"filename": "Test-216.pdf",
												"id": "rorBJvTZ_-qsm8101I4DfaD7PJQDbl0sUnmAF4r8Vmm4vFDJV8rRvSGoYf3e24UZVzkq6_5fYkX6d1Sgtm1eYd7tq9pXjp3tJluzKgJBIzg",
												"modification": "2026-04-22 13:56:29",
												"reuploadState": "signed",
												"state": "tosign",
												"url": "https://ds-sts.ana.sk/rest/document/rorBJvTZ_-qsm8101I4DfaD7PJQDbl0sUnmAF4r8Vmm4vFDJV8rRvSGoYf3e24UZVzkq6_5fYkX6d1Sgtm1eYd7tq9pXjp3tJluzKgJBIzg",
												"number": "111",
												"name": "Ernestine Herman",
												"box": "Inbox",
												"group": "tablet",
												"sid": "McKenzie - O'Conner"
											}
										]
									}
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				},
				"security": [
					{
						"basicAuth": []
					},
					{
						"cookieAuth": []
					}
				]
			}
		},
		"/rest/document/{id}": {
			"get": {
				"tags": [
					"sts-controller"
				],
				"summary": "Download a document",
				"description": "Downloads the document content as binary data for the given document ID. When using `cookieAuth`, the `JSESSIONID` cookie from the `/api/login` response should be used.",
				"operationId": "downloadFile",
				"parameters": [
					{
						"name": "id",
						"in": "path",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "Document content",
						"content": {
							"application/pdf": {}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"404": {
						"description": "Document not found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				},
				"security": [
					{
						"basicAuth": []
					},
					{
						"cookieAuth": []
					}
				]
			}
		},
		"/api/login": {
			"get": {
				"tags": [
					"sts-controller"
				],
				"summary": "Login to server",
				"description": "Authenticates the user and returns user information. This service is optional and primarily used for session-based authentication.",
				"operationId": "loginGet",
				"responses": {
					"200": {
						"description": "Successfully authenticated. The session ID is returned in a cookie named `JSESSIONID`. You need to include this cookie in subsequent requests.",
						"headers": {
							"Set-Cookie": {
								"description": "JSESSIONID=abcde12345; Path=/; HttpOnly",
								"style": "simple",
								"schema": {
									"type": "string"
								}
							}
						},
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/LoginResponse"
								},
								"examples": {
									"Example Response": {
										"description": "Example Response",
										"value": {
											"userInfo": {
												"roles": [
													"ROLE_USER"
												],
												"additional": "test user",
												"userName": "tablet"
											}
										}
									}
								}
							}
						}
					},
					"401": {
						"description": "Unauthorized",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					},
					"500": {
						"description": "Internal Server Error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorBody"
								}
							}
						}
					}
				},
				"security": [
					{
						"basicAuth": []
					},
					{
						"cookieAuth": []
					}
				]
			}
		}
	},
	"components": {
		"schemas": {
			"ChangeState": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"description": "Document unique identifier",
						"example": "MYVJO6m730Cztgtd6HrkXEKA5phF8pjDRRGe6IyezdZvdzg-caOOKid5Mm5k7dyO9ivcbaKuWL1NIO8uwjEVXSoTY_RkCNzyQhaZBEWfCvI"
					},
					"state": {
						"type": "string",
						"description": "Document state",
						"example": "download"
					}
				}
			},
			"Result": {
				"type": "object",
				"properties": {
					"message": {
						"type": "string"
					},
					"result": {},
					"url": {
						"type": "string"
					},
					"documentId": {
						"type": "string"
					}
				}
			},
			"ErrorBody": {
				"type": "object",
				"properties": {
					"message": {
						"type": "string"
					},
					"value": {},
					"tenant": {
						"type": "string"
					}
				}
			},
			"UploadRequest": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"description": "Document unique identifier"
					},
					"state": {
						"type": "string",
						"description": "Document state"
					},
					"reuploadState": {
						"type": "string",
						"description": "Document state after reupload"
					},
					"date": {
						"type": "integer",
						"format": "int64",
						"description": "Document creation or modification date"
					},
					"modification": {
						"type": "string",
						"description": "Document modification information"
					},
					"group": {
						"type": "string",
						"description": "Document user/group"
					},
					"box": {
						"type": "string",
						"description": "Document storage box"
					},
					"name": {
						"type": "string",
						"description": "Dynamic metadata example : name"
					},
					"number": {
						"type": "string",
						"description": "Dynamic metadata exampe : number"
					},
					"sid": {
						"type": "string",
						"description": "Dynamic metadata example : sid"
					},
					"filedata": {
						"type": "string",
						"format": "binary",
						"description": "File to upload"
					}
				}
			},
			"DocumentResponse": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"description": "Document unique identifier"
					},
					"state": {
						"type": "string",
						"description": "Document state"
					},
					"reuploadState": {
						"type": "string",
						"description": "Document state after reupload"
					},
					"date": {
						"type": "integer",
						"format": "int64",
						"description": "Document creation or modification date"
					},
					"modification": {
						"type": "string",
						"description": "Document modification information"
					},
					"group": {
						"type": "string",
						"description": "Document user/group"
					},
					"box": {
						"type": "string",
						"description": "Document storage box"
					},
					"name": {
						"type": "string",
						"description": "Dynamic metadata example : name"
					},
					"number": {
						"type": "string",
						"description": "Dynamic metadata exampe : number"
					},
					"sid": {
						"type": "string",
						"description": "Dynamic metadata example : sid"
					},
					"url": {
						"type": "string",
						"description": "Document URL"
					}
				}
			},
			"ListResponse": {
				"type": "object",
				"properties": {
					"listResponse": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/DocumentResponse"
						}
					}
				}
			},
			"LoginResponse": {
				"type": "object",
				"properties": {
					"userInfo": {
						"$ref": "#/components/schemas/UserInfo"
					}
				}
			},
			"UserInfo": {
				"type": "object",
				"properties": {
					"roles": {
						"type": "array",
						"items": {
							"type": "string"
						}
					},
					"additional": {
						"type": "string"
					},
					"userName": {
						"type": "string"
					}
				}
			}
		},
		"securitySchemes": {
			"basicAuth": {
				"type": "http",
				"scheme": "basic"
			},
			"cookieAuth": {
				"type": "apiKey",
				"name": "JSESSIONID",
				"in": "cookie"
			}
		}
	}
}