Skip to main content
POST
/
universal-search
curl --request POST \
  --url https://apigcp.trynia.ai/v2/universal-search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "How to implement authentication in FastAPI?",
  "top_k": 20
}
'
{
"results": [
{
"content": "FastAPI provides built-in support for OAuth2...",
"score": 0.95,
"source": {
"type": "documentation",
"url": "https://fastapi.tiangolo.com",
"namespace": "public-docs-abc123",
"file_path": "/security/oauth2"
}
},
{
"content": "Example authentication implementation...",
"score": 0.89,
"source": {
"type": "repository",
"url": "https://github.com/fastapi/fastapi",
"namespace": "public-repo-def456",
"file_path": "examples/security/oauth2.py"
}
}
],
"sources_searched": 5,
"query_time_ms": 1250,
"errors": null,
"answer": null
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json
query
string
required

Natural language search query

Example:

"How does authentication work in FastAPI?"

top_k
integer
default:20

Total number of results to return

Required range: 1 <= x <= 100
include_repos
boolean
default:true

Include repository sources in search

include_docs
boolean
default:true

Include documentation sources in search

alpha
number
default:0.7

Weight for vector search (1-alpha for BM25). Higher values favor semantic similarity.

Required range: 0 <= x <= 1
compress_output
boolean
default:false

Use AI to compress results into a concise answer with citations

Response

Search completed successfully

results
object[]
sources_searched
integer

Number of source namespaces searched

query_time_ms
integer

Total query time in milliseconds

errors
string[] | null

Any errors encountered during search

answer
string | null

AI-compressed answer (only when compress_output=true)