Logo
Search & Inference

Knowledge Search

View Docs

API Reference

POST
/api/agent/k_search

Authorization

ApiKeyAuth
access-key<token>

Your unique access-key generated from the platform UI

In: header

Request Body

application/json

doc_process_ids*array<string>

Array of document IDs to search within (obtained from Upload or List Documents APIs). Only documents with status 'processed' can be searched.

question*string

Natural language question to ask about your documents. More specific questions yield better answers.

context?string

Response detail level: 'concise' for brief direct answers, 'medium' for balanced responses, 'extended' for comprehensive analysis

Default"medium"
Value in"concise" | "medium" | "extended"
model_data*

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.k-v.ai/api/agent/k_search" \  -H "Content-Type: application/json" \  -d '{    "doc_process_ids": [      "your_doc_id"    ],    "question": "What are the parties involved?",    "context": "medium",    "model_data": {      "model_name": "gpt-5.1",      "api_key": ""    }  }'
{
  "data": {
    "answer": "The parties involved are:\n\n- **ABC Software Corporation** (referred to as the **Plaintiff**)\n- **Widget Corporation** (referred to as the **Defendant**)",
    "sources": [
      {
        "content": "SETTLEMENT AGREEMENT AND RELEASE...",
        "score": 0.38453761232252937,
        "filename": "Settlement Agreement (1).pdf",
        "doc_hash": "264dfa262b748d15ccbeaada89430c68",
        "page_number": 1
      }
    ]
  },
  "message": "Question processed successfully"
}

{
  "data": {},
  "message": "query not provided"
}

{
  "value": {
    "data": {},
    "message": "Invalid or missing access key"
  }
}

{
  "detail": [
    {
      "type": "literal_error",
      "loc": [
        "body",
        "context"
      ],
      "msg": "Input should be 'concise', 'medium' or 'extended'",
      "input": "",
      "ctx": {
        "expected": "'concise', 'medium' or 'extended'"
      }
    }
  ]
}

{
  "data": {},
  "message": "litellm.AuthenticationError: AuthenticationError: OpenAIException - Incorrect API key provided: tyrdfuih**uhf7. You can find your API key at https://platform.openai.com/account/api-keys."
}