Skip to main content
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.
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.

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 for upload instructions.

Example API Request

Example of API request using the requests package:
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/v2")

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

payload = {
    "query": "What is the termination clause in the contract?",
    # Optional parameters (if not filled, same as UI search)
    # "file_ids": ["abc123-file-id"],
    "model": "alfred-4",
    # "workspace_ids": [], # No workspace included
    "company_scope": True, # Documents from the user's company will be added to the scope
    "private_scope": True, # Private documents included
    "tool": "DocumentSearch" # No vision (enter "VisionDocumentSearch" to enable vision)
}

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

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