ML Prediction Engine API Reference
Authentication and Request Format
All endpoints are POST with a JSON body. Send your key in the X-API-Key header, or as an apiKey field in the body. Paths use path info, and if your server does not support that, api.php?action=predict works the same as api.php/predict.
POST api.php/predict
Run an input through a pipeline and get the answer.
curl -X POST https://yourserver.com/api.php/predict \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_KEY" \
-d '{"pipelineID": 1, "input": "why was i charged twice"}'
{"output": "billing", "steps": [{"step": 0, "class": "knn", "output": "billing"}]}
| Field | Notes |
|---|---|
pipelineID | Required. Which pipeline to run, from the admin or the pipelines endpoint. |
input | Required. A string for text models, or a number list or comma string for numeric models. |
output is the final answer, and steps shows each step's output when the pipeline has several. Answer shapes by category: classifiers return the label, regressors return a number, clusterers return a cluster number with DBSCAN using -1 for noise, and anomaly detectors return 1 for anomaly and 0 for normal.
POST api.php/train
Train one step from its stored dataset. Fields: pipelineID, and modelIndex, 0 for the first step. Training rebuilds the model from the complete dataset, and the response confirms the row count: {"message": "Model trained from 120 rows.", "samples": 120}.
POST api.php/dataset/add
Append one training row.
| Field | Notes |
|---|---|
pipelineID, modelIndex | Required. Which step's dataset to append to. |
input | Required. The example input, text or numbers. |
label | The right answer. Required for classifiers and regressors, and clusterers and anomaly detectors train on inputs alone. |
train | Optional. Send "1" to retrain immediately after adding. |
This is the endpoint that turns your app's real events into training data: a solved ticket, a closed deal, or a confirmed spam report becomes a row the moment it happens.
POST api.php/dataset/set
Replace a step's whole dataset in one call. Fields: pipelineID, modelIndex, and filecontent, jsonL text with one {"input": ..., "label": ...} object per line. The bulk loader for first setups and scheduled rebuilds, and the dataset and training guide covers the row formats in detail.
POST api.php/dataset/rows and dataset/clear
dataset/rows lists a step's dataset rows, and dataset/clear empties the dataset. Fields for both: pipelineID, modelIndex. Together with add and set, these give external tools full dataset management over the same authenticated API.
POST api.php/pipelines
Lists every pipeline with its steps and training status. No fields beyond the API key. This is the discovery call for wiring the engine into other systems, a workflow tool can enumerate what exists and offer your pipelines by name, which is exactly how our Workflow Chain Engine treats it.
POST api.php/summarize
The optional AI reporting endpoint: send any batch of data and a large language model writes a factual summary, stored in the admin's AI Reports history.
| Field | Notes |
|---|---|
data | Required. An array of items to summarize. |
prompt | Optional. Extra instructions for the summary. |
label | Optional. A name for finding the report later. |
It activates when you add an LLM key to the config, Anthropic or any OpenAI compatible provider, and the machine learning endpoints run entirely on your own hardware with no LLM involved.
Putting It Together
A typical integration uses three calls in a loop: dataset/add as real labeled examples occur, train on whatever rhythm suits the job, and predict everywhere decisions happen. Flip on live training and the middle call handles itself.
Eight POST endpoints cover the whole engine: predict runs a pipeline, train rebuilds a step from its dataset, the four dataset calls append, bulk-load, list, and clear rows, pipelines makes the engine discoverable, and summarize adds optional LLM reports. One API key header and any language that can POST is in business.