{
  "openapi": "3.0.3",
  "info": {
    "title": "REST API documentation",
    "version": "v1",
    "description": ""
  },
  "servers": [],
  "paths": {
    "/vpnclient": {
      "post": {
        "description": "Creates a new VPN client.",
        "responses": {
          "201": {
            "description": "VPN client created successfully.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/api/v1/vpnclient/{vpnclientID}`",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VPNClientDataResponse"
                },
                "example": {
                  "data": {
                    "id": "a2FhX3Zwbi1jbGllbnQ=",
                    "name": "vpn-client",
                    "endpointId": "5a67aa97-1f5c-41eb-a066-8e004157062b",
                    "application": "bqa46oeg14m0thoh7g0l",
                    "description": "vpn client description",
                    "state": "active",
                    "type": "device",
                    "ipAddress": "10.0.1.10",
                    "subnet": "10.0.0.0/24",
                    "username": "admin",
                    "sshKey": true,
                    "protocol": "tcp",
                    "created": "2025-04-20T15:01:12.144Z"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVPNClientRequest"
              },
              "example": {
                "name": "vpn-client",
                "endpointId": "5a67aa97-1f5c-41eb-a066-8e004157062b",
                "description": "vpn client description",
                "type": "device",
                "username": "admin",
                "sshKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLj95+zZK1171Jz9T5234+00...",
                "protocol": "tcp"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves a page of VPN clients based on search criteria.",
        "responses": {
          "200": {
            "description": "Successful retrieval of VPN clients.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VPNClientsPageResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "a2FhX3Zwbi1jbGllbnQ=",
                      "name": "vpn-client",
                      "endpointId": "5a67aa97-1f5c-41eb-a066-8e004157062b",
                      "application": "bqa46oeg14m0thoh7g0l",
                      "description": "vpn client description",
                      "state": "active",
                      "type": "device",
                      "ipAddress": "10.0.1.10",
                      "subnet": "10.0.0.0/24",
                      "username": "admin",
                      "sshKey": true,
                      "protocol": "tcp",
                      "created": "2025-04-20T15:01:12.144Z"
                    }
                  ],
                  "count": 1,
                  "page": 1,
                  "pageSize": 100
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "description": "A list of VPN client IDs to filter by.",
            "required": false,
            "schema": {
              "type": "array"
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "The name of the VPN client.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endpointId",
            "in": "query",
            "description": "The endpoint ID associated with the VPN client.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "The state of the VPN client (active or revoked).",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "revoked"
              ]
            }
          },
          {
            "name": "ipAddress",
            "in": "query",
            "description": "The IP address assigned to the VPN client.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "The page number to retrieve.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The number of items per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "get": {
        "description": "Retrieves a specific VPN client by ID.",
        "responses": {
          "200": {
            "description": "Successful retrieval of the VPN client.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "id": "a2FhX3Zwbi1jbGllbnQ=",
                    "name": "vpn-client",
                    "endpointId": "5a67aa97-1f5c-41eb-a066-8e004157062b",
                    "application": "bqa46oeg14m0thoh7g0l",
                    "description": "vpn client description",
                    "state": "active",
                    "type": "device",
                    "ipAddress": "10.0.1.10",
                    "subnet": "10.0.0.0/24",
                    "username": "admin",
                    "sshKey": true,
                    "protocol": "tcp",
                    "created": "2025-04-20T15:01:12.144Z"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:read"
            ]
          }
        ]
      },
      "delete": {
        "description": "Deletes VPN client.",
        "responses": {
          "204": {
            "description": "VPN client is successfully deleted."
          }
        },
        "security": [
          {
            "iamcore": []
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}/config": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "get": {
        "description": "Get VPN client configuration file",
        "responses": {
          "200": {
            "description": "Successful retrieval of the VPN client configuration file.",
            "headers": {
              "Content-Disposition": {
                "description": "The filename of the configuration file.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:read"
            ]
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}/ssh-key": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "put": {
        "description": "Update SSH key for VPN client.",
        "responses": {
          "204": {
            "description": "SSH key is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VPNClientSSHKeyRequest"
              },
              "example": {
                "sshKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLj95+zZK1171Jz9T5234+00..."
              }
            }
          }
        }
      }
    },
    "/vpnclient/{vpnclientID}/username": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "put": {
        "description": "Update username for VPN client.",
        "responses": {
          "204": {
            "description": "Username is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VPNClientUsernameRequest"
              },
              "example": {
                "username": "admin"
              }
            }
          }
        }
      }
    },
    "/vpnclient/{vpnclientID}/description": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "put": {
        "description": "Update description for VPN client.",
        "responses": {
          "204": {
            "description": "Description is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VPNUpdateDescriptionRequest"
              },
              "example": {
                "description": "New description"
              }
            }
          }
        }
      }
    },
    "/vpnclient/{vpnclientID}/revoke": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "put": {
        "description": "Revoke VPN client.",
        "responses": {
          "204": {
            "description": "VPN client is successfully revoked."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}/assign": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "put": {
        "description": "Assign endpoint to the VPN client",
        "responses": {
          "204": {
            "description": "Endpoint is successfully assigned to the VPN client."
          }
        },
        "security": [
          {
            "iamcore": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VPNClientAssignEndpointRequest"
              },
              "example": {
                "endpointId": "52d44498-e240-43ba-959b-84152fe54b8d"
              }
            }
          }
        }
      }
    },
    "/vpnclient/{vpnclientID}/unassign": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "put": {
        "description": "Unassign endpoint from the VPN client",
        "responses": {
          "204": {
            "description": "Endpoint is successfully unassigned from the VPN client."
          }
        },
        "security": [
          {
            "iamcore": []
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}/proxyconfig": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "get": {
        "description": "",
        "responses": {
          "200": {
            "description": "Successful retrieval of proxy configurations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProxyConfigPageResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "d638b5a4-428d-4300-8725-6a90a739e040",
                      "vpnClientId": "a2FhX3Zwbi1jbGllbnQ=",
                      "proxyPort": "80",
                      "name": "proxy-config",
                      "domain": "example.com",
                      "description": "proxy config description",
                      "type": "HTTP",
                      "customHeaders": {
                        "X-Custom-Header": "custom-header-value"
                      }
                    }
                  ],
                  "count": 1,
                  "page": 1,
                  "pageSize": 100
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "description": "Filter by proxy type (HTTP or TCP).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "The page number to retrieve.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The number of items per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ]
      },
      "post": {
        "description": "Creates a new proxy configuration.",
        "responses": {
          "201": {
            "description": "Proxy configuration created successfully.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/api/v1/vpnclient/{vpnclientID}/proxyconfig/{proxyconfigID}`",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProxyConfigDataResponse"
                },
                "example": {
                  "data": {
                    "id": "d638b5a4-428d-4300-8725-6a90a739e040",
                    "vpnClientId": "a2FhX3Zwbi1jbGllbnQ=",
                    "proxyPort": "80",
                    "name": "proxy-config",
                    "domain": "example.com",
                    "description": "proxy config description",
                    "type": "HTTP",
                    "customHeaders": {
                      "X-Custom-Header": "custom-header-value"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "proxyPort": "80",
                "name": "proxy-config",
                "description": "proxy config description",
                "type": "HTTP",
                "customHeaders": {
                  "X-Api-Key": "test-api-key",
                  "Authorization": "Bearer token123"
                }
              }
            }
          }
        }
      }
    },
    "/vpnclient/{vpnclientID}/proxyconfig/{proxyconfigID}": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        },
        {
          "name": "proxyconfigID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Proxy configuration ID.",
          "example": "d638b5a4-428d-4300-8725-6a90a739e040"
        }
      ],
      "get": {
        "description": "Retrieves a specific proxy configuration by ID.",
        "responses": {
          "200": {
            "description": "Successful retrieval of the proxy configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "id": "d638b5a4-428d-4300-8725-6a90a739e040",
                    "vpnClientId": "a2FhX3Zwbi1jbGllbnQ=",
                    "proxyPort": "80",
                    "name": "proxy-config",
                    "domain": "example.com",
                    "description": "proxy config description",
                    "type": "HTTP",
                    "customHeaders": {
                      "X-Custom-Header": "custom-header-value"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a proxy configuration.",
        "responses": {
          "204": {
            "description": "Proxy configuration updated successfully."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertProxyConfigRequest"
              },
              "example": {
                "proxyPort": "80",
                "name": "proxy-config",
                "description": "proxy config description",
                "type": "HTTP",
                "customHeaders": {
                  "X-Api-Key": "test-api-key",
                  "Authorization": "Bearer token123"
                }
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes proxy config client.",
        "responses": {
          "204": {
            "description": "Proxy config is successfully deleted."
          }
        },
        "security": [
          {
            "iamcore": []
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}/vnc": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        }
      ],
      "post": {
        "description": "Creates a new proxy configuration.",
        "responses": {
          "201": {
            "description": "VNC remote access created successfully.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/api/v1/vpnclient/{vpnclientID}/vnc/{proxyconfigID}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertVNCRequest"
              },
              "example": {
                "deviceIp": "192.168.1.1",
                "devicePort": 5900
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves a page of the VNC remotes.",
        "responses": {
          "200": {
            "description": "Successful retrieval of the VNC remotes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VNCsPageResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "d638b5a4-428d-4300-8725-6a90a739e040",
                      "state": "RUNNING",
                      "stage": "VNC_PROXY_CREATED",
                      "deviceIp": "192.168.1.1",
                      "devicePort": 5900,
                      "proxyUrl": "example.com",
                      "created": "2023-03-29T12:34:56Z"
                    }
                  ],
                  "count": 1,
                  "page": 1,
                  "pageSize": 100
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "The page number to retrieve.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The number of items per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}/vnc/{vncID}": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        },
        {
          "name": "vncID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VNC remote ID.",
          "example": "d638b5a4-428d-4300-8725-6a90a739e040"
        }
      ],
      "get": {
        "description": "Retrieves a page of the VNC remotes.",
        "responses": {
          "200": {
            "description": "Successful retrieval of the VNC remote by ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VNCDataResponse"
                },
                "example": {
                  "data": {
                    "id": "d638b5a4-428d-4300-8725-6a90a739e040",
                    "state": "RUNNING",
                    "stage": "VNC_PROXY_CREATED",
                    "deviceIp": "192.168.1.1",
                    "devicePort": 5900,
                    "proxyUrl": "example.com",
                    "created": "2023-03-29T12:34:56Z"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a VNC remote and restarts the remote connection with the new device IP and Port.",
        "responses": {
          "204": {
            "description": "VNC remote updated successfully."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "deviceIp": "192.168.1.1",
                "devicePort": 5900
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes VNC remote.",
        "responses": {
          "204": {
            "description": "VNC remote is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}/vnc/{vncID}/restart": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        },
        {
          "name": "vncID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VNC remote ID.",
          "example": "d638b5a4-428d-4300-8725-6a90a739e040"
        }
      ],
      "get": {
        "description": "Restarts the VNC remote.",
        "responses": {
          "204": {
            "description": "VNC remote restarted successfully."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:update"
            ]
          }
        ]
      }
    },
    "/vpnclient/{vpnclientID}/vnc/{vncID}/traces": {
      "parameters": [
        {
          "name": "vpnclientID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VPN client ID.",
          "example": "a2FhX3Zwbi1jbGllbnQ="
        },
        {
          "name": "vncID",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "VNC remote ID.",
          "example": "d638b5a4-428d-4300-8725-6a90a739e040"
        }
      ],
      "get": {
        "description": "Retrieves a page of the VNC remote traces.",
        "responses": {
          "200": {
            "description": "Successful retrieval of the VNC remote traces.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TracesPageResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "5a67aa97-1f5c-41eb-a066-8e004157062b",
                      "type": "success",
                      "entityId": "a2FhX3Zwbi1jbGllbnQ=",
                      "entityType": "VNC Tunnel",
                      "message": "VNC Tunnel created",
                      "created": "2025-04-20T15:01:12.144Z"
                    }
                  ],
                  "count": 1,
                  "page": 1,
                  "pageSize": 100
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "The page number to retrieve.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The number of items per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ]
      }
    },
    "/mikrotik/{serialNumber}/register": {
      "parameters": [
        {
          "name": "serialNumber",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "mikrotik serial number.",
          "example": "N9TT-9G0A-B7FQ-RANC"
        }
      ],
      "post": {
        "description": "Registers a Mikrotik device.",
        "responses": {
          "204": {
            "description": "Mikrotik device registered successfully."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "vpnclient:create",
              "endpoint:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterRequest"
              },
              "example": {
                "applicationVersion": "bqa46oeg14m0thoh7g0l-v1"
              }
            }
          }
        }
      }
    },
    "/mikrotik/{serialNumber}/config": {
      "parameters": [
        {
          "name": "serialNumber",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "mikrotik serial number.",
          "example": "N9TT-9G0A-B7FQ-RANC"
        }
      ],
      "get": {
        "description": "Retrieves the configuration of a Mikrotik device.",
        "responses": {
          "200": {
            "description": "Successful retrieval of the configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse"
                },
                "example": {
                  "data": {
                    "serialNumber": "N9TT-9G0A-B7FQ-RANC",
                    "endpointId": "5a67aa97-1f5c-41eb-a066-8e004157062b",
                    "endpointToken": "02226466-e744-48ac-8f0c-a57fe4e77de4",
                    "application": "bqa46oeg14m0thoh7g0l",
                    "applicationVersion": "bqa46oeg14m0thoh7g0l-v1",
                    "configFile": "dnBuLWNvbmZpZy1maWxl",
                    "configName": "my-config.ovpn",
                    "publicKey": "my-pubKey"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth_2_0": {
        "type": "oauth2",
        "description": "VPMS supports OAuth 2.0 for authenticating all API requests.\n",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://auth.example.com/oauth/authorize",
            "scopes": {}
          }
        }
      }
    },
    "schemas": {
      "CreateVPNClientRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the VPN client.\nMust contain only latin letters, digits, hyphens and underscores (no spaces).\nMaximum length is 64 characters.\n",
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "endpointId": {
            "type": "string",
            "description": "The endpoint ID associated with the VPN client."
          },
          "description": {
            "type": "string",
            "description": "A description of the VPN client."
          },
          "type": {
            "type": "string",
            "description": "The type of the VPN client.",
            "enum": [
              "admin",
              "device"
            ]
          },
          "username": {
            "type": "string",
            "description": "The gateway username for the VPN client."
          },
          "sshKey": {
            "type": "string",
            "description": "SSH key for the VPN client."
          },
          "protocol": {
            "type": "string",
            "description": "The protocol used by the VPN client.",
            "enum": [
              "tcp",
              "udp"
            ]
          }
        }
      },
      "VPNClientResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier of the VPN client."
          },
          "name": {
            "type": "string",
            "description": "The name of the VPN client."
          },
          "endpointId": {
            "type": "string",
            "description": "The endpoint ID associated with the VPN client."
          },
          "application": {
            "type": "string",
            "description": "Application name that endpoint belongs to."
          },
          "description": {
            "type": "string",
            "description": "A description of the VPN client."
          },
          "state": {
            "type": "string",
            "description": "The state of the VPN client (active or revoked).",
            "enum": [
              "active",
              "revoked"
            ]
          },
          "type": {
            "type": "string",
            "description": "The type of the VPN client."
          },
          "subnet": {
            "type": "string",
            "description": "The subnet associated with the VPN client."
          },
          "username": {
            "type": "string",
            "description": "The gateway username for the VPN client."
          },
          "sshKey": {
            "type": "boolean",
            "description": "Whether SSH key is set for the VPN client."
          },
          "protocol": {
            "type": "string",
            "description": "The protocol used by the VPN client.",
            "enum": [
              "tcp",
              "udp"
            ]
          },
          "created": {
            "type": "string",
            "description": "The timestamp when the VPN client was created."
          }
        }
      },
      "VPNClientDataResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/VPNClientResponse"
          }
        }
      },
      "VPNClientsPageResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array"
          },
          "count": {
            "type": "integer",
            "description": "The total number of VPN clients."
          },
          "page": {
            "type": "integer",
            "description": "The current page number."
          },
          "pageSize": {
            "type": "integer",
            "description": "The number of VPN clients per page."
          }
        }
      },
      "VPNClientSSHKeyRequest": {
        "type": "object",
        "properties": {
          "sshKey": {
            "type": "string",
            "description": "The gateway SSH key for the VPN client."
          }
        }
      },
      "VPNClientUsernameRequest": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string",
            "description": "The gateway username for the VPN client."
          }
        }
      },
      "VPNUpdateDescriptionRequest": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "A description of the VPN client."
          }
        }
      },
      "VPNClientAssignEndpointRequest": {
        "type": "object",
        "properties": {
          "endpointId": {
            "type": "string",
            "description": "Endpoint unique identifier."
          }
        }
      },
      "ProxyConfigPageResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array"
          },
          "count": {
            "type": "integer",
            "description": "The total number of VPN clients."
          },
          "page": {
            "type": "integer",
            "description": "The current page number."
          },
          "pageSize": {
            "type": "integer",
            "description": "The number of VPN clients per page."
          }
        }
      },
      "ProxyConfigResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The ID of the proxy configuration."
          },
          "vpnClientId": {
            "type": "string",
            "description": "The ID of the VPN client associated with the proxy configuration."
          },
          "proxyPort": {
            "type": "integer",
            "description": "The port number of the proxy server."
          },
          "name": {
            "type": "string",
            "description": "The name of the proxy configuration."
          },
          "domain": {
            "type": "string",
            "description": "The domain name of the proxy server."
          },
          "description": {
            "type": "string",
            "description": "A description of the proxy configuration."
          },
          "type": {
            "type": "string",
            "description": "The type of proxy configuration.",
            "enum": [
              "HTTP",
              "TCP"
            ]
          }
        }
      },
      "ProxyConfigDataResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/ProxyConfigResponse"
          }
        }
      },
      "UpsertProxyConfigRequest": {
        "type": "object",
        "properties": {
          "proxyPort": {
            "type": "integer",
            "description": "The port number of the proxy server."
          },
          "name": {
            "type": "string",
            "description": "The name of the proxy configuration."
          },
          "description": {
            "type": "string",
            "description": "A description of the proxy configuration."
          },
          "type": {
            "type": "string",
            "description": "The type of proxy configuration.",
            "enum": [
              "HTTP",
              "HTTPS"
            ]
          },
          "customHeaders": {
            "type": "object",
            "description": "A map of custom headers to be sent to the proxy server."
          }
        }
      },
      "UpsertVNCRequest": {
        "type": "object",
        "properties": {
          "deviceIp": {
            "type": "string",
            "description": "The IP address of the VNC device."
          },
          "devicePort": {
            "type": "integer",
            "description": "The port number of the VNC device."
          }
        }
      },
      "VNCsPageResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array"
          },
          "count": {
            "type": "integer",
            "description": "The total number of VPN clients."
          },
          "page": {
            "type": "integer",
            "description": "The current page number."
          },
          "pageSize": {
            "type": "integer",
            "description": "The number of VPN clients per page."
          }
        }
      },
      "VNCResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier of the VNC."
          },
          "stage": {
            "type": "string",
            "description": "The stage of the VNC.\n- UNDEFINED: The VNC is not yet initialized.\n- INITIALIZED: The VNC is being created.\n- SSH_TUNNEL_CREATED: The SSH tunnel is being created.\n- VNC_SERVER_CREATED: The VNC server is being created.\n- VNC_PROXY_CREATED: The VNC proxy is being created.\n",
            "enum": [
              "UNDEFINED",
              "INITIALIZED",
              "SSH_TUNNEL_CREATED",
              "VNC_SERVER_CREATED",
              "VNC_PROXY_CREATED"
            ]
          },
          "state": {
            "type": "string",
            "description": "The state of the VNC.\n- UNDEFINED: The VNC is not yet created.\n- PENDING: The VNC is being created.\n- ERROR: The VNC has failed to start and can be recovered.\n- FATAL_ERROR: The VNC has failed to start and cannot be recovered automatically.\n- RUNNING: The VNC is running.\n- RECOVERING: The VNC is recovering.\n",
            "enum": [
              "UNDEFINED",
              "PENDING",
              "ERROR",
              "FATAL_ERROR",
              "RUNNING",
              "RECOVERING"
            ]
          },
          "deviceIp": {
            "type": "string",
            "description": "The IP address of the VNC device."
          },
          "devicePort": {
            "type": "integer",
            "description": "The port number of the VNC device."
          },
          "proxyUrl": {
            "type": "string",
            "description": "The URL of the VNC proxy. This field is only present if the VNC is in the RUNNING state."
          },
          "created": {
            "type": "string",
            "description": "The timestamp when the VNC was created."
          }
        }
      },
      "VNCDataResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/VNCResponse"
          }
        }
      },
      "TracesPageResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array"
          },
          "count": {
            "type": "integer",
            "description": "The total number of VPN clients."
          },
          "page": {
            "type": "integer",
            "description": "The current page number."
          },
          "pageSize": {
            "type": "integer",
            "description": "The number of VPN clients per page."
          }
        }
      },
      "RegisterRequest": {
        "type": "object",
        "properties": {
          "applicationVersion": {
            "type": "string",
            "description": "The name of the application version."
          }
        }
      },
      "Response": {
        "type": "object",
        "properties": {
          "endpointId": {
            "type": "string",
            "description": "The endpoint ID associated with the device."
          },
          "endpointToken": {
            "type": "string",
            "description": "The endpoint token associated with the device."
          },
          "application": {
            "type": "string",
            "description": "The application associated with the device."
          },
          "applicationVersion": {
            "type": "string",
            "description": "The version of the application associated with the device."
          },
          "configFile": {
            "type": "string",
            "description": "The VPN configuration file name."
          },
          "pubKey": {
            "type": "string",
            "description": "Remote access public key."
          }
        }
      },
      "DataResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Response"
          }
        }
      },
      "ClientErrorResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Detailed error description."
          }
        },
        "required": [
          "message"
        ]
      },
      "TraceResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier of the trace."
          },
          "type": {
            "type": "string",
            "description": "The type of the trace.",
            "enum": [
              "success",
              "error"
            ]
          },
          "entityId": {
            "type": "string",
            "description": "The unique identifier of the entity associated with the trace."
          },
          "entityType": {
            "type": "string",
            "description": "The type of the entity associated with the trace."
          },
          "message": {
            "type": "string",
            "description": "The message associated with the trace."
          },
          "created": {
            "type": "string",
            "description": "The timestamp when the trace was created."
          }
        }
      },
      "TraceDataResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "description": "The trace data."
          }
        }
      }
    }
  }
}