openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: agents description: AI Agent pipeline operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /agents/sample-data: get: operationId: getSampleData tags: [agents] summary: Get sample time-series sales data responses: "200": description: Sample data content: application/json: schema: $ref: "#/components/schemas/SampleDataResponse" /agents/datasets: get: operationId: listDatasets tags: [agents] summary: List available datasets responses: "200": description: Available datasets content: application/json: schema: $ref: "#/components/schemas/DatasetListResponse" /agents/datasets/{name}: get: operationId: getDataset tags: [agents] summary: Get a named dataset parameters: - name: name in: path required: true schema: type: string responses: "200": description: Dataset content: application/json: schema: $ref: "#/components/schemas/SampleDataResponse" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /agents/upload: post: operationId: uploadDataset tags: [agents] summary: Upload an Excel or CSV file and get aggregated time-series data requestBody: required: true content: multipart/form-data: schema: type: object properties: file: type: string format: binary dateColumn: type: string valueColumn: type: string responses: "200": description: Parsed and aggregated dataset content: application/json: schema: $ref: "#/components/schemas/SampleDataResponse" "400": description: Invalid file content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /agents/run: post: operationId: runAgentPipeline tags: [agents] summary: Run the full AI agent pipeline (clean → forecast → summarize) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RunPipelineRequest" responses: "200": description: Pipeline result with SSE stream content: application/json: schema: $ref: "#/components/schemas/PipelineResult" /agents/pipeline/{id}: get: operationId: getPipelineResult tags: [agents] summary: Get a previous pipeline run result parameters: - name: id in: path required: true schema: type: string responses: "200": description: Pipeline result content: application/json: schema: $ref: "#/components/schemas/PipelineResult" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /agents/history: get: operationId: getPipelineHistory tags: [agents] summary: Get list of past pipeline runs responses: "200": description: List of past runs content: application/json: schema: $ref: "#/components/schemas/PipelineHistoryResponse" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorResponse: type: object properties: error: type: string required: - error DataPoint: type: object properties: date: type: string description: ISO date string (YYYY-MM-DD) value: type: number description: Raw value cleanedValue: type: number nullable: true description: Cleaned value after processing forecastValue: type: number nullable: true description: Forecasted value isForecast: type: boolean description: Whether this point is a forecast required: - date - value - isForecast AgentStepStatus: type: string enum: [idle, running, done, error] AgentStep: type: object properties: name: type: string status: $ref: "#/components/schemas/AgentStepStatus" output: type: string nullable: true durationMs: type: number nullable: true required: - name - status SampleDataResponse: type: object properties: data: type: array items: $ref: "#/components/schemas/DataPoint" description: type: string required: - data - description RunPipelineRequest: type: object properties: data: type: array items: $ref: "#/components/schemas/DataPoint" forecastPeriods: type: integer default: 6 description: Number of future periods to forecast datasetName: type: string description: Name of the dataset being analyzed required: - data PipelineResult: type: object properties: id: type: string createdAt: type: string datasetName: type: string steps: type: array items: $ref: "#/components/schemas/AgentStep" cleanedData: type: array items: $ref: "#/components/schemas/DataPoint" forecastData: type: array items: $ref: "#/components/schemas/DataPoint" summary: type: string nullable: true status: $ref: "#/components/schemas/AgentStepStatus" required: - id - createdAt - steps - cleanedData - forecastData - status PipelineHistoryItem: type: object properties: id: type: string createdAt: type: string datasetName: type: string status: $ref: "#/components/schemas/AgentStepStatus" summary: type: string nullable: true required: - id - createdAt - status PipelineHistoryResponse: type: object properties: runs: type: array items: $ref: "#/components/schemas/PipelineHistoryItem" required: - runs DatasetInfo: type: object properties: name: type: string label: type: string description: type: string rowCount: type: integer dateRange: type: string required: - name - label - description - rowCount - dateRange DatasetListResponse: type: object properties: datasets: type: array items: $ref: "#/components/schemas/DatasetInfo" required: - datasets