Skip to content

Query & Search

Show:

The Query & Search API lets you ask a bucket a natural-language question and get back answer-ready context with source citations. Schift owns the full retrieval pipeline: embedding, hybrid retrieval, metadata filtering, reranking, context packing, and citation formatting.

Use this endpoint for user-facing retrieval, agent context assembly, and any integration that needs cited answers from bucket content.

VersionStatusNotes
v2CurrentConsumer search with context and citations. Use for all new integrations.
v1DeprecatedPOST /v1/query, POST /v1/collections/\{name\}/search, and POST /v1/buckets/\{bucket_id\}/search. Kept for existing clients only.

Note: v1 search endpoints return Deprecation, Sunset, and Warning headers and a Link header pointing to the v2 successor.

Ask a bucket a question and return answer-ready context with citations.

NameTypeDescription
bucket_idstringUUID or slug of the bucket to search.
FieldTypeRequiredDefaultDescription
querystringYesNatural-language question. Maximum 8,192 characters.
top_kintegerNo8Maximum number of cited passages to return.
context_budgetintegerNo2000Approximate maximum context size in tokens.
filtersobjectNonullMetadata filters applied to candidate chunks.
options.rerank.enabledbooleanNotrueReorder candidate passages before context assembly.
options.rerank.top_kintegerNonullNumber of candidate passages to rerank.
options.instructions.taskstringNonullSearch instruction preset: retrieval_query, retrieval_document, semantic_similarity, question_answering, clustering, classification, or code_retrieval.
Terminal window
curl -X POST ${API_BASE_URL:-https://api.schift.io}/v2/buckets/product-docs/search \
-H "Authorization: Bearer $SCHIFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "What changed in the enterprise plan?",
"top_k": 8,
"context_budget": 4000,
"filters": {"status": "published"},
"options": {
"rerank": {"enabled": true, "top_k": 20},
"instructions": {"task": "retrieval_query"}
}
}'
FieldTypeDescription
statusstringready if the bucket returned context, otherwise empty.
operational_statusstringready, empty, indexing, or degraded.
bucket_idstringBucket that was searched.
querystringQuestion that was searched.
contextstringAnswer-ready context assembled from bucket content, with numbered citations such as [1].
citationsarraySource references for the returned context.
citations[].indexintegerCitation number used in context.
citations[].document_idstringDocument that supports this passage.
citations[].source_idstringUploaded source or file ID, when available.
citations[].titlestringHuman-readable source title.
citations[].source_urlstringSource URL, when available.
citations[].pageinteger | stringPage or location in the source.
citations[].sectionstringSection heading, when available.
warningsarrayReadiness, retrieval, or quality warnings.
warnings[].codestringStable machine-readable warning code.
warnings[].messagestringHuman-readable warning message.
warnings[].severitystringwarning or error.
{
"status": "ready",
"operational_status": "ready",
"bucket_id": "product-docs",
"query": "What changed in the enterprise plan?",
"context": "[1] Enterprise seats now include advanced audit logging. [2] The monthly seat limit was removed for annual contracts.",
"citations": [
{
"index": 1,
"document_id": "doc_042",
"source_id": "upload_123",
"title": "Pricing Notes",
"source_url": null,
"page": 4,
"section": "Enterprise",
"score": 0.91
},
{
"index": 2,
"document_id": "doc_055",
"source_id": "upload_124",
"title": "Contract Terms",
"source_url": null,
"page": 2,
"section": null,
"score": 0.87
}
],
"warnings": []
}
// 400 Bad Request — invalid filter
{
"detail": "Invalid filter: unsupported operator"
}
// 400 Bad Request — unsupported knowledge-search filter key
{
"error": "unsupported_knowledge_search_filter",
"message": "Knowledge search filters must use validated user metadata or documented system filter keys.",
"invalid_keys": ["internal_tag"]
}
// 402 Payment Required
{
"allowed": false,
"reason": "quota_exceeded"
}
// 403 Forbidden
{
"detail": "Search quota unavailable. Upgrade your plan."
}
// 404 Not Found
{
"detail": "Bucket 'product-docs' not found"
}

Check whether a bucket has searchable content before sending user traffic.

NameTypeDescription
bucket_idstringUUID or slug of the bucket to check.
Terminal window
curl ${API_BASE_URL:-https://api.schift.io}/v2/buckets/product-docs/search/status \
-H "Authorization: Bearer $SCHIFT_API_KEY"
FieldTypeDescription
statusstringready if the bucket has searchable content, otherwise empty.
operational_statusstringready, empty, indexing, or degraded.
bucket_idstringBucket that was checked.
indexed_countinteger | nullNumber of searchable content items.
document_countinteger | nullNumber of documents in this bucket.
pending_job_countinteger | nullDocuments still being prepared.
failed_job_countinteger | nullDocuments that need attention.
last_indexed_atstring | nullMost recent time content became searchable.
backfill_requiredbooleanWhether existing documents need preparation.
{
"status": "ready",
"operational_status": "ready",
"bucket_id": "product-docs",
"indexed_count": 1240,
"document_count": 42,
"pending_job_count": 0,
"failed_job_count": 0,
"last_indexed_at": "2026-06-18T09:12:34Z",
"backfill_required": false
}

The following endpoints are deprecated and should not be used in new integrations:

These routes expose lower-level retrieval mechanics. v2 intentionally hides that complexity behind the knowledge-search product API.