Search an assistant's passages
The passages of the assistant's resources that best match the question, best-matching document first, without an answer: for an agent or a pipeline whose own model reads them. 1 credit a search, whatever it finds; an assistant that reads no resource is refused first, for free. Same hybrid semantic and lexical search as a Flash answer (expanded to surrounding context, with the previous question included when you send history), so passages carry no numeric similarity score: read text to judge relevance. Nothing is stored. Send an Idempotency-Key header so a retried request is not charged twice.
POST/v1/assistants/{assistant_id}/search
Authorizations
Authorizationbearerin headerrequiredPath parameters
assistant_idstringrequiredpattern: ^ast_[abcdefghjkmnpqrstuvwxyz23456789]{12}$Header parameters
Idempotency-Keystringlength: 1–255 charsA unique key for this request, such as a UUID, 1 to 255 visible ASCII characters. Send the same key when you retry: the first response is returned (with Idempotent-Replayed: true) instead of running the request again, for 24 hours, per credential. The same key on a different request is a 409 conflict. A streamed answer is not recorded.
Body
application/jsonrequiredquestionstringrequiredlength: 1–4000 charsWhat to search for, in any language.
historyobject[]items: ≤ 20 itemsThe previous turns of your conversation, oldest first: the last question is searched with this one, so a follow-up ("and for Germany?") finds the right passages.
limitintegerrange: 1–20How many passages, 1 to 20 (default 8).
Response
Search an assistant's passages
dataobjectrequiredrequest_idstringrequiredPossible codes: invalid_request, unknown_field, invalid_parameter, invalid_cursor
errorobjectrequiredrequest_idstringrequiredPossible codes: authentication_required, invalid_api_key, api_key_expired, api_key_revoked, invalid_access_key
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_credits
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_scope, feature_not_available, admin_required, permission_denied
errorobjectrequiredrequest_idstringrequiredPossible codes: resource_not_found
errorobjectrequiredrequest_idstringrequiredPossible codes: conflict, assistant_has_no_resources
errorobjectrequiredrequest_idstringrequiredPossible codes: request_too_large
errorobjectrequiredrequest_idstringrequiredPossible codes: rate_limited
errorobjectrequiredrequest_idstringrequiredPossible codes: internal_error
errorobjectrequiredrequest_idstringrequiredPossible codes: service_unavailable
errorobjectrequiredrequest_idstringrequired