Skip to main content
POST
/
search
/
universal
Universal search across all public sources
curl --request POST \
  --url https://apigcp.trynia.ai/v2/search/universal \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "How does authentication work in FastAPI?",
  "top_k": 20,
  "include_repos": true,
  "include_docs": true,
  "include_huggingface_datasets": false,
  "alpha": 0.7,
  "compress_output": false,
  "max_tokens": 50050,
  "boost_source_types": {
    "repository": 1.2,
    "documentation": 1,
    "research_paper": 0.9,
    "huggingface_dataset": 0.85
  },
  "boost_languages": [
    "<string>"
  ],
  "language_boost_factor": 1.5,
  "use_native_boosting": true
}
'
{
  "results": [
    {
      "content": "<string>",
      "summary": "<string>",
      "score": 123,
      "confidence": 0.5,
      "source": {
        "type": "repository",
        "url": "<string>",
        "namespace": "<string>",
        "file_path": "<string>",
        "display_name": "<string>"
      }
    }
  ],
  "sources_searched": 123,
  "query_time_ms": 123,
  "errors": [
    "<string>"
  ],
  "answer": "<string>",
  "token_metadata": {
    "token_estimate": 123,
    "total_available_tokens": 123,
    "tokens_used": 123,
    "tokens_remaining": 123,
    "results_truncated": true,
    "total_results_available": 123
  }
}

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

include_huggingface_datasets
boolean
default:false

Include HuggingFace dataset sources in search (excluded by default to prevent search pollution)

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

max_tokens
integer | null

Maximum tokens in response. Results truncated when budget reached.

Required range: 100 <= x <= 100000
boost_source_types
object

Source type boosts (override to customize or set {} to disable)

boost_languages
string[] | null

Programming languages to boost (e.g., ['python', 'typescript'])

language_boost_factor
number
default:1.5

Boost multiplier for preferred languages

Required range: 1 <= x <= 5
use_native_boosting
boolean
default:true

Use TurboPuffer FTS v2 native Sum/Product boosting

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)

token_metadata
object

Token budget metadata for content responses