POST/vector_stores/{vector_store_id}/search

Search a vector store

Searches a vector store for relevant file chunks using one or more queries and optional file-attribute filters. Set max_num_results to control the result count and ranking_options to configure ranking; use next_page to continue when more results are available.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 5 body fields
vector_store_idstringrequired
The unique identifier of the vector store to search.

Search query and optional controls for filtering, result count, and ranking.

querystringrequired
A query string for a search
rewrite_querybooleanoptional
Whether to rewrite the natural language query for vector search.
Default:false
max_num_resultsintegeroptional
The maximum number of results to return. This number should be between 1 and 50 inclusive.
Default:10
filtersobjectoptional
A filter to apply based on file attributes.
ranking_optionsobjectoptional
Ranking options for search.

4 status codes
200Returns the search queries used, matching result items, and pagination information including `has_more` and `next_page`.
objectstringrequired
The object type, which is always `vector_store.search_results.page`
Allowed:vector_store.search_results.page
search_queryarray<string>required
dataarray<object>required
The list of search result items.
has_morebooleanrequired
Indicates if there are more results to fetch.
next_pagestringrequired
The token for the next page, if any.
400Returned when the search input or filters are invalid, or the vector store has expired.
errorobjectrequired
404Returned when the vector store does not exist.
errorobjectrequired
429Returned when the request exceeds a rate limit.
errorobjectrequired

Error handling

A 400 is returned when the search input or filters are invalid, or the vector store has expired; a 404 is returned when the vector store does not exist; and a 429 indicates a rate limit. The vector_store_id path parameter must identify the store, and query is required; if query is an array, it must contain at least one string. max_num_results must be from 1 to 50, ranker must be none, auto, or default-2024-11-15, and score_threshold must be from 0 to 1.