Skip to main content
POST
/
api
/
v1
/
collections
/
{id}
/
search
Search knowledge cards
curl --request POST \
  --url https://app.aigmented.com/api/v1/collections/{id}/search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "What are the payment terms?",
  "top_k": 5,
  "rerank": true,
  "current_only": false
}
'
{
  "results": [
    {
      "id": "<string>",
      "score": 123,
      "content": "<string>",
      "metadata": {
        "document_id": "<string>",
        "file_name": "<string>",
        "page": 123,
        "chunk_index": 123
      }
    }
  ],
  "total_results": 123,
  "query_time_ms": 123,
  "tokens_used": {
    "embedding": 123,
    "rerank": 123,
    "model_id": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Pass your API key as a Bearer token. Example: Authorization: Bearer sk-xxxxxxxxxxxx

Path Parameters

id
integer
required

Collection ID

Body

application/json
query
string
required

The search query string

Example:

"What are the main risk factors?"

top_k
integer
default:10

Number of results to return

Required range: 1 <= x <= 100
rerank
boolean
default:false

Whether to apply cross-encoder reranking to results

current_only
boolean
default:false

Restrict search to the most current document versions only

filters
object

Optional metadata filters to narrow the search scope

Example:
{ "document_type": "standard" }

Response

Search results

results
object[]
total_results
integer

Number of results returned

query_time_ms
number

Time taken to execute the search in milliseconds

tokens_used
object

Token usage breakdown