POST
/
queries
/
top-documents
Top Documents
curl --request POST \
  --url https://api.zeroentropy.dev/v1/queries/top-documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "collection_name": "<string>",
  "query": "<string>",
  "k": 123,
  "filter": {},
  "include_metadata": false,
  "reranker": "<string>",
  "latency_mode": "low"
}'
{
  "results": [
    {
      "path": "<string>",
      "score": 123,
      "metadata": {},
      "file_url": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

The Authorization header must be provided in the format Bearer <your-api-key>.

You can get your API Key at the Dashboard!

Body

application/json
collection_name
string
required

The name of the collection.

query
string
required

The natural language query to search with. This cannot exceed 4096 UTF-8 bytes.

k
integer
required

The number of documents to return. If there are not enough documents matching your filters, then fewer may be returned. This number must be between 1 and 2048, inclusive.

filter
object | null

The query filter to apply. Please read Metadata Filtering for more information. If not provided, then all documents will be searched.

include_metadata
boolean
default:false

Whether or not to include the metadata in the top documents response. If not provided, then the default will be False.

reranker
string | null

The reranker to use after initial retrieval. The default is null. You can find available model ids along with more information at /models/rerank.

latency_mode
enum<string>
default:low

This option selects between our two latency modes. The higher latency mode takes longer, but can allow for more accurate responses. If desired, test both to customize your search experience for your particular use-case, or use the default of "low" and only swap if you need an additional improvement in search result quality.

Available options:
low,
high

Response

Successful Response

results
DocumentRetrievalResponse · object[]
required