# Train and Manage Training Jobs

You can start, cancel, and stop training jobs through the REST API. You can also star NAS (Neural Architecture Search) child models to mark your preferred architectures.

## Start a Training Job

{% tabs %}
{% tab title="REST API" %}
Kick off a training run on a dataset version:

```url
POST https://api.roboflow.com/:workspace/:project/:version/train
```

```bash
curl "https://api.roboflow.com/my-workspace/my-detector/3/train?api_key=$ROBOFLOW_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"model_type": "rfdetr-base"}'
```

Training runs asynchronously. The response confirms that the job was queued, not that it has finished.

The calling API key must have the `trainingJob:create` scope.
{% endtab %}
{% endtabs %}

## Cancel a Training Job

{% tabs %}
{% tab title="REST API" %}
Cancel an in-progress training job. The job must be in a running or queued state; cancelling a finished job returns a `409 Conflict`.

```url
POST https://api.roboflow.com/:workspace/:project/:version/train/cancel
```

```bash
curl "https://api.roboflow.com/my-workspace/my-detector/3/train/cancel?api_key=$ROBOFLOW_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{}'
```

Example success response:

```json
{
  "success": true
}
```

Example error response (job already finished):

```json
{
  "error": {
    "type": "Conflict",
    "message": "Cannot cancel non-running train job.",
    "code": "CANNOT_CANCEL"
  }
}
```

Cancel is not idempotent. If the job has already completed or been cancelled, the endpoint returns `409`.

The calling API key must have the `trainingJob:create` scope.
{% endtab %}
{% endtabs %}

## Stop a Training Job (Early Stop)

{% tabs %}
{% tab title="REST API" %}
Request an early stop for a running training job. Unlike cancel, stop is idempotent and will return success even if the job has already stopped.

```url
POST https://api.roboflow.com/:workspace/:project/:version/train/stop
```

```bash
curl "https://api.roboflow.com/my-workspace/my-detector/3/train/stop?api_key=$ROBOFLOW_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{}'
```

Example success response:

```json
{
  "success": true
}
```

The calling API key must have the `trainingJob:create` scope.
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/developer/rest-api/train-and-manage-training-jobs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
