Search Knowledge Base

Perform vector similarity search across one or more knowledge bases. Supports semantic search via query text, tag-based filtering, or a combination of both.

POST/api/v1/knowledge/search
X-API-Key<token>

Your Sim API key (personal or workspace). Generate one from the Sim dashboard under Settings > API Keys.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST \  "https://www.sim.ai/api/v1/knowledge/search" \  -H "X-API-Key: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "workspaceId": "YOUR_WORKSPACE_ID",    "knowledgeBaseIds": ["KB_ID"],    "query": "How do I reset my password?",    "topK": 5  }'
{
  "success": true,
  "data": {
    "results": [
      {
        "documentId": "doc_abc123",
        "documentName": "Getting Started.pdf",
        "content": "To reset your password, go to Settings > Security.",
        "chunkIndex": 3,
        "similarity": 0.95,
        "metadata": {}
      }
    ],
    "query": "How do I reset my password?",
    "knowledgeBaseIds": [
      "kb_abc123"
    ],
    "topK": 5,
    "totalResults": 1
  }
}
{
  "error": "string",
  "details": [
    {}
  ]
}
{
  "error": "string"
}
{
  "error": "string"
}
{
  "error": "string"
}
{
  "error": "string"
}