SerpBase
Back to Blog

SERP API OpenAPI Spec: Generate a Google Search Client from openapi.json

The whole API as one OpenAPI 3 file: 59 paths with parameters, response schemas and credit prices. What is in it, two scripts that read it, and what generated clients get wrong.

November 28, 2026
By SerpBase Team3 min read

Short answer: the whole API is described in one OpenAPI 3 file at https://serpbase.dev/openapi.json. Feed it to a code generator, an API client such as Postman, or an agent framework that builds tools from a spec, and you get every endpoint with its parameters and response schema without copying anything by hand.

Fetch it

curl -s https://serpbase.dev/openapi.json -o serpbase-openapi.json

No key is needed to download the file.

What is in it

We downloaded it on 28 November 2026.

Spec versionOpenAPI 3.0.3
Size584,300 bytes
Paths59, all POST
Distinct products49
Schemas under components.schemas285
Serverhttps://api.serpbase.dev
Security schemeAPIKey: an API key in the X-API-Key header

There are more paths than products because some products answer on more than one address. Google Images, for example, is listed at both /google/images and /google/image/search.

Each operation has the usual operationId, summary, requestBody and responses, plus three extension fields that are useful in scripts:

FieldExample for /x/postWhat it is
operationIdx_postStable name; good for function names
x-product-idx_postThe product the path belongs to
x-credits-price1Credits charged per successful request

Across the 59 paths, 28 cost 1 credit, 29 cost 2, one costs 3 and one is free.

Python: list every endpoint and its price

import json, urllib.request

spec = json.load(urllib.request.urlopen("https://serpbase.dev/openapi.json"))

print(spec["openapi"], "-", len(spec["paths"]), "paths")
for path, item in sorted(spec["paths"].items()):
    op = item["post"]
    print(f'{op["x-credits-price"]}  POST {path:28} {op["summary"]}')

The first lines of our run:

3.0.3 - 59 paths
2  POST /ajio/product                Ajio Product Details
1  POST /amazon/autocomplete         Amazon Search Autocomplete
2  POST /amazon/product              Amazon Product Details

Python: build a tool definition for an agent

Most agent frameworks want a name, a description and a JSON schema for the arguments. All three are in the spec:

import json, urllib.request

spec = json.load(urllib.request.urlopen("https://serpbase.dev/openapi.json"))
op = spec["paths"]["/google/search"]["post"]
body = op["requestBody"]["content"]["application/json"]

tool = {
    "name": op["operationId"],          # google_web_search
    "description": op["summary"],       # Google Web Search
    "parameters": body["schema"],
}
print(tool["name"], "| example:", body["example"])

Our run printed google_web_search | example: {'device': 'mobile', 'gl': 'us', 'hl': 'en', 'q': 'coffee shops'}.

Things that trip people up

  • HTTP 200 is the only response in the spec, on purpose. Search answers are always HTTP 200; success or failure is the status field in the body (0 is success). A generated client that only checks the HTTP code will treat failures as successes. Add a status check to whatever the generator gives you.
  • The spec lists paused endpoints too. A path being in the file does not mean it is callable today. The product page for each endpoint says when one is paused.
  • Request bodies allow extra properties. The public endpoints ignore parameters they do not use rather than refusing them, and the schemas say so (additionalProperties: true). Strict generators may warn about that; it is intended.
  • The info.version changes when the catalog does. Ours read catalog-f25505cb0938. Store it next to generated code so you can tell when to regenerate.
  • Pick one path per product. If you generate a client from all 59 paths you get duplicate functions for the products with two addresses. Group by x-product-id and keep one.
  • We have not tested every generator. The file is plain OpenAPI 3.0.3 JSON; the two scripts above are what we ran.

Other machine-readable files

FileFor
/openapi.jsonCode generators and tool builders
/llms.txtA short index of the site for language models
/llms-full.txtEvery endpoint, parameter and response field in one text file
Any docs page plus .mdThat page as Markdown, e.g. /docs/google_web_search.md

Cost and limits

Reading the spec is free. Calls made with a generated client cost what the endpoint costs: a Google search is 1 credit, and credits cost $0.25–$0.50 per 1,000 depending on the plan. New accounts get 500 free credits without a card.