# search: RAG – Semantic Search in Knowledge Base

> search (RAG – Semantic Search in Knowledge Base) is a 1001fx API function in the group Knowledge bases (RAG): POST https://api.1001fx.com/rag/search, 1 credit per call. It works as a ready-made module in Make or as a plain HTTP call.

Finds the passages that answer a query – by meaning and by exact words and codes (hybrid search) – optionally only in documents whose metadata match the filter. Returns the passages with document, title, source URL, metadata and score, e.g. for your own AI step. 1 credit per call.

- Group: Knowledge bases (RAG)
- Endpoint: `POST https://api.1001fx.com/rag/search`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: application/json
- Credits: 1 credit per call
- Ready-made in: Make
- Docs: https://1001fx.com/functions/search

## Parameters

- `knowledgeBase` (string, required) – Knowledge base: Name or ID of the knowledge base, e.g. "Support FAQ" or support-faq (same knowledge base). rag/adddocument creates it if it does not exist.
- `query` (string, required) – Query: Question or search words.
- `topK` (number, optional, default `5`, min 1, max 50) – Results: Number of passages, 1-50 (default 5).
- `minScore` (number, optional, min 0, max 1) – Minimum score: Leave out passages below this similarity (0-1); exact word and code matches always count.
- `filter` (any, optional) – Filter: Only documents whose metadata match. Object {"department": "billing", "lastModified": {"$gte": "2026-01-01"}} (operators $eq $ne $in $nin $gt $gte $lt $lte $exists $contains, $and $or $not) or array [{"key", "operator", "value", "type"}] (all must match).
- `filterJson` (string, optional) – Filter (JSON): The filter as JSON text, e.g. for OR conditions from Make: {"$or": [{"department": "billing"}, {"department": "sales"}]}.

## Example: RAG – Semantic Search in Knowledge Base

```bash
curl -X POST 'https://api.1001fx.com/rag/search' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"knowledgeBase":"Support FAQ","query":"How do I cancel my subscription?","topK":5}'
```
