Skip to main content
The Answer API is deprecated and sunsets on December 17, 2026. See Migrate from Answer.
The Answer API searches relevant sources and synthesizes a cited answer in one call. It supports streaming and non-streaming modes (non-streaming by default).

Basic usage

Keep the returned source URLs with the answer so users can inspect the evidence. Citations identify sources; they do not establish that every generated claim is correct.

Common patterns

Structured output

Pass a JSON schema to structuredOutput and response.contents comes back as a structured object instead of a string. Detect it with typeof response.contents === "object":

Streaming

Set streaming: true to receive the answer progressively as an async generator of typed chunks:
For open-ended, multi-step work (reports, diligence, deliverables), reach for DeepResearch instead of Answer.

Reference

query (string, required) - the question to answer.