> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zerodrift.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Training Status

> Poll a policy import until its Training Studio adapter is ready

Return the current training run for a policy import. Poll after
[Train Policy Adapter](/api-reference/training-studio/train-policy) until
`status` is `succeeded` or `failed`.

The successful poll is part of activation: when Training Studio reports
`succeeded`, ZeroDrift records the run as the import's active adapter. A failed
retraining attempt does not replace an earlier working adapter.

## Path Parameters

<ParamField path="import_id" type="string" required>
  The policy import whose training run you want to inspect.
</ParamField>

## Response

<ResponseField name="import_id" type="string">
  Policy import associated with the run.
</ResponseField>

<ResponseField name="training_run_id" type="string">
  Training Studio run identifier.
</ResponseField>

<ResponseField name="status" type="string">
  Current run status. `succeeded` and `failed` are terminal.
</ResponseField>

<ResponseField name="stage" type="string">
  Current training pipeline stage, when reported.
</ResponseField>

<ResponseField name="progress" type="object">
  Training progress details, when reported.
</ResponseField>

<ResponseField name="error" type="string">
  Failure detail when `status` is `failed`.
</ResponseField>

<ResponseExample>
  ```json 200 Training Succeeded theme={null}
  {
    "import_id": "550e8400-e29b-41d4-a716-446655440000",
    "training_run_id": "run-808961af",
    "status": "succeeded",
    "stage": "complete",
    "progress": {
      "completed": 4,
      "total": 4
    },
    "error": null
  }
  ```
</ResponseExample>

## Error Responses

| Status | Description                                                |
| ------ | ---------------------------------------------------------- |
| 403    | Invalid API key, or the import belongs to another customer |
| 404    | Import not found, or no training run has been started      |
| 500    | Import state could not be read or updated                  |
| 502    | Training Studio status request failed                      |
| 503    | Training is not configured in this environment             |

## Complete flow

Training extends the custom-policy flow:

1. [Import Policy](/api-reference/custom-policies/import-policy).
2. Poll [Get Import Details](/api-reference/custom-policies/get-import-details)
   until extraction reaches `pending_review`.
3. Review or simulate the extracted rules, then
   [Activate Rules](/api-reference/custom-policies/activate-rules).
4. [Train Policy Adapter](/api-reference/training-studio/train-policy).
5. Poll this endpoint until `status` is `succeeded` or `failed`. Stop on
   either terminal status; do not keep polling a failed run.
6. If the run `succeeded`, enforce content with
   [`validation_scope.imports`](/api-reference/validate/validate-content)
   containing the import ID.

<Warning>
  Do not submit content for enforcement to a still-training run. ZeroDrift only promotes
  `training_run_id` after a successful status poll; until then, scoped
  enforcement follows its configured fallback path.
</Warning>

## Example

This sample starts training and polls to a terminal state.

```python Python theme={null}
import time
import requests

API_BASE = "https://api.zerodrift.ai"
API_KEY = "YOUR_API_KEY"
IMPORT_ID = "550e8400-e29b-41d4-a716-446655440000"
URL = f"{API_BASE}/api/policies/import/{IMPORT_ID}/train"
HEADERS = {"x-api-key": API_KEY}

started = requests.post(URL, headers=HEADERS, json={})
started.raise_for_status()
print(started.json())

while True:
    response = requests.get(URL, headers=HEADERS)
    response.raise_for_status()
    training = response.json()
    print(training["status"])

    if training["status"] in ("succeeded", "failed"):
        break
    time.sleep(10)

if training["status"] == "failed":
    raise SystemExit(training.get("error", "Training failed"))
```
