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

# Training Status

Get the current training status including indexes being trained and the retrain threshold configuration.

## Authentication

Required - API key via `X-API-Key` header:

```http theme={null}
X-API-Key: cyborg_your_api_key_here
```

You can get an API key from the [CyborgDB Admin Dashboard](https://cyborgdb.co). For more info, follow [this guide](../../../intro/get-api-key).

## Request

This is a GET request with no request body. Authentication is required via the API key header.

## Response

```json theme={null}
{
  "training_indexes": ["my_index", "semantic_index"],
  "retrain_threshold": 10000,
  "currently_training": "my_index",
  "queued_indexes": ["semantic_index"],
  "worker_running": true,
  "worker_pid": 0,
  "global_training": {}
}
```

<Expandable title="response fields">
  <ResponseField name="training_indexes" type="array[string]">
    List of index names currently being trained or queued for training
  </ResponseField>

  <ResponseField name="retrain_threshold" type="integer">
    The multiplier for the retraining threshold. Auto-training triggers when `num_vectors > n_lists * retrain_threshold`
  </ResponseField>

  <ResponseField name="currently_training" type="string | null">
    Name of the index currently being trained, or null if none
  </ResponseField>

  <ResponseField name="queued_indexes" type="array[string]">
    List of indexes queued for training (waiting their turn)
  </ResponseField>

  <ResponseField name="worker_running" type="boolean">
    Whether the training worker thread is active
  </ResponseField>

  <ResponseField name="worker_pid" type="integer">
    *(Deprecated)* Always 0. Kept for SDK backward compatibility
  </ResponseField>

  <ResponseField name="global_training" type="object">
    *(Deprecated)* Always empty object. Kept for SDK backward compatibility
  </ResponseField>
</Expandable>

## Training States

Training state is inferred from the `currently_training` and `queued_indexes` fields:

* If `currently_training` is non-null, that index is actively being trained
* Indexes in `queued_indexes` are waiting their turn
* An index not in either field has completed or has not been trained

## Exceptions

* `401`: Authentication failed (invalid API key)
* `500`: Internal server error

## Example Usage

**Get Training Status:**

```bash theme={null}
curl -X GET "http://localhost:8000/v1/indexes/training-status" \
     -H "X-API-Key: cyborg_your_api_key_here"
```

**Monitor Training Progress:**

```bash theme={null}
# Check if any indexes are being trained
training_count=$(curl -s -X GET "http://localhost:8000/v1/indexes/training-status" \
     -H "X-API-Key: cyborg_your_api_key_here" | \
     jq '.training_indexes | length')

if [ "$training_count" -gt 0 ]; then
    echo "$training_count indexes are currently being trained"
fi
```

**Wait for Training Completion:**

```bash theme={null}
# Poll until specific index training is complete
index_name="my_index"

while true; do
    is_training=$(curl -s -X GET "http://localhost:8000/v1/indexes/training-status" \
         -H "X-API-Key: cyborg_your_api_key_here" | \
         jq --arg idx "$index_name" '.training_indexes | contains([$idx])')
    
    if [ "$is_training" = "false" ]; then
        echo "Training complete for $index_name"
        break
    fi
    
    echo "Still training $index_name..."
    sleep 5
done
```

**Check Retrain Threshold:**

```bash theme={null}
# Get the current retrain threshold
threshold=$(curl -s -X GET "http://localhost:8000/v1/indexes/training-status" \
     -H "X-API-Key: cyborg_your_api_key_here" | \
     jq '.retrain_threshold')

echo "Indexes will retrain when vector count exceeds ${threshold}x the initial training size"
```

<Note>
  Training is automatically triggered when:

  1. An index reaches the configured vector threshold (`num_vectors > n_lists * retrain_threshold`)
  2. Manual training is requested via the `/v1/indexes/train` endpoint
  3. The index has never been trained and reaches the minimum vector count
</Note>

<Tip>Use this endpoint to avoid querying an index while it's being trained, as training can temporarily affect query performance.</Tip>
