{
 "openapi": "3.1.0",
 "info": {
  "title": "xpsflow",
  "version": "0.1.0",
  "description": "The HTTP API of the xpsflow workbench, which runs on your own machine (`xpsflow serve`). This document is published for reference; the website serves no API. Every tool the assistant can call is available through POST /api/tool/{name}; GET /api/tools lists them with their JSON schemas. The same tools are served over the Model Context Protocol by `xpsflow mcp`."
 },
 "paths": {
  "/": {
   "get": {
    "summary": "Index",
    "operationId": "index__get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "text/html": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    },
    "description": "Index"
   }
  },
  "/api/session": {
   "get": {
    "summary": "Get Session",
    "operationId": "get_session_api_session_get",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Get Session Api Session Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Get Session"
   }
  },
  "/api/models": {
   "get": {
    "summary": "Models",
    "description": "The catalog of the endpoint this server is configured for.",
    "operationId": "models_api_models_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Models Api Models Get"
        }
       }
      }
     }
    }
   }
  },
  "/api/models/check": {
   "post": {
    "summary": "Models Check",
    "description": "Probe a client-chosen endpoint with the client's own key.\n\nThe server's key is never sent here, whatever base URL is given: this\nendpoint exists so the browser can test its own settings.",
    "operationId": "models_check_api_models_check_post",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ModelsCheckRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Models Check Api Models Check Post"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/api/upload": {
   "post": {
    "summary": "Upload",
    "operationId": "upload_api_upload_post",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "$ref": "#/components/schemas/Body_upload_api_upload_post"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Upload Api Upload Post"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Upload"
   }
  },
  "/api/spectrum/{key}": {
   "get": {
    "summary": "Spectrum",
    "operationId": "spectrum_api_spectrum__key__get",
    "parameters": [
     {
      "name": "key",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Key"
      }
     },
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Spectrum Api Spectrum  Key  Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Spectrum"
   }
  },
  "/api/composition": {
   "get": {
    "summary": "Composition",
    "description": "The session's composition: three labelled views, the intensity scale and state splits.",
    "operationId": "composition_api_composition_get",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Composition Api Composition Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/api/tools": {
   "get": {
    "summary": "Tools",
    "operationId": "tools_api_tools_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Tools Api Tools Get"
        }
       }
      }
     }
    },
    "description": "Tools"
   }
  },
  "/api/tool/{name}": {
   "post": {
    "summary": "Call Tool",
    "operationId": "call_tool_api_tool__name__post",
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Name"
      }
     },
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ToolRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Call Tool Api Tool  Name  Post"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Call Tool"
   }
  },
  "/api/figure/{name}": {
   "get": {
    "summary": "Figure",
    "operationId": "figure_api_figure__name__get",
    "parameters": [
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "title": "Name"
      }
     },
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Figure"
   }
  },
  "/api/chat": {
   "post": {
    "summary": "Chat",
    "operationId": "chat_api_chat_post",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ChatRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Chat"
   }
  },
  "/api/batch": {
   "post": {
    "summary": "Start Batch",
    "description": "Analyze every uploaded sample in the background; poll ``/api/batch/status``.",
    "operationId": "start_batch_api_batch_post",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/BatchRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Start Batch Api Batch Post"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/api/batch/status": {
   "get": {
    "summary": "Batch Status",
    "operationId": "batch_status_api_batch_status_get",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "title": "Response Batch Status Api Batch Status Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Batch Status"
   }
  },
  "/api/batch/report": {
   "get": {
    "summary": "Batch Report",
    "operationId": "batch_report_api_batch_report_get",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "text/html": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Batch Report"
   }
  },
  "/api/batch/table": {
   "get": {
    "summary": "Batch Table",
    "operationId": "batch_table_api_batch_table_get",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "title": "Response Batch Table Api Batch Table Get"
        }
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    },
    "description": "Batch Table"
   }
  },
  "/api/report": {
   "get": {
    "summary": "Report",
    "description": "Build and return the report (``format=html`` or ``format=pdf``) for the current session.",
    "operationId": "report_api_report_get",
    "parameters": [
     {
      "name": "sid",
      "in": "query",
      "required": false,
      "schema": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ],
       "title": "Sid"
      }
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "html",
       "title": "Format"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {}
       }
      }
     },
     "422": {
      "description": "Validation Error",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HTTPValidationError"
        }
       }
      }
     }
    }
   }
  },
  "/api/health": {
   "get": {
    "summary": "Health",
    "operationId": "health_api_health_get",
    "responses": {
     "200": {
      "description": "Successful Response",
      "content": {
       "application/json": {
        "schema": {
         "additionalProperties": true,
         "type": "object",
         "title": "Response Health Api Health Get"
        }
       }
      }
     }
    },
    "description": "Health"
   }
  }
 },
 "components": {
  "schemas": {
   "BatchRequest": {
    "properties": {
     "paths": {
      "anyOf": [
       {
        "items": {
         "type": "string"
        },
        "type": "array"
       },
       {
        "type": "null"
       }
      ],
      "title": "Paths"
     },
     "group_by": {
      "type": "string",
      "title": "Group By",
      "default": "stem"
     }
    },
    "type": "object",
    "title": "BatchRequest"
   },
   "Body_upload_api_upload_post": {
    "properties": {
     "files": {
      "items": {
       "type": "string",
       "contentMediaType": "application/octet-stream"
      },
      "type": "array",
      "title": "Files"
     }
    },
    "type": "object",
    "required": [
     "files"
    ],
    "title": "Body_upload_api_upload_post"
   },
   "ChatRequest": {
    "properties": {
     "text": {
      "type": "string",
      "title": "Text"
     },
     "model": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Model"
     },
     "base_url": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Base Url"
     },
     "api_key": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Api Key"
     }
    },
    "type": "object",
    "required": [
     "text"
    ],
    "title": "ChatRequest"
   },
   "HTTPValidationError": {
    "properties": {
     "detail": {
      "items": {
       "$ref": "#/components/schemas/ValidationError"
      },
      "type": "array",
      "title": "Detail"
     }
    },
    "type": "object",
    "title": "HTTPValidationError"
   },
   "ModelsCheckRequest": {
    "properties": {
     "base_url": {
      "type": "string",
      "title": "Base Url"
     },
     "api_key": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Api Key"
     },
     "model": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Model"
     }
    },
    "type": "object",
    "required": [
     "base_url"
    ],
    "title": "ModelsCheckRequest"
   },
   "ToolRequest": {
    "properties": {
     "arguments": {
      "additionalProperties": true,
      "type": "object",
      "title": "Arguments",
      "default": {}
     }
    },
    "type": "object",
    "title": "ToolRequest"
   },
   "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"
   }
  }
 },
 "servers": [
  {
   "url": "http://127.0.0.1:8765",
   "description": "the local workbench started with `xpsflow serve`"
  }
 ],
 "externalDocs": {
  "url": "https://xpsflow.pages.dev/docs/architecture",
  "description": "architecture and tool layer"
 }
}