> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.labric.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.labric.co/_mcp/server.

# Cancel training

POST https://platform.labric.co/api/v1/ml-models/{ml_model_id}/cancel-training

Cancel the model's in-flight training runs.

Overlapping retrains can leave several versions pending or training at
once, so the cancel is model-wide: every in-flight version is marked
'cancelled' and its cloud training jobs are stopped. Returns 400 when
no training is pending or running.

Requires an API key with the `write` scope.

Reference: https://docs.labric.co/api-reference/labric-api/models/cancel-training

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `ml_model_id` (string, required)

## Response

### 200

OK

- `id` (string, required)
- `name` (string, required)
- `task_type` (string, required)
- `description` (string, optional, nullable)
- `target_column` (string, optional, nullable)
- `feature_columns` (list of string, optional, nullable)
- `image_columns` (list of string, optional, nullable)
- `problem_type` (string, optional, nullable)
- `currently_active` (boolean, optional, default: false)
- `status` (string, optional, nullable)
- `version_number` (integer, optional, nullable)
- `dataset_id` (string, optional, nullable)
- `quality_preset` (string, optional, nullable)
- `error_message` (string, optional, nullable)
- `training_started_at` (datetime, optional, nullable)
- `training_completed_at` (datetime, optional, nullable)
- `evaluation_metrics` (map from string to any, optional, nullable)

## Errors

### 400 Bad Request Error

Bad Request

- `detail` (string, required)

### 401 Unauthorized Error

Unauthorized

- `detail` (string, required)

### 403 Forbidden Error

Forbidden

- `detail` (string, required)

### 404 Not Found Error

Not Found

- `detail` (string, required)

### 422 Unprocessable Entity Error

Unprocessable Content

- `detail` (list of map from string to any, required)

### 500 Internal Server Error

Internal Server Error

- `detail` (string, required)

## Examples

**Response**

```json
{
  "id": "9f8e7d6c-5b4a-4c3d-9e2f-1a0b9c8d7e6f",
  "name": "Tensile strength regressor",
  "task_type": "tabular",
  "description": "Estimates tensile strength of extruded polymer samples from formulation and process parameters.",
  "target_column": "tensile_strength_mpa",
  "feature_columns": [
    "polymer_fraction",
    "anneal_temperature_c",
    "extrusion_speed_mm_s"
  ],
  "image_columns": null,
  "problem_type": "regression",
  "currently_active": false,
  "status": "cancelled",
  "version_number": 1,
  "dataset_id": "4e5f6a7b-8c9d-4e0f-a1b2-c3d4e5f6a7b8",
  "quality_preset": "high_quality",
  "error_message": null,
  "training_started_at": "2026-08-21T15:03:11Z",
  "training_completed_at": null,
  "evaluation_metrics": null
}
```

**SDK Code**

```python
from labric import Labric

client = Labric(
    api_key="YOUR_TOKEN_HERE",
)

client.models.cancel_training(
    ml_model_id="9f8e7d6c-5b4a-4c3d-9e2f-1a0b9c8d7e6f",
)

```