Skip to main content
POST /v1/responses Add a web_search entry to the tools array. The model requests a search, and the results are returned to the model so it can use them in its answer.

Request

Accepted type aliases: web_search, web_search_preview, web_search_2025_08_26, web_search_preview_2025_03_11.

Select a tool

Use string values for "auto", "required", and "none". To select web search specifically, set:
Requiring a search does not run it before the model starts. The model first generates the search request, then uses the results to continue its response.

Restrict search domains

Set filters.allowed_domains on the web-search tool:
Use domain names such as iana.org, without http:// or https:// prefixes. Project domain policies also apply:
  • If both the project and request specify allowed domains, searches use their intersection. A request with no permitted overlap returns 400.
  • If the request omits allowed domains, the project’s allow list still applies.
  • Project blocked domains apply to every search. The request filter supports only allowed_domains.

Streaming

Set stream=True to receive server-sent events. Search results appear as web_search_call output items, and the answer arrives as text deltas. These are the main events to handle, not an exhaustive sequence. A search item can already have status: "completed" when it is added. Do not depend on receiving separate response.web_search_call.in_progress, response.web_search_call.searching, or response.web_search_call.completed events. Use item IDs to reconcile streamed items with the final response. The final output contains the same items; appending it to the streamed output can duplicate the answer.

Streaming errors

HTTP 200 means the stream opened. The request can still fail with an error event, including when a request parameter is invalid. An error is not a completed response, and the stream can end without response.completed. Handle errors as you read the stream. If it closes without response.completed, response.incomplete, or an error, treat the response as interrupted. See API errors for general error handling.
Last modified on September 7, 2026