***

title: validate_index
slug: /reference/python/agents/search/index-builder/validate-index
description: Validate an existing .swsearch index file.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Validate an existing `.swsearch` index file, checking schema integrity and
returning summary statistics. Use this to verify that an index was built
correctly before deploying it.

## **Parameters**

<ParamField path="index_file" type="str" required={true} toc={true}>
  Path to the `.swsearch` file to validate.
</ParamField>

## **Returns**

`dict[str, Any]` -- A dictionary with:

* `valid` (bool) -- whether the index is valid
* `error` (str) -- error message if invalid
* `chunk_count` (int) -- number of chunks (if valid)
* `file_count` (int) -- number of source files (if valid)
* `config` (dict) -- index configuration (if valid)

## **Example**

```python {4}
from signalwire.search import IndexBuilder

builder = IndexBuilder()
result = builder.validate_index("knowledge.swsearch")

if result["valid"]:
    print(f"Index OK: {result['chunk_count']} chunks, {result['file_count']} files")
else:
    print(f"Invalid index: {result['error']}")
```