Search API

Run a semantic knowledge search over your ingested content using the existing RAG pipeline.

POST/v1/search

Authentication

Requires a secret API key passed as a Bearer token (Authorization: Bearer carrier_sk_…).

Request body

FieldTypeDescription
query*stringThe natural-language search query.
topKnumber, 1–20Max chunks to retrieve. Default 6.
minSimilaritynumber, 0–1Minimum similarity threshold. Default 0.3.

Example request

bash
curl -X POST https://api.carrieros.ai/v1/search \
  -H "Authorization: Bearer carrier_sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "How does OAuth refresh work?" }'

Response

FieldTypeDescription
answerstringSynthesized answer from retrieved context.
sourcesstring[]Source URLs/identifiers the answer draws from.
confidencenumber0–1 heuristic based on retrieval coverage.

Example response

json
{
  "success": true,
  "data": {
    "answer": "Refresh tokens let a client obtain a new access token…",
    "sources": ["https://…"],
    "confidence": 0.83
  }
}

Possible errors

CodeHTTPWhen it occurs
VALIDATION_ERROR400query is missing, or topK/minSimilarity is out of range.

Notes

If nothing relevant has been ingested yet, the response falls back to an answer with an empty sources array and confidence of 0 — this is expected, not an error.