Search Chunks
Perform semantic search across store chunks. This endpoint searches through store chunks using semantic similarity matching. It supports complex search queries with filters and returns relevance-scored results.
ApiKeyAuthAuthorizationBearer <token>Api key to access Mixedbreads API
X-Mxbai-Tool-Ticket?|Ticket from a chat completion's tool_tickets, proving this call runs a tool call that completion asked for. Redeems once, and bills the operation at the discounted agent rate.
application/json- body
Search parameters including query text, filters and pagination options
store_identifiers*array<string|>IDs or names of stores
1 <= items <= 64top_k?Top KNumber of results to return
1 <= value <= 1000010filters?||array<|>|Optional filter conditions
file_ids?array<any>|array<>|Optional list of file IDs to filter chunks by (inclusion filter)
query*||Search query text
search_options?Search configuration options
stream?StreamWhen true, return the search as a server-sent event stream: live agentic-search trace events when the search is agentic, and nothing before the results otherwise. A successful stream ends with a search.completed event containing the final search response, followed by [DONE].
falseList of semantically similar chunks with relevance scores and pagination details
- response
object?ObjectThe object type of the response
"list"data*array<|||>The list of scored store file chunks
[key: string]?anyfrom mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
response = mxbai.stores.search(
query="How does authentication work?",
store_identifiers=["my-knowledge-base"],
top_k=5,
)
for chunk in response.data:
print(chunk){
"object": "list",
"data": [
{
"chunk_index": 0,
"mime_type": "text/plain",
"model": "mxbai-omni",
"score": 0.8512,
"file_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"filename": "auth_guide.pdf",
"store_id": "c3d4e5f6-a7b8-9012-cdef-345678901234",
"metadata": {
"source": "upload",
"page": 1
},
"type": "text",
"text": "Authentication is handled through JWT tokens. First, the user provides credentials..."
},
{
"chunk_index": 2,
"mime_type": "image/jpeg",
"model": "mxbai-omni",
"score": 0.8234,
"file_id": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
"filename": "security_diagram.pdf",
"store_id": "c3d4e5f6-a7b8-9012-cdef-345678901234",
"metadata": {
"category": "security",
"year": 2024
},
"type": "image_url",
"image_url": {
"url": "https://example.com/auth-flow.jpg",
"format": "jpeg"
},
"ocr_text": "Authentication Flow Diagram",
"summary": "A diagram showing the OAuth 2.0 authentication flow"
}
]
}Streaming events
When you search chunks with search_options.agentic: true and stream: true,
the server emits server-sent events as the Agentic Search runs. This section
contains the events emitted by the server.
search.started
Emitted when the Agentic Search starts.
Prop
Type
{
"type": "search.started",
"started_at": "2026-08-19T12:00:00Z",
"query": "How did revenue change from 2024 to 2025?"
}tool_call.started
Emitted when the agent starts a retrieval, metadata, or generation step.
Prop
Type
{
"type": "tool_call.started",
"tool_call_id": "live-a1b2c3d4e5f6",
"tool_name": "search_corpus",
"started_at": "2026-08-19T12:00:00.120Z",
"arguments": {
"query": "2025 annual revenue",
"top_k": 10
}
}tool_call.completed
Emitted when a retrieval, metadata, or generation step finishes. The
tool_call_id matches the preceding tool_call.started event.
Prop
Type
Fields of tool_call:
Prop
Type
{
"type": "tool_call.completed",
"tool_call": {
"tool_call_id": "live-a1b2c3d4e5f6",
"tool_name": "search_corpus",
"tool_type": "function",
"started_at": "2026-08-19T12:00:00.120Z",
"duration": "PT0.42S",
"arguments": {
"query": "2025 annual revenue",
"top_k": 10
},
"result": {
"result_count": 10
},
"error": null,
"error_kind": null
}
}search.completed
Emitted when the Agentic Search succeeds. Its response field contains the
final search response and the authoritative trace for the completed run.
After this event, the server emits data: [DONE] and closes the stream.
Prop
Type
{
"type": "search.completed",
"response": {
"object": "list",
"data": [],
"trace": {
"started_at": "2026-08-19T12:00:00Z",
"search_time": "PT1.84S",
"query": "How did revenue change from 2024 to 2025?",
"instructions": null,
"rounds_executed": 1,
"tool_calls": [],
"results": []
}
}
}search.failed
Emitted when the Agentic Search stops with an error. The stream closes after
this event and does not emit [DONE].
Prop
Type
{
"type": "search.failed",
"error": "The search could not be completed."
}