{"openapi":"3.1.0","info":{"title":"NueroVPN API","description":"Backend for the NueroVPN peer-routed VPN system.","version":"1.0.0"},"paths":{"/api/v1/health":{"get":{"tags":["Health"],"summary":"Health Check","description":"Return service liveness status.","operationId":"health_check_api_v1_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Health Check Api V1 Health Get"}}}}}}},"/api/v1/health/db":{"get":{"tags":["Health"],"summary":"Database Health Check","description":"Return database connectivity status.","operationId":"database_health_check_api_v1_health_db_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Database Health Check Api V1 Health Db Get"}}}}}}},"/api/v1/nodes/register":{"post":{"tags":["Nodes"],"summary":"Register or re-register a NeuroNode","description":"Register a new NeuroNode and issue a Headscale preauth key.\n\nThe Flutter app uses the returned auth key and server URL to run:\n    tailscale up --login-server=<url> --authkey=<key> --hostname=<machine_id>\n\nOnce tailscale is up, the node's 100.64.x.x is sent back via the next\nheartbeat (tailscale_ip field). Until that arrives the node is registered\nbut not selectable as an exit.","operationId":"register_node_api_v1_nodes_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NodeCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NodeRegisterResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/nodes/heartbeat":{"post":{"tags":["Nodes"],"summary":"Send a heartbeat ping from a NeuroNode","description":"Record a liveness heartbeat.\n\nRequired fields on the body:\n  - node_id\n  - tailscale_ip  (once tailscale is up; may be absent on the first\n                   heartbeat right after registration)\n  - proxy_port    (once the local proxy is listening)","operationId":"node_heartbeat_api_v1_nodes_heartbeat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NodeHeartbeatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/nodes/deregister":{"post":{"tags":["Nodes"],"summary":"Gracefully deregister a NeuroNode","description":"Mark node offline, close its sessions, remove it from the Headscale mesh.","operationId":"deregister_node_api_v1_nodes_deregister_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NodeDeregisterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/nodes/":{"get":{"tags":["Nodes"],"summary":"List NeuroNodes","description":"Return a paginated list of nodes.\n\nWhen active_only=true only returns online nodes that have a tailscale_ip\n— i.e. nodes actually reachable through the mesh.","operationId":"list_nodes_api_v1_nodes__get","parameters":[{"name":"active_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Active Only"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_NodeResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/nodes/select-exit":{"post":{"tags":["Nodes"],"summary":"Select an available exit node for a client","description":"Select an online NeuroNode that is on the Headscale mesh.\n\nA node is eligible only if status='online' AND tailscale_ip is set AND\nproxy_port is set. Anything else is unreachable from NeuroGrid.","operationId":"select_exit_node_api_v1_nodes_select_exit_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NodeSelectExitRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectExitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/nodes/{node_id}":{"get":{"tags":["Nodes"],"summary":"Get a single NeuroNode by ID","operationId":"get_node_api_v1_nodes__node_id__get","parameters":[{"name":"node_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Node Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Nodes"],"summary":"Permanently delete a NeuroNode","description":"Hard-delete a NeuroNode record and clean up all associated resources.\n\nRemoves the Headscale mesh entry and all active client sessions before\ndeleting the node row. Cleanup steps are best-effort and will not block\ndeletion if they fail. Logs a ``node_deleted`` audit event.\n\nUse ``POST /deregister`` for a graceful offline transition that preserves\nhistory. Use this endpoint to fully remove a node.\n\nReturns HTTP 404 if the node does not exist.","operationId":"delete_node_api_v1_nodes__node_id__delete","parameters":[{"name":"node_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Node Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/nodes/{node_id}/spn-credentials":{"get":{"tags":["Nodes"],"summary":"Deprecated: SPN now uses NeuroGrid credentials","description":"Return a hard deprecation response for legacy SPN credential requests.","operationId":"get_spn_credentials_api_v1_nodes__node_id__spn_credentials_get","parameters":[{"name":"node_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Node Id"}}],"responses":{"410":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/proxy-users/":{"post":{"tags":["Proxy Users"],"summary":"Create a new set of NeuroGrid proxy credentials","description":"Create a new NeuroGrid proxy user with a bcrypt-hashed password.\n\nReturns HTTP 409 if the username is already taken.\nThe plain-text password is never stored or returned after this call.","operationId":"create_proxy_user_api_v1_proxy_users__post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyUserCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyUserResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Proxy Users"],"summary":"List all NeuroGrid proxy users","description":"Return a paginated list of all proxy users, newest first.","operationId":"list_proxy_users_api_v1_proxy_users__get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_ProxyUserResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/proxy-users/{user_id}":{"get":{"tags":["Proxy Users"],"summary":"Get a single proxy user by ID","description":"Fetch a single proxy user record.\n\nReturns HTTP 404 if no user with the given UUID exists.","operationId":"get_proxy_user_api_v1_proxy_users__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyUserResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Proxy Users"],"summary":"Update a proxy user's active status or notes","description":"Update ``is_active`` and/or ``notes`` on an existing proxy user.\n\nOnly fields present in the request body are written; omitted fields\nare left unchanged. Returns HTTP 404 if the user does not exist.","operationId":"update_proxy_user_api_v1_proxy_users__user_id__patch","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyUserUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyUserResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Proxy Users"],"summary":"Delete a proxy user","description":"Hard-delete a proxy user record.\n\nReturns HTTP 404 if the user does not exist.","operationId":"delete_proxy_user_api_v1_proxy_users__user_id__delete","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/proxy-users/verify":{"post":{"tags":["Proxy Users"],"summary":"Verify proxy credentials (called by the proxy service)","description":"Check a username/password pair against stored bcrypt hashes.\n\nCalled internally by the NeuroGrid proxy service before allowing a\nclient connection. Returns HTTP 401 if credentials are invalid or the\naccount is inactive.","operationId":"verify_proxy_credentials_api_v1_proxy_users_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyVerifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyUserResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/proxy-users/spn-provision":{"post":{"tags":["Proxy Users"],"summary":"Auto-provision NeuroGrid relay credentials for a NeuroSPN browser install","description":"Auto-provision a NeuroGrid proxy user for a NeuroSPN browser installation.\n\nCalled by the extension on first connect when no credentials are cached.\nThe ``device_id`` (a UUID generated once per install) is used to derive a\nstable username of the form ``spn_<first-12-chars>``, so repeated calls\nfrom the same device never create duplicate rows — the password is simply\nrotated and the new plain-text value is returned.\n\nThe plain-text password is returned exactly once and never stored. The\ncaller must persist it in ``chrome.storage.local`` immediately.","operationId":"provision_spn_credentials_api_v1_proxy_users_spn_provision_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpnProvisionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpnProvisionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/stats":{"get":{"tags":["Sessions"],"summary":"Active client connection stats","description":"Return a live count and full list of all currently active client sessions.\n\nBreaks down active connections by client type:\n- ``spn_clients``: NeuroSPN browser extension connections\n- ``grid_clients``: NeuroGrid proxy connections\n- ``total_active``: combined total\n- ``sessions``: full list of active session records ordered newest-first","operationId":"get_session_stats_api_v1_sessions_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStatsResponse"}}}}}}},"/api/v1/sessions/{session_id}/end":{"post":{"tags":["Sessions"],"summary":"End an active client session","description":"Mark an active session as ended.\n\nCalled by the SPN extension on disconnect or when the connection attempt\nfails after a session was already opened. Returns HTTP 404 if the session\ndoes not exist.","operationId":"end_session_api_v1_sessions__session_id__end_post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/status":{"get":{"tags":["Status"],"summary":"Live system status snapshot","description":"Return a live snapshot of NueroVPN API health and key counters.\n\nQueries the database for active node and session counts. If any DB\nquery fails the ``database`` field is set to ``\"error\"`` and counts\ndefault to -1, but the endpoint still returns HTTP 200 so uptime\nmonitors can distinguish a degraded-but-running API from a crash.","operationId":"system_status_api_v1_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response System Status Api V1 Status Get"}}}}}}},"/api/v1/audit-logs":{"get":{"tags":["Status"],"summary":"List audit log events with optional filters","description":"Return a paginated list of audit events with combined optional filters.\n\nAll filter query parameters are optional. Omitting a parameter means\nno filter is applied for that dimension.\n\nQuery parameters (from AuditLogFilter):\n- ``node_id``    — limit to events for a specific node\n- ``event_type`` — limit to a specific event type key\n- ``from_date``  — include only events on or after this UTC timestamp\n- ``to_date``    — include only events on or before this UTC timestamp","operationId":"list_audit_logs_api_v1_audit_logs_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Size"}},{"name":"node_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Node Id"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Event Type"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_AuditLogResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"tags":["root"],"summary":"Root","description":"Service liveness and discovery endpoint.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Root  Get"}}}}}}}},"components":{"schemas":{"AuditLogResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"Audit log entry primary key."},"node_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Node Id","description":"Node involved in this event, if any."},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id","description":"Session involved in this event, if any."},"event_type":{"type":"string","title":"Event Type","description":"Event classification key. One of: node_registered, node_online, node_offline, client_connected, client_disconnected, heartbeat_missed, proxy_auth_failed."},"client_ip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Ip","description":"Client IP at the time of the event."},"client_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Type","description":"'spn' or 'grid', when applicable."},"event_metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Event Metadata","description":"Free-form JSON payload with additional event context."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When this event was recorded."}},"type":"object","required":["id","node_id","session_id","event_type","client_ip","client_type","event_metadata","created_at"],"title":"AuditLogResponse","description":"Full audit log event representation returned by the API.\n\nNote: the ORM model stores the JSON payload as `event_metadata`\n(Python attribute) to avoid shadowing Base.metadata. This schema\nsurfaces the same name."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"NodeCreate":{"properties":{"machine_id":{"type":"string","maxLength":255,"title":"Machine Id","description":"Unique identifier derived from the host machine."},"public_key":{"type":"string","maxLength":512,"title":"Public Key","description":"Reserved for future use. Any non-empty string is accepted for MVP."},"ip_address":{"anyOf":[{"type":"string","maxLength":45},{"type":"null"}],"title":"Ip Address","description":"Requested VPN IP address (usually omitted)."},"version":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Version","description":"NeuroNode application version."}},"type":"object","required":["machine_id","public_key"],"title":"NodeCreate","description":"Fields required to register a new NeuroNode."},"NodeDeregisterRequest":{"properties":{"node_id":{"type":"string","format":"uuid","title":"Node Id"}},"type":"object","required":["node_id"],"title":"NodeDeregisterRequest"},"NodeHeartbeatRequest":{"properties":{"node_id":{"type":"string","format":"uuid","title":"Node Id"},"ip_address":{"anyOf":[{"type":"string","maxLength":45},{"type":"null"}],"title":"Ip Address"},"tailscale_ip":{"anyOf":[{"type":"string","maxLength":45},{"type":"null"}],"title":"Tailscale Ip"},"headscale_machine_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Headscale Machine Name"},"proxy_port":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Proxy Port","description":"Port where this node's in-process proxy is listening."}},"type":"object","required":["node_id"],"title":"NodeHeartbeatRequest","description":"Body for POST /nodes/heartbeat."},"NodeRegisterResponse":{"properties":{"node":{"$ref":"#/components/schemas/NodeResponse"},"headscale_auth_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Headscale Auth Key","description":"Headscale preauth key — pass to `tailscale up --authkey=<key>`."},"headscale_server_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Headscale Server Url","description":"Headscale coordination URL — pass to `tailscale up --login-server=<url>`."}},"type":"object","required":["node"],"title":"NodeRegisterResponse","description":"Response from POST /nodes/register."},"NodeResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"machine_id":{"type":"string","title":"Machine Id"},"public_key":{"type":"string","title":"Public Key"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address","description":"Last observed public IP."},"tailscale_ip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tailscale Ip","description":"Headscale-assigned 100.64.x.x. Null until node joins the mesh."},"proxy_port":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Proxy Port","description":"Proxy port the node is listening on. Null until the proxy is running."},"status":{"type":"string","title":"Status"},"last_seen":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Seen"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","machine_id","public_key","ip_address","tailscale_ip","status","last_seen","version","created_at","updated_at"],"title":"NodeResponse","description":"Full node representation returned by the API."},"NodeSelectExitRequest":{"properties":{"client_type":{"type":"string","maxLength":20,"title":"Client Type"},"client_ip":{"anyOf":[{"type":"string","maxLength":45},{"type":"null"}],"title":"Client Ip"},"node_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Node Id"},"device_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Device Id","description":"UUID generated once per extension install — used to derive the proxy username for session pinning."}},"type":"object","required":["client_type"],"title":"NodeSelectExitRequest"},"PaginatedResponse_AuditLogResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AuditLogResponse"},"type":"array","title":"Items","description":"The page of results."},"total":{"type":"integer","title":"Total","description":"Total number of records matching the query."},"page":{"type":"integer","title":"Page","description":"Current page number (1-based)."},"size":{"type":"integer","title":"Size","description":"Maximum number of items per page."}},"type":"object","required":["items","total","page","size"],"title":"PaginatedResponse[AuditLogResponse]"},"PaginatedResponse_NodeResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/NodeResponse"},"type":"array","title":"Items","description":"The page of results."},"total":{"type":"integer","title":"Total","description":"Total number of records matching the query."},"page":{"type":"integer","title":"Page","description":"Current page number (1-based)."},"size":{"type":"integer","title":"Size","description":"Maximum number of items per page."}},"type":"object","required":["items","total","page","size"],"title":"PaginatedResponse[NodeResponse]"},"PaginatedResponse_ProxyUserResponse_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ProxyUserResponse"},"type":"array","title":"Items","description":"The page of results."},"total":{"type":"integer","title":"Total","description":"Total number of records matching the query."},"page":{"type":"integer","title":"Page","description":"Current page number (1-based)."},"size":{"type":"integer","title":"Size","description":"Maximum number of items per page."}},"type":"object","required":["items","total","page","size"],"title":"PaginatedResponse[ProxyUserResponse]"},"ProxyUserCreate":{"properties":{"username":{"type":"string","maxLength":100,"title":"Username","description":"Unique proxy username used for HTTP/SOCKS authentication."},"password":{"type":"string","title":"Password","description":"Plain-text password — will be bcrypt-hashed before storage."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Optional admin notes about this credential set."}},"type":"object","required":["username","password"],"title":"ProxyUserCreate","description":"Fields required to create a new set of NeuroGrid proxy credentials."},"ProxyUserResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"Proxy user primary key."},"username":{"type":"string","title":"Username","description":"Proxy username."},"is_active":{"type":"boolean","title":"Is Active","description":"Whether this user can currently authenticate."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Admin notes."},"active_node_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Active Node Id","description":"The node currently assigned to this user, if any."},"active_node_ip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Active Node Ip","description":"Tailscale IP of the assigned node (e.g. 100.64.x.x)."},"active_node_port":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Active Node Port","description":"UPnP/Proxy port of the assigned node."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When these credentials were created."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"When this record was last modified."}},"type":"object","required":["id","username","is_active","notes","created_at","updated_at"],"title":"ProxyUserResponse","description":"Safe proxy user representation — never includes the hashed password."},"ProxyUserUpdate":{"properties":{"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active","description":"Set False to disable authentication for this user without deleting."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Updated admin notes."}},"type":"object","title":"ProxyUserUpdate","description":"Fields that can be updated on an existing proxy user. All are optional."},"ProxyVerifyRequest":{"properties":{"username":{"type":"string","title":"Username","description":"Proxy username to verify."},"password":{"type":"string","title":"Password","description":"Plain-text password to check against the stored hash."}},"type":"object","required":["username","password"],"title":"ProxyVerifyRequest","description":"Body for POST /proxy-users/verify.\n\nCalled by the proxy service to check whether a username/password pair\nis valid before allowing a client connection."},"SelectExitResponse":{"properties":{"node":{"$ref":"#/components/schemas/NodeResponse"},"session_id":{"type":"string","format":"uuid","title":"Session Id"}},"type":"object","required":["node","session_id"],"title":"SelectExitResponse"},"SessionResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"Session primary key."},"node_id":{"type":"string","format":"uuid","title":"Node Id","description":"ID of the node handling this session."},"client_ip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Ip","description":"Client IP at connection time."},"client_type":{"type":"string","title":"Client Type","description":"'spn' or 'grid'."},"status":{"type":"string","title":"Status","description":"'active' or 'ended'."},"started_at":{"type":"string","format":"date-time","title":"Started At","description":"When the session was established."},"ended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ended At","description":"When the session closed, if ended."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Record creation timestamp."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Record last-modified timestamp."},"node":{"anyOf":[{"$ref":"#/components/schemas/NodeResponse"},{"type":"null"}],"description":"The node this session is routed through (populated when joined)."}},"type":"object","required":["id","node_id","client_ip","client_type","status","started_at","ended_at","created_at","updated_at"],"title":"SessionResponse","description":"Full session representation returned by the API.\n\nThe `node` field is populated when the session is loaded with its\nrelationship; it may be None when the relationship was not loaded."},"SessionStatsResponse":{"properties":{"spn_clients":{"type":"integer","title":"Spn Clients","description":"Number of active NeuroSPN browser extension connections."},"grid_clients":{"type":"integer","title":"Grid Clients","description":"Number of active NeuroGrid proxy connections."},"total_active":{"type":"integer","title":"Total Active","description":"Total active sessions across all client types."},"sessions":{"items":{"$ref":"#/components/schemas/SessionResponse"},"type":"array","title":"Sessions","description":"Full list of all currently active sessions."}},"type":"object","required":["spn_clients","grid_clients","total_active","sessions"],"title":"SessionStatsResponse","description":"Snapshot of currently active client connections."},"SpnProvisionRequest":{"properties":{"device_id":{"type":"string","maxLength":36,"title":"Device Id","description":"UUID generated once per extension install — used to derive a stable username."}},"type":"object","required":["device_id"],"title":"SpnProvisionRequest","description":"Body for POST /proxy-users/spn-provision.\n\nSent by the NeuroSPN extension on first connect to auto-provision a set of\nNeuroGrid relay credentials. Idempotent: calling again with the same\ndevice_id rotates the password rather than creating a duplicate user."},"SpnProvisionResponse":{"properties":{"username":{"type":"string","title":"Username","description":"NeuroGrid proxy username."},"password":{"type":"string","title":"Password","description":"Plain-text password — shown once, never stored in DB."},"neurogrid_host":{"type":"string","title":"Neurogrid Host","description":"NeuroGrid proxy hostname."},"socks5_port":{"type":"integer","title":"Socks5 Port","description":"NeuroGrid SOCKS5 listener port."},"http_port":{"type":"integer","title":"Http Port","description":"NeuroGrid HTTP CONNECT listener port."}},"type":"object","required":["username","password","neurogrid_host","socks5_port","http_port"],"title":"SpnProvisionResponse","description":"One-time credential response for NeuroGrid proxy access.\n\nThe plain-text password is returned exactly once. The caller must store it\nimmediately — it is never recoverable after this call because only the\nbcrypt hash is persisted."},"StatusResponse":{"properties":{"message":{"type":"string","title":"Message","description":"Human-readable result message."},"success":{"type":"boolean","title":"Success","description":"True if the operation completed successfully."}},"type":"object","required":["message","success"],"title":"StatusResponse","description":"Generic operation status response returned by create/update/delete endpoints."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}