Search through all files in data folders shared with the API Key
Knowledge Folder API
Search Knowledge Folders
Perform semantic search across knowledge folders shared with your API key
POST
Search through all files in data folders shared with the API Key
Documentation Index
Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
Use this file to discover all available pages before exploring further.
Using our API via a dedicated deployment? Just replace
api.langdock.com with your deployment’s base URL: <deployment-url>/api/publicRequires an API key with the
KNOWLEDGE_FOLDER_API scope. The search is scoped to all knowledge folders shared with the API key. See Share Knowledge Folders with the API for setup instructions.How It Works
- Your query is converted to an embedding using your workspace’s default embedding model
- The system performs vector similarity search across all documents in shared knowledge folders
- Results are filtered by relevance threshold and re-ranked using an LLM
- Only the highest-scoring chunk per document is returned
Request Format
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | The search query to find relevant documents |
Examples
Search with cURL
Search with JavaScript
Using Search Results for RAG
Response Format
Success Response (200 OK)
Example Response
Error Handling
Best Practices
Write clear, specific queries - The search uses semantic similarity, so natural language questions work well. Be specific about what you’re looking for. Handle empty results - If no relevant documents are found, theresult array will be empty. Your application should handle this gracefully.
Use similarity scores - The similarity score ranges from 0 to 1. Higher scores indicate better matches. Consider filtering results below a certain threshold for your use case.
Cite sources - Use the subname and url fields to provide attribution when displaying results to users.
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.