Skip to main content

Search API

The Search API allows you to perform a semantic search on relevant chunks of data within your project. By using the search endpoint, you can retrieve a specified number of search results that match your query string.

The Search endpoint provides a list of search results based on the query string provided.

API Route

GET /query/v1/search/

Example Usage

CURL

curl -X GET \
'<KAPA_API_ENDPOINT>/query/v1/search/' \
-H 'X-API-TOKEN: <KAPA_API_TOKEN>' \
-d 'query=<QUERY_STRING>&num_results=<NUMBER_OF_RESULTS>'

Request Parameters

ParameterTypeDescription
querystringThe query string to be searched
num_resultsintThe number of search results to return (optional, default is 10, must be between 1 and 50)
include_source_namesstring[]The list of source names that should be included in the search result

Response Structure

The response will be a JSON object with a key search_results containing an array of search result objects. Each search result object will have the following keys:

KeyTypeDescription
contentstringThe content of the search result
source_urlstringThe URL of the source of the search result
titlestringThe title of the search result
source_typestringThe type of the source of the search result

These example requests demonstrate how to use the Search API to perform a semantic search within your project. By analyzing the search results, you can gain a better understanding of the data within your project.