Dynamiq
Knowledge Bases

Search knowledge base documents

Performs a semantic search over the knowledge base's documents using the knowledge base's configured embedder and retriever. Served on the knowledge base's own hostname (returned in the `hostname` field of the knowledge base resource).

POST
/v1/documents/search

Authorization

accessKey
AuthorizationBearer <token>

Organization or project Access Key created in the Dynamiq console. Used for deployed-app (Runs API), AI Gateway, traces collector, and management API requests. Send as Authorization: Bearer <access-key>.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body for POST /v1/documents/search.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/documents/search" \  -H "Content-Type: application/json" \  -d '{    "query": "refund policy for duplicate charges",    "limit": 5  }'
{
  "data": [
    {
      "id": "1f2e3d4c-5b6a-4798-8a1b-2c3d4e5f6071",
      "content": "Customers charged twice for the same invoice are eligible for an automatic refund of the duplicate charge within 5 business days...",
      "metadata": {
        "file_id": "8d9e0f1a-2b3c-4d4e-8f5a-6b7c8d9e0f1a",
        "source": "billing-faq.pdf",
        "page": 3
      },
      "score": 0.92
    }
  ]
}
{
  "error": {
    "code": "bad_request",
    "message": "Bad Request",
    "details": {
      "input": "cannot be blank"
    }
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Unauthorized"
  }
}
{
  "error": {
    "code": "not_found",
    "message": "Not Found"
  }
}