Skip to main content
POST
Search through all files in data folders shared with the API Key
Using our API via a dedicated deployment? Just replace api.langdock.com with your deployment’s base URL: <deployment-url>/api/public
The Knowledge Folder API manages resources that appear as Knowledge bases in the Library.
Performs a semantic search across all Knowledge bases shared with your API key. Returns relevant document chunks ranked by similarity to your query.
Requires an API key with the KNOWLEDGE_FOLDER_API scope. The search is scoped to all Knowledge bases shared with the API key. See Share Knowledge bases with the API for setup instructions.

How It Works

  1. Your query is converted to an embedding using your workspace’s default embedding model
  2. The system performs vector similarity search across all documents in shared Knowledge bases
  3. Results are filtered by relevance threshold and re-ranked using an LLM
  4. Only the highest-scoring chunk per document is returned

Request Format

Request Body

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, the result 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.

Authorizations

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Body

application/json
query
string
required

The search query

Example:

"API Documentation"

Response

200

Successfully found search result