Skip to main content
GET
/
v1
/
indexes
/
training-status
Training Status
curl --request GET \
  --url https://api.example.com/v1/indexes/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:
X-API-Key: cyborg_your_api_key_here
You can get an API key from the CyborgDB Admin Dashboard. For more info, follow this guide.

Request

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

Response

{
  "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": {}
}

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:
curl -X GET "http://localhost:8000/v1/indexes/training-status" \
     -H "X-API-Key: cyborg_your_api_key_here"
Monitor Training Progress:
# 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:
# 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:
# 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"
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
Use this endpoint to avoid querying an index while it’s being trained, as training can temporarily affect query performance.