Skip to Content
Mixedbread

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.

POST
/v1/stores/search

Authorization

ApiKeyAuth
headerAuthorizationBearer <token>

Api key to access Mixedbreads API

Header Parameters

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.

Request Body

application/json
  1. body

Search parameters including query text, filters and pagination options

store_identifiers*array<string|>

IDs or names of stores

Items1 <= items <= 64
filters?||array<|>|

Optional filter conditions

file_ids?array<any>|array<>|

Optional list of file IDs to filter chunks by (inclusion filter)

query*||

Search query text

top_k?|

Maximum number of results to return. When omitted or null, agentic search returns all chunks selected by the agent without a final-result cap; non-agentic search returns up to 10. Required when strict_top_k is true.

search_options?

Search configuration options

stream?Stream

When 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].

Defaultfalse

Response Body

List of semantically similar chunks with relevance scores and pagination details

  1. response
object?Object

The object type of the response

Default"list"
data*array<|||>

The list of scored store file chunks

[key: string]?any
Example Request
from 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)
Example Response
{
  "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

search.started
{
  "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

tool_call.started
{
  "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

tool_call.completed
{
  "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

search.completed
{
  "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

search.failed
{
  "type": "search.failed",
  "error": "The search could not be completed."
}