A SERP API returns structured information from a search engine results page. A query can produce organic links, titles, snippets and other supported result features. It helps an application discover candidate sources or monitor search results. It does not, by itself, read the full linked pages or prove that a snippet is a complete, current answer.
What the response represents
Treat a SERP response as a snapshot of a requested search context. Country, language, device and other supported controls can affect the result. Save the request parameters with the response when comparing repeated observations. A position in that response is not the same measure as a page’s average position across all GSC impressions.
Read the result array rather than the envelope
def result_links(envelope):
if envelope.get("code") != 0:
raise ValueError("Search did not succeed")
data = envelope.get("data")
if not isinstance(data, dict) or not isinstance(data.get("organic"), list):
raise ValueError("Wrong SERP envelope")
return [row["link"] for row in data["organic"]
if isinstance(row, dict) and isinstance(row.get("link"), str)]
if __name__ == "__main__":
sample = {"code":0, "data":{"organic":[
{"title":"Example source", "link":"https://example.com/", "snippet":"An excerpt"}]}}
print(result_links(sample))
This synthetic example uses the SearchCans Google Search response contract: data is an object, organic is the result list and link is the source URL. The function produces a URL list. Empty results are a possible output; a nonzero business code or a malformed list is a separate failure.
Search, reading and action are separate operations
| User needs | Operation | What to verify |
|---|---|---|
| Find sources for an unknown question | Search | Market, returned links and task relevance |
| Read a source whose URL is known | Page extraction | Required passages and provenance |
| Submit a form or change a record | Authorized browser or system action | Permissions, confirmation and post-action state |
An AI application may use one or more of these operations. Not every model response performs a web search, and a search API is not a substitute for tool authorization. For a cited answer, discover candidate URLs, read permitted sources, inspect the evidence, and then link each material claim to its source.
For choosing a service, start with the commercial Google Search API page. For system design use the agent web-access architecture; for Go implementation use the Go SERP client. This definition page explains the output and its limits rather than duplicating package selection or a broad vendor ranking.