Link Dataset
Page Outline
Associates an existing dataset with a model, making it the active training data source. Only one dataset can be linked to a model at a time.
Base Path: /api/v1/models
Method: POST
Path: /{model_id}/dataset
Auth: Requires a valid Bearer token (Authorization: Bearer <JWT>)
Path Parameters
| Parameter | Type | Description |
|---|---|---|
model_id | string | Unique identifier of the model |
Request Body
{
"dataset_id": "ds-abc123",
"validate_schema": true
}
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | ✅ | ID of the dataset to link |
validate_schema | boolean | ❌ | If true (default), validates that the dataset schema is compatible with the model's config.feature_columns and target_column |
Behavior
- If a dataset is already linked, it is replaced by the new one. The previous link is silently removed.
- Schema validation checks that all configured feature columns exist in the dataset and that the target column is present. Returns
HTTP 422on schema mismatch ifvalidate_schema: true. - The dataset must belong to the same organization as the model; cross-org links are rejected with
HTTP 403. - An audit log entry is written with action
model.dataset_linked, referencing both themodel_idanddataset_id. - Returns
HTTP 404if either the model or dataset is not found.
Response
Returns a DatasetLink confirmation object.
{
"model_id": "mdl-7f3a19bc",
"dataset_id": "ds-abc123",
"dataset_name": "Customer Records Q1 2026",
"schema_validated": true,
"linked_at": "2026-03-13T11:05:00Z"
}