{ "openapi": "3.1.0", "info": { "title": "yet-another-nginx-proxy-manager", "description": "", "license": { "name": "" }, "version": "0.1.0" }, "paths": { "/api/auth/init_admin": { "post": { "tags": [ "Authentication" ], "summary": "Initializes the admin user", "description": "Initializes the admin user if no admin user exists and the correct setup secret is provided.", "operationId": "init_admin", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AdminInitRequest" } } }, "required": true }, "responses": { "200": { "description": "Admin user initialized successfully" }, "400": { "description": "Invalid request payload" }, "401": { "description": "Unauthorized: Admin user already exists or invalid setup secret" }, "500": { "description": "Internal server error" } } } }, "/api/auth/login": { "post": { "tags": [ "Authentication" ], "summary": "Login endpoint", "description": "Authenticates a user and returns a JWT in an HttpOnly cookie.", "operationId": "login", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginRequest" } } }, "required": true }, "responses": { "200": { "description": "User authenticated successfully", "content": { "application/json": { "schema": { "default": null } } } }, "401": { "description": "Authentication failed" }, "500": { "description": "Internal server error" } } } }, "/api/health/info": { "get": { "tags": [ "Health" ], "summary": "Health check endpoint", "description": "Returns the health status, version, uptime, and any errors if unhealthy.", "operationId": "get_health_info", "responses": { "200": { "description": "Health information retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HealthInfo" } } } }, "404": { "description": "Health information not found" } } } }, "/api/nginx/locations/{location_id}": { "get": { "tags": [ "Nginx" ], "operationId": "get_location", "parameters": [ { "name": "location_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Get location info", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LocationInfoResponse" } } } }, "404": { "description": "Not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "Nginx" ], "operationId": "remove_location", "parameters": [ { "name": "location_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Location removed successfully", "content": { "application/json": { "schema": { "default": null } } } }, "401": { "description": "Unauthorized" }, "404": { "description": "Not found" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "Nginx" ], "operationId": "update_location", "parameters": [ { "name": "location_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateLocationRequestBody" } } }, "required": true }, "responses": { "200": { "description": "Location updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LocationInfoResponse" } } } }, "401": { "description": "Unauthorized" }, "404": { "description": "Not found" }, "422": { "description": "Invalid request" }, "500": { "description": "Internal server error" } } } }, "/api/nginx/proxy_hosts": { "get": { "tags": [ "Nginx" ], "operationId": "get_proxy_list", "responses": { "200": { "description": "List proxies", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProxyListResponse" } } } }, "500": { "description": "Internal server error" } } }, "post": { "tags": [ "Nginx" ], "operationId": "create_proxy", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateProxyRequestBody" } } }, "required": true }, "responses": { "200": { "description": "Proxy created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProxyHostInfoResponse" } } } }, "401": { "description": "Unauthorized" }, "422": { "description": "Invalid request" }, "500": { "description": "Internal server error" } } } }, "/api/nginx/proxy_hosts/{proxy_id}": { "get": { "tags": [ "Nginx" ], "operationId": "get_proxy", "parameters": [ { "name": "proxy_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Get proxy info", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProxyHostInfoResponse" } } } }, "404": { "description": "Not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "Nginx" ], "operationId": "remove_proxy", "parameters": [ { "name": "proxy_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Proxy removed successfully", "content": { "application/json": { "schema": { "default": null } } } }, "401": { "description": "Unauthorized" }, "404": { "description": "Not found" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "crate::routes::api::restricted::nginx::proxy_host::update_proxy" ], "operationId": "update_proxy", "parameters": [ { "name": "proxy_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateProxyRequestBody" } } }, "required": true }, "responses": { "200": { "description": "Proxy updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProxyHostInfoResponse" } } } }, "401": { "description": "Unauthorized" }, "422": { "description": "Invalid request" }, "500": { "description": "Internal server error" } } } }, "/api/nginx/proxy_hosts/{proxy_id}/locations": { "post": { "tags": [ "Nginx" ], "operationId": "create_location", "parameters": [ { "name": "proxy_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateLocationRequestBody" } } }, "required": true }, "responses": { "200": { "description": "Location created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LocationInfoResponse" } } } }, "401": { "description": "Unauthorized" }, "422": { "description": "Invalid request" }, "500": { "description": "Internal server error" } } } }, "/api/nginx/upstream_targets/{upstream_target_id}": { "get": { "tags": [ "Nginx" ], "operationId": "get_upstream_target", "parameters": [ { "name": "upstream_target_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Get upstream target info", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpstreamTargetInfo" } } } }, "404": { "description": "Not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "Nginx" ], "operationId": "remove_upstream_target", "parameters": [ { "name": "upstream_target_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Upstream target removed successfully", "content": { "application/json": { "schema": { "default": null } } } }, "401": { "description": "Unauthorized" }, "404": { "description": "Not found" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "Nginx" ], "operationId": "update_upstream_target", "parameters": [ { "name": "upstream_target_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateUpstreamTargetRequestBody" } } }, "required": true }, "responses": { "200": { "description": "Upstream target updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateUpstreamTargetInfoResponse" } } } }, "401": { "description": "Unauthorized" }, "404": { "description": "Not found" }, "422": { "description": "Invalid request" }, "500": { "description": "Internal server error" } } } }, "/api/nginx/upstreams": { "get": { "tags": [ "Nginx" ], "operationId": "get_upstream_list", "responses": { "200": { "description": "List upstreams", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpstreamListResponse" } } } }, "500": { "description": "Internal server error" } } }, "post": { "tags": [ "Nginx" ], "operationId": "create_upstream", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateUpstreamRequestBody" } } }, "required": true }, "responses": { "200": { "description": "Upstream created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpstreamInfoResponse" } } } }, "401": { "description": "Unauthorized" }, "422": { "description": "Invalid request" }, "500": { "description": "Internal server error" } } } }, "/api/nginx/upstreams/{upstream_id}": { "get": { "tags": [ "Nginx" ], "operationId": "get_upstream", "parameters": [ { "name": "upstream_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Get upstream info", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpstreamInfoResponse" } } } }, "404": { "description": "Not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "Nginx" ], "operationId": "remove_upstream", "parameters": [ { "name": "upstream_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Upstream removed successfully", "content": { "application/json": { "schema": { "default": null } } } }, "401": { "description": "Unauthorized" }, "404": { "description": "Not found" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "Nginx" ], "operationId": "update_upstream", "parameters": [ { "name": "upstream_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateUpstreamRequestBody" } } }, "required": true }, "responses": { "200": { "description": "Upstream updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateUpstreamInfoResponse" } } } }, "401": { "description": "Unauthorized" }, "404": { "description": "Not found" }, "422": { "description": "Invalid request" }, "500": { "description": "Internal server error" } } } }, "/api/nginx/upstreams/{upstream_id}/targets": { "post": { "tags": [ "Nginx" ], "operationId": "add_upstream_target", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateUpstreamTargetInfo" } } }, "required": true }, "responses": { "200": { "description": "Upstream target created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpstreamTargetInfoResponse" } } } }, "401": { "description": "Unauthorized" }, "422": { "description": "Invalid request" }, "500": { "description": "Internal server error" } } } }, "/api/user/me": { "get": { "tags": [ "User" ], "summary": "Get current user information", "description": "Returns the information of the currently authenticated user.", "operationId": "get_user_info", "responses": { "200": { "description": "User information retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserInfo" } } } }, "401": { "description": "Unauthorized" }, "500": { "description": "Internal server error" } } } } }, "components": { "schemas": { "AdminInitRequest": { "type": "object", "description": "Login request payload", "required": [ "username", "password", "setup_secret" ], "properties": { "password": { "type": "string" }, "setup_secret": { "type": "string" }, "username": { "type": "string" } } }, "CreateLocationReq": { "type": "object", "required": [ "path", "match_type", "order" ], "properties": { "match_type": { "type": "string" }, "order": { "type": "integer", "format": "int64" }, "path": { "type": "string" }, "upstream_id": { "type": [ "string", "null" ], "format": "uuid" } } }, "CreateLocationRequestBody": { "type": "object", "required": [ "path", "match_type", "order" ], "properties": { "match_type": { "type": "string" }, "order": { "type": "integer", "format": "int64" }, "path": { "type": "string" }, "upstream_id": { "type": [ "string", "null" ], "format": "uuid" } } }, "CreateProxyRequestBody": { "type": "object", "required": [ "domain", "scheme", "listen_port", "forward_scheme", "preserve_host_header", "enable_websocket", "enabled", "locations" ], "properties": { "default_upstream_id": { "type": [ "string", "null" ], "format": "uuid" }, "domain": { "type": "string" }, "enable_websocket": { "type": "boolean" }, "enabled": { "type": "boolean" }, "forward_host": { "type": [ "string", "null" ] }, "forward_port": { "type": [ "integer", "null" ], "format": "int64" }, "forward_scheme": { "type": "string" }, "listen_port": { "type": "integer", "format": "int64" }, "locations": { "type": "array", "items": { "$ref": "#/components/schemas/CreateLocationReq" } }, "meta": {}, "name": { "type": [ "string", "null" ] }, "preserve_host_header": { "type": "boolean" }, "scheme": { "type": "string" } } }, "CreateUpstreamRequestBody": { "type": "object", "required": [ "name", "protocol", "upstream_targets" ], "properties": { "algorithm": { "type": [ "string", "null" ] }, "name": { "type": "string" }, "protocol": { "type": "string" }, "sticky_session": { "type": [ "boolean", "null" ] }, "upstream_targets": { "type": "array", "items": { "$ref": "#/components/schemas/UpstreamTargetInfo" } } } }, "CreateUpstreamTargetInfo": { "type": "object", "required": [ "upstream_id", "host", "port" ], "properties": { "enabled": { "type": [ "boolean", "null" ] }, "host": { "type": "string" }, "is_backup": { "type": [ "boolean", "null" ] }, "port": { "type": "integer", "format": "int64" }, "upstream_id": { "type": "string", "format": "uuid" }, "weight": { "type": [ "integer", "null" ], "format": "int64" } } }, "GetUpstreamParams": { "type": "object", "properties": { "include_targets": { "type": [ "boolean", "null" ] } } }, "GetUpstreamTargetsParams": { "type": "object", "properties": { "include_upstream": { "type": [ "boolean", "null" ] } } }, "HealthInfo": { "type": "object", "description": "System health information", "required": [ "status", "version", "up_since", "is_initialized" ], "properties": { "errors": { "type": [ "array", "null" ], "items": { "type": "string" }, "description": "List of error messages if unhealthy" }, "is_initialized": { "type": "boolean", "description": "Is initialized" }, "status": { "type": "string", "description": "Health status: \"healthy\" or \"unhealthy\"" }, "up_since": { "type": "string", "format": "date-time", "description": "RFC 3339 formatted timestamp" }, "version": { "type": "string", "description": "Application version" } } }, "LocationInfoResponse": { "type": "object", "required": [ "id", "host_id", "path", "match_type", "order", "enabled", "created_at", "updated_at" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "enabled": { "type": "boolean" }, "host_id": { "type": "string", "format": "uuid" }, "id": { "type": "string", "format": "uuid" }, "match_type": { "type": "string" }, "order": { "type": "integer", "format": "int64" }, "path": { "type": "string" }, "updated_at": { "type": "string", "format": "date-time" }, "upstream_id": { "type": [ "string", "null" ], "format": "uuid" } } }, "LoginRequest": { "type": "object", "description": "Login request payload", "required": [ "username", "password" ], "properties": { "password": { "type": "string" }, "username": { "type": "string" } } }, "PaginationInfo": { "type": "object", "description": "Pagination information included in API responses", "required": [ "total_items", "total_pages", "current_page", "per_page" ], "properties": { "current_page": { "type": "integer", "format": "int32", "description": "Current page number", "minimum": 0 }, "per_page": { "type": "integer", "format": "int32", "description": "Items per page", "minimum": 0 }, "total_items": { "type": "integer", "format": "int64", "description": "Total number of items", "minimum": 0 }, "total_pages": { "type": "integer", "format": "int32", "description": "Total number of pages", "minimum": 0 } } }, "ProxyHostInfoResponse": { "type": "object", "required": [ "id", "domain", "scheme", "listen_port", "forward_scheme", "preserve_host_header", "enable_websocket", "enabled", "created_at", "updated_at", "locations" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "domain": { "type": "string" }, "enable_websocket": { "type": "boolean" }, "enabled": { "type": "boolean" }, "forward_host": { "type": [ "string", "null" ] }, "forward_port": { "type": [ "integer", "null" ], "format": "int64" }, "forward_scheme": { "type": "string" }, "id": { "type": "string", "format": "uuid" }, "listen_port": { "type": "integer", "format": "int64" }, "locations": { "type": "array", "items": { "$ref": "#/components/schemas/LocationInfoResponse" } }, "name": { "type": [ "string", "null" ] }, "preserve_host_header": { "type": "boolean" }, "scheme": { "type": "string" }, "updated_at": { "type": "string", "format": "date-time" }, "upstream": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/ProxyHostUpstreamBasic" } ] } } }, "ProxyHostUpstreamBasic": { "type": "object", "required": [ "id", "name", "protocol" ], "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "protocol": { "type": "string" } } }, "ProxyListResponse": { "type": "object", "required": [ "items", "pagination" ], "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/ProxyHostInfoResponse" } }, "pagination": { "$ref": "#/components/schemas/PaginationInfo" } } }, "UpdateLocationRequestBody": { "type": "object", "properties": { "match_type": { "type": [ "string", "null" ] }, "order": { "type": [ "integer", "null" ], "format": "int64" }, "path": { "type": [ "string", "null" ] }, "upstream_id": { "type": [ "string", "null" ], "format": "uuid" } } }, "UpdateProxyRequestBody": { "type": "object", "properties": { "domain": { "type": [ "string", "null" ] }, "name": { "type": [ "string", "null" ] } } }, "UpdateUpstreamInfoResponse": { "type": "object", "required": [ "id", "name", "protocol", "algorithm", "sticky_session", "created_at", "updated_at", "upstream_targets" ], "properties": { "algorithm": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "created_by": { "type": [ "string", "null" ], "format": "uuid" }, "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "protocol": { "type": "string" }, "sticky_session": { "type": "boolean" }, "updated_at": { "type": "string", "format": "date-time" }, "upstream_targets": { "type": "array", "items": { "$ref": "#/components/schemas/UpstreamTargetBasicInfo" } } } }, "UpdateUpstreamRequestBody": { "type": "object", "properties": { "algorithm": { "type": [ "string", "null" ] }, "name": { "type": [ "string", "null" ] }, "protocol": { "type": [ "string", "null" ] }, "sticky_session": { "type": [ "boolean", "null" ] }, "upstream_targets": { "type": [ "array", "null" ], "items": { "$ref": "#/components/schemas/UpstreamTargetBasicUpdateInfo" } } } }, "UpdateUpstreamTargetInfoResponse": { "type": "object", "required": [ "id", "host", "port", "enabled", "is_backup", "weight", "created_at", "updated_at", "upstream_id" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "enabled": { "type": "boolean" }, "host": { "type": "string" }, "id": { "type": "string", "format": "uuid" }, "is_backup": { "type": "boolean" }, "port": { "type": "integer", "format": "int64" }, "updated_at": { "type": "string", "format": "date-time" }, "upstream_id": { "type": "string", "format": "uuid" }, "weight": { "type": "integer", "format": "int32" } } }, "UpdateUpstreamTargetRequestBody": { "type": "object", "properties": { "enabled": { "type": [ "boolean", "null" ] }, "host": { "type": [ "string", "null" ] }, "is_backup": { "type": [ "boolean", "null" ] }, "port": { "type": [ "integer", "null" ], "format": "int64" }, "weight": { "type": [ "integer", "null" ], "format": "int32" } } }, "UpstreamBasicInfo": { "type": "object", "required": [ "id", "name", "protocol", "created_at", "updated_at" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "protocol": { "type": "string" }, "updated_at": { "type": "string", "format": "date-time" } } }, "UpstreamInfoResponse": { "type": "object", "required": [ "id", "name", "protocol", "algorithm", "sticky_session", "created_at", "updated_at", "upstream_targets" ], "properties": { "algorithm": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "created_by": { "type": [ "string", "null" ], "format": "uuid" }, "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "protocol": { "type": "string" }, "sticky_session": { "type": "boolean" }, "updated_at": { "type": "string", "format": "date-time" }, "upstream_targets": { "type": "array", "items": { "$ref": "#/components/schemas/UpstreamTargetBasicInfo" } } } }, "UpstreamListResponse": { "type": "object", "required": [ "items", "pagination" ], "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/UpstreamInfoResponse" } }, "pagination": { "$ref": "#/components/schemas/PaginationInfo" } } }, "UpstreamTargetBasicInfo": { "type": "object", "required": [ "id", "target_host", "target_port", "enabled", "is_backup", "weight", "created_at", "updated_at" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "enabled": { "type": "boolean" }, "id": { "type": "string", "format": "uuid" }, "is_backup": { "type": "boolean" }, "target_host": { "type": "string" }, "target_port": { "type": "integer", "format": "int64" }, "updated_at": { "type": "string", "format": "date-time" }, "weight": { "type": "integer", "format": "int32" } } }, "UpstreamTargetBasicUpdateInfo": { "type": "object", "required": [ "id", "enabled" ], "properties": { "enabled": { "type": "boolean" }, "id": { "type": "integer", "format": "int64" } } }, "UpstreamTargetInfo": { "type": "object", "required": [ "id", "target_host", "target_port", "enabled", "is_backup", "weight", "created_at", "updated_at", "upstream_id" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "enabled": { "type": "boolean" }, "id": { "type": "string", "format": "uuid" }, "is_backup": { "type": "boolean" }, "target_host": { "type": "string" }, "target_port": { "type": "integer", "format": "int64" }, "updated_at": { "type": "string", "format": "date-time" }, "upstream": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/UpstreamBasicInfo" } ] }, "upstream_id": { "type": "string", "format": "uuid" }, "weight": { "type": "integer", "format": "int32" } } }, "UpstreamTargetInfoResponse": { "type": "object", "required": [ "id", "host", "port", "enabled", "is_backup", "weight", "created_at", "updated_at", "upstream_id" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "enabled": { "type": "boolean" }, "host": { "type": "string" }, "id": { "type": "string", "format": "uuid" }, "is_backup": { "type": "boolean" }, "port": { "type": "integer", "format": "int64" }, "updated_at": { "type": "string", "format": "date-time" }, "upstream_id": { "type": "string", "format": "uuid" }, "weight": { "type": "integer", "format": "int32" } } }, "UserInfo": { "type": "object", "description": "System health information", "required": [ "id", "username" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "User ID" }, "username": { "type": "string", "description": "Username" } } } } }, "tags": [ { "name": "Health", "description": "Health information API" }, { "name": "Authentication", "description": "Authentication API" }, { "name": "User", "description": "User management API" }, { "name": "Nginx", "description": "Nginx management API" } ] }