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

# Document search with Paradigm 

> RAG requests can be 100% done through the Paradigm API. It allows users to submit a query, which the system processes to provide relevant answers by leveraging associated documents or going through the whole knowledge base.

Search through your uploaded documents using natural language queries. The system uses RAG (Retrieval-Augmented Generation) to find relevant content and generate contextual answers based on your document library.

<Note>
  **This endpoint is useful for:**

  * **Searching content across multiple documents and scopes.**
  * **Integrating document search into chat-based workflows.**
  * **Enabling contextual and scoped responses using specific file or workspace data.**
</Note>

<Info>
  Starting from the **Victorious Vicuna** release (January 2026) and later, using the [Agent API](/en/developer-resources/chat-and-ai-models/agent-api) is the preferred way of achieving this task.
</Info>

## Prerequisites

* A **Paradigm API key**: if you do not have one, go to your Paradigm profile (`/settings/api-key` in your instance) and generate a new API key.
* **Uploaded documents**: You need documents in your Paradigm instance to search through. See [Add a document](/en/developer-resources/files/add-document) for upload instructions.

## Example API Request

Example of API request using the *requests* package:

<Info>
  For more info : See the [Agent API](/en/developer-resources/chat-and-ai-models/agent-api) documentation
</Info>

```python expandable wrap theme={null}
import requests
import os

# Get API key and base URL from environment
api_key = os.getenv("PARADIGM_API_KEY")
base_url = os.getenv("PARADIGM_BASE_URL", "https://paradigm.lighton.ai/api/v3")

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

payload = {
  "chat_setting_id": 1,
  "ml_model": "alfred-ft5",
  "query": "How do we sign an NDA at Lighton ?",
  "force_tool": "document_search"
  # Optional parameters (if not filled, same as UI search)
  # "file_ids": ["abc123-file-id"],
  # "workspace_ids": [],
  # "tag_ids": [] 
}

response = requests.post(f"{base_url}/threads/turns", headers=headers, json=payload)

if response.status_code == 200:
    data = response.json()
    print("Answer:", data["answer"])
else:
    print("Error:", response.status_code, response.text)
```
