{
  "openapi": "3.0.4",
  "info": {
    "title": "eAuth API",
    "description": "**Welcome to the eAuth API documentation.**\r\n\r\nYou can try out the API using **[Swagger](/eauth/demo/v10-0/docs/swagger)**.\r\n\r\nYou can find a detailed documentation by following **[this link](https://docs.egov4.ch/docs/9.0/category/eauth-api)**.",
    "contact": {
      "name": "Artionet",
      "url": "https://www.artionet.ch/",
      "email": "support@artionet.com"
    },
    "version": "v10.0",
    "x-logo": {
      "url": "/eauth/demo/v10-0/Documentation/Images/logo_artionet.png",
      "backgroundColor": "#fafafa",
      "altText": "Artionet Logo"
    }
  },
  "servers": [
    {
      "url": "/eauth/demo/v10-0"
    }
  ],
  "paths": {
    "/securitycode": {
      "post": {
        "tags": [
          "SecurityCode"
        ],
        "summary": "Creates a new security code",
        "operationId": "CreateSecurityCode",
        "requestBody": {
          "description": "A NewSecurityCode object for which the validation code is generated",
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/NewSecurityCode"
                  }
                ],
                "description": "New security code"
              }
            },
            "application/xml": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/NewSecurityCode"
                  }
                ],
                "description": "New security code"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The generated validation code",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid data",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/securitycode/{validationCode}": {
      "get": {
        "tags": [
          "SecurityCode"
        ],
        "summary": "Gets security code data for a validation code",
        "operationId": "Get",
        "parameters": [
          {
            "name": "validationCode",
            "in": "path",
            "description": "The validation",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A SecurityCode object describitng the security code data",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecurityCode"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/SecurityCode"
                }
              }
            }
          },
          "204": {
            "description": "The validation code is not found",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            }
          }
        }
      }
    },
    "/securitycode/{validationCode}/field/{position}/validation": {
      "post": {
        "tags": [
          "SecurityCode"
        ],
        "summary": "Perfom field validation for a validation code per position",
        "operationId": "PerformFieldValidationPerPostion",
        "parameters": [
          {
            "name": "validationCode",
            "in": "path",
            "description": "The validation code",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "position",
            "in": "path",
            "description": "The field position",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "value",
            "in": "query",
            "description": "The user input value to validate",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "True if the value is valid, otherwise false",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              },
              "application/xml": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      }
    },
    "/securitycode/{validationCode}/field/validation": {
      "post": {
        "tags": [
          "SecurityCode"
        ],
        "summary": "Perfom field validation for a validation code per label",
        "operationId": "PerformFieldValidationPerLabel",
        "parameters": [
          {
            "name": "validationCode",
            "in": "path",
            "description": "The validation code",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "label",
            "in": "query",
            "description": "The field label",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value",
            "in": "query",
            "description": "The user input value to validate",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "True if the value is valid, otherwise false",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              },
              "application/xml": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      }
    },
    "/securitycode/validation": {
      "post": {
        "tags": [
          "SecurityCode"
        ],
        "summary": "Perform validation for a validation code and each values of field",
        "operationId": "PerformValidation",
        "requestBody": {
          "description": "A ValidateValues object containing values to validate",
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ValidateValues"
                  }
                ],
                "description": "Security code values to validate for a validation code"
              }
            },
            "application/xml": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ValidateValues"
                  }
                ],
                "description": "Security code values to validate for a validation code"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A ValidateValuesResponse object containing a response per value",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateValuesResponse"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateValuesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/watermark/{validationCode}": {
      "put": {
        "tags": [
          "Watermark"
        ],
        "summary": "Add the watermark to a pdf",
        "operationId": "WatermarkDocument",
        "parameters": [
          {
            "name": "validationCode",
            "in": "path",
            "description": "The validation code",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ValidationCodeLabel",
            "in": "query",
            "description": "The QR code label",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Angle",
            "in": "query",
            "description": "(optional) The watermark angle. 55 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "TranslationX",
            "in": "query",
            "description": "(optional) The watermark translation on x. 50 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "TranslationY",
            "in": "query",
            "description": "(optional) The watermark translation on y. 50 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "ScaleX",
            "in": "query",
            "description": "(optional) The document x scale. 1 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "ScaleY",
            "in": "query",
            "description": "(optional) The document y scale. 1 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "QRCodeX",
            "in": "query",
            "description": "(optional) The QR code position on X. 0 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "QRCodeY",
            "in": "query",
            "description": "(optional) The QR code position on Y. 0 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "QRCodeSize",
            "in": "query",
            "description": "(optional) The QR code size. 60 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "ValidationCodeLabelX",
            "in": "query",
            "description": "(optional) The QR code labels position on X. QRCodeX + QRCodeSize by defaulf",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "ValidationCodeLabelY",
            "in": "query",
            "description": "(optional) The validation code label position on Y. 45 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "CodeLabelY",
            "in": "query",
            "description": "(optional) The code label position on Y. 25 by default",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "QRCodeData",
            "in": "query",
            "description": "(optional) The data to encrypt in the QR code. Validation code by default",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Encrypt",
            "in": "query",
            "description": "(optional) A value indicating whether to encrypt this eAuth.Api.Services.Models.WatermarkRequest. True by default",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "CodePageDisposition",
            "in": "query",
            "description": "(optional) Where the code appears. 0: all pages, 1: first page, 2: first and last pages. All pages per default.",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/CodePageDisposition"
                }
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "file"
                ],
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "The pdf to watermark",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "file": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The watermarked pdf",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            }
          },
          "400": {
            "description": "The file is not a pdf",
            "headers": {
              "X-Correlation-Id": {
                "description": "Unique identifier of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CodePageDisposition": {
        "enum": [
          0,
          1,
          2
        ],
        "type": "integer",
        "description": "define on witch page the code must appears",
        "format": "int32"
      },
      "NewSecurityCode": {
        "required": [
          "clientFullName",
          "issuer",
          "type"
        ],
        "type": "object",
        "properties": {
          "type": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "The type of document"
          },
          "issuer": {
            "maxLength": 255,
            "minLength": 0,
            "type": "string",
            "description": "The document issuer"
          },
          "clientFullName": {
            "maxLength": 100,
            "minLength": 0,
            "type": "string",
            "description": "The security code user name"
          },
          "securityCodeFields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewSecurityCodeField"
            },
            "description": "The list of security code field",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "New security code"
      },
      "NewSecurityCodeField": {
        "required": [
          "format",
          "label",
          "position",
          "type",
          "value"
        ],
        "type": "object",
        "properties": {
          "label": {
            "maxLength": 255,
            "minLength": 0,
            "type": "string",
            "description": "The field label"
          },
          "value": {
            "maxLength": 255,
            "minLength": 0,
            "type": "string",
            "description": "The value to check"
          },
          "format": {
            "maxLength": 50,
            "minLength": 0,
            "type": "string",
            "description": "The field format"
          },
          "type": {
            "type": "string",
            "description": "The type of security code field. Must be 'DAT' or 'NUM' or 'TXT' or 'INT' or 'UP_TXT'"
          },
          "position": {
            "type": "integer",
            "description": "The field position",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "New security code field"
      },
      "SecurityCode": {
        "required": [
          "clientFullName",
          "issuer",
          "type",
          "validationCode"
        ],
        "type": "object",
        "properties": {
          "validationCode": {
            "type": "string",
            "description": "The validation code"
          },
          "type": {
            "type": "string",
            "description": "The security code type"
          },
          "issuer": {
            "type": "string",
            "description": "The security code issuer"
          },
          "clientFullName": {
            "type": "string",
            "description": "The security code client full name"
          },
          "securityCodeFields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SecurityCodeField"
            },
            "description": "The list of security code field",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Security code data"
      },
      "SecurityCodeField": {
        "required": [
          "format",
          "label",
          "position",
          "type"
        ],
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "The field label"
          },
          "format": {
            "type": "string",
            "description": "The field format"
          },
          "type": {
            "type": "string",
            "description": "The type of security code field. Must be 'DAT' or 'NUM' or 'TXT' or 'INT' or 'UP_TXT'"
          },
          "position": {
            "type": "integer",
            "description": "The field position",
            "format": "int32"
          }
        },
        "additionalProperties": false,
        "description": "Security code field data"
      },
      "ValidateValue": {
        "required": [
          "value"
        ],
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "The field label. Required if position is null",
            "nullable": true
          },
          "position": {
            "type": "integer",
            "description": "The field position. Required if the label is null or empty",
            "format": "int32",
            "nullable": true
          },
          "value": {
            "minLength": 1,
            "type": "string",
            "description": "The user input value to validate"
          }
        },
        "additionalProperties": false,
        "description": "Security code value to validate"
      },
      "ValidateValueResponse": {
        "required": [
          "result",
          "value"
        ],
        "type": "object",
        "properties": {
          "result": {
            "type": "boolean",
            "description": "True if the field value is valid, otherwise false"
          },
          "label": {
            "type": "string",
            "description": "The field label. Required if position is null",
            "nullable": true
          },
          "position": {
            "type": "integer",
            "description": "The field position. Required if the label is null or empty",
            "format": "int32",
            "nullable": true
          },
          "value": {
            "type": "string",
            "description": "The validated user value"
          }
        },
        "additionalProperties": false,
        "description": "Validate value response"
      },
      "ValidateValues": {
        "required": [
          "validationCode",
          "values"
        ],
        "type": "object",
        "properties": {
          "validationCode": {
            "type": "string",
            "description": "The validation code"
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidateValue"
            },
            "description": "The list a values to validate"
          }
        },
        "additionalProperties": false,
        "description": "Security code values to validate for a validation code"
      },
      "ValidateValuesResponse": {
        "required": [
          "responses",
          "result"
        ],
        "type": "object",
        "properties": {
          "result": {
            "type": "boolean",
            "description": "True if all fields have been validated"
          },
          "responses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidateValueResponse"
            },
            "description": "The list of responses"
          }
        },
        "additionalProperties": false,
        "description": "Validate values response"
      },
      "ValidationProblemDetails": {
        "required": [
          "errors"
        ],
        "type": "object",
        "properties": {
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "type": {
            "type": "string",
            "description": "URI that identifies the problem detail type",
            "nullable": true
          },
          "title": {
            "type": "string",
            "description": "A short human-readable summary about the problem",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "description": "HTTP Status Code",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "description": "A human-readable explanation about the problem",
            "nullable": true
          },
          "correlationId": {
            "type": "string",
            "description": "Unique identifier of the request"
          }
        },
        "additionalProperties": { }
      }
    }
  },
  "tags": [
    {
      "name": "SecurityCode"
    },
    {
      "name": "Watermark"
    }
  ],
  "x-tagGroups": [
    {
      "name": "Endpoints",
      "tags": [
        "SecurityCode",
        "Watermark"
      ]
    }
  ]
}