***

title: SearchService
slug: /reference/python/agents/search/search-service
description: HTTP API service for serving search queries with authentication and caching.
max-toc-depth: 3
---------------------

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

[searchengine]: /docs/server-sdks/reference/python/agents/search/search-engine

[start]: /docs/server-sdks/reference/python/agents/search/search-service/start

[searchdirect]: /docs/server-sdks/reference/python/agents/search/search-service/search-direct

[stop]: /docs/server-sdks/reference/python/agents/search/search-service/stop

`SearchService` wraps one or more search indexes behind a FastAPI HTTP service
with basic authentication, CORS, query caching, and optional HTTPS support.
It can serve both SQLite and pgvector backends simultaneously.

```python
from signalwire.search import SearchService
```

<Warning>
  Requires FastAPI and uvicorn in addition to search dependencies:
  `pip install signalwire[search]`.
</Warning>

## **Properties**

<ParamField path="app" type="FastAPI | None" toc={true}>
  The FastAPI application instance. `None` if FastAPI is not installed.
</ParamField>

<ParamField path="indexes" type="dict[str, str]" toc={true}>
  Mapping of index names to file paths (SQLite) or collection names (pgvector).
</ParamField>

<ParamField path="search_engines" type="dict[str, SearchEngine]" toc={true}>
  Mapping of index names to loaded
  [`SearchEngine`][searchengine] instances.
</ParamField>

<ParamField path="backend" type="str" toc={true}>
  Storage backend in use. `"sqlite"` or `"pgvector"`.
</ParamField>

<ParamField path="port" type="int" toc={true}>
  Port the service listens on.
</ParamField>

## **Methods**

<CardGroup cols={2}>
  <Card title="start" href="/docs/server-sdks/reference/python/agents/search/search-service/start">
    Start the HTTP service. Blocks until the server is shut down.
  </Card>

  <Card title="search_direct" href="/docs/server-sdks/reference/python/agents/search/search-service/search-direct">
    Perform a search programmatically without going through the HTTP API.
  </Card>

  <Card title="stop" href="/docs/server-sdks/reference/python/agents/search/search-service/stop">
    Stop the service and perform cleanup.
  </Card>
</CardGroup>

## **HTTP Endpoints**

When running, the service exposes the following endpoints:

| Endpoint        | Method | Auth     | Description                                                                                                                 |
| --------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| `/search`       | POST   | Required | Submit a search query. Request body accepts `query`, `index_name`, `count`, `similarity_threshold`, `tags`, and `language`. |
| `/health`       | GET    | None     | Health check. Returns backend type, loaded indexes, and SSL status.                                                         |
| `/reload_index` | POST   | Required | Reload or add a new index at runtime.                                                                                       |