Skip to main content
Copy-and-run flows. Each one is complete: no steps left as an exercise. All of them assume $TOKEN and $BASE:
jq is used throughout for readability. Nothing depends on it.

Feature Refinery

Create, upload two files, start, poll, download.

1. Create the run

The name must be unique among your unfinished runs: letters, digits, spaces, hyphens, underscores, 1 to 100 characters. A clash is 409. numberOfBuckets must be 4, 10 or 20.

2. Upload both files

The response carries one uploadTargets entry per file. Each has a url and possibly a requiredHeader as a single Name:value string.
No Authorization header on these. The URL is already signed, and adding one gives 403.

3. Start it

400 means a file did not arrive, or the training file has more than 70 columns. 409 means it was already started. 429 means you already have 5 runs in flight.

4. Poll

States run PENDING → SETUP_* → MEASURE_INITIAL_THRESHOLD* → BASELINE_RUN_* → REFINING_LOOP_* → CREATING_RESULT → REFINEMENT_COMPLETED. Match on the terminal states, not on the intermediate ones; those can change. This takes a while. Time scales with columns, not rows.

5. Collect the result

The download URLs are null until the state is REFINEMENT_COMPLETED, and they expire. Fetch the result again for fresh ones. You do not need to download anything if the next step is training: hand the key straight over.

Model Crucible

1a. Dataset from a finished refinement

uploadTargets comes back empty. The refined files, the bucket count and the measured target all come across with the refinement.
Do not call /clean on this route. Creating the dataset already started it. Calling /clean earns a 409 already cleaned.

1b. Dataset from your own files

Here /clean is required, and only after both files have landed.

2. Wait for the dataset

FAILED is terminal too. Check for it, and read .errors when it happens.

3. Train

Read the target off the dataset rather than inventing one.
recommendedThreshold is present only on a dataset that came from a refinement. When it is absent, you are choosing the target, and choosing badly is the most expensive mistake available. A target far above what the data supports produces a model that predicts one class for every row: plausible accuracy, F1 of zero. Always check F1 and recall on the result, not just accuracy.

4. Poll the run

5. Look at what it offers

Candidates come back best first, ranked by fewest falseDecisions. v1 is champion by default.

6. Change the champion, if you want a different trade

attemptNumber must be one the run actually offers, or you get 400. Nothing is rebuilt; a flag moves. Predictions already run keep the version they ran against.

7. Predict

The multipart part is named _file. The underscore is required. applyColumnStatusFilter=true drops the columns the refinement removed, going by position, so you can send your original unlabelled file unchanged. It only works where the model’s dataset came from a refinement; anywhere else it is a 400. A file you already stripped yourself passes through untouched.

Common problems

Build a CLI or agent from this

The same contract, written for a machine to consume.