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

# Search

> GET /v1/search — web search with credibility scoring.

```bash theme={null}
GET /v1/search?q={query}&num_results={n}
Authorization: Bearer ltx_your_key
```

## Parameters

| Param         | Type    | Required | Description                          |
| ------------- | ------- | -------- | ------------------------------------ |
| `q`           | string  | Yes      | Search query (1–500 chars)           |
| `num_results` | integer | No       | Results to return (1–20, default 10) |

## Providers and `provider_used`

The API tries **Brave** first. If Brave fails and the host has **`SEARCH_FALLBACK_ENABLED=true`** and a **`TAVILY_API_KEY`**, the server may answer from **Tavily** once. There is **no** query parameter to pick a provider.

Successful responses include **`provider_used`**: **`"brave"`** or **`"tavily"`**. Brave responses may be **cached** in Redis (same query + `num_results`); Tavily responses are **not** cached in iteration 46, so repeat queries after a fallback miss still hit the providers.

## Response

```json theme={null}
{
  "status": "success",
  "query": "Singapore climate policy",
  "provider_used": "brave",
  "results": [
    {
      "title": "Singapore Green Plan 2030",
      "url": "https://www.greenplan.gov.sg",
      "snippet": "...",
      "source": "www.greenplan.gov.sg",
      "credibility_score": 1.0,
      "published_date": null
    }
  ],
  "usage": {
    "calls_total": 42,
    "calls_remaining": 258,
    "over_limit": false,
    "upgrade_url": "/v1/billing/setup"
  },
  "cached": false,
  "response_time_ms": 312
}
```
