---
title: "Predict Data"
method: POST
path: "/api/text2sql/predict"
tags: ["text2sql"]
---

# Predict Data

`POST /api/text2sql/predict`

Generate prediction based on chart data

## Request body

- PredictionRequest — Request schema for data prediction
  - `chartType` string, required — Chart type: bar, pie, line
  - `data` ChartData, required — Chart data structure
    - `columns` string[], required
    - `rows` object[], required
  - `mapping` DataMapping — Data mapping for chart axes
    - `xAxis` string, nullable
    - `yAxis` string, nullable
    - `valueAxis` string, nullable
  - `predictPeriods` integer — Number of periods to predict

## Response `200`

Successful Response

- PredictionResponse — Response schema for data prediction
  - `success` boolean, required
  - `predictedData` PredictionPoint[], required
    - `period` string, required
    - `predictedValue` number, required
    - `confidenceLower` number, nullable
    - `confidenceUpper` number, nullable
  - `chartType` string, required
  - `confidence` string, nullable
  - `trendAnalysis` string, nullable
  - `error` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/xorbitsai/apis/xagent.md) · [All operations](https://skmtc.dev/xorbitsai/apis/xagent/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/xorbitsai/xagent/revisions/66a05609bfdd/schema)
