If you are building a research pipeline, collecting public government reports, or pulling open datasets, Google's filetype: operator is one of the fastest ways to locate actual .pdf and .xlsx files instead of landing pages. Calling it through /google/search gives you those document links as structured JSON without needing any extra query parameters—just include filetype:pdf or filetype:xlsx inside q.
One request (and why device layout matters)
curl -X POST 'https://api.serpbase.dev/google/search' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY' \
-d '{"q":"climate change annual report filetype:pdf","gl":"us","hl":"en"}'
When we ran that query on November 30, 2026, two things stood out between mobile and desktop layouts:
- Default phone layout: returned 10 organic results, all genuine PDF reports from government and research organizations (Maryland Commission on Climate Change, Climate Change Authority Australia, IPCC AR6, WMO, UNFCCC, Columbia Law School, etc.).
-
Desktop layout (
"device": "desktop"): returned "About 88 results", with PDFs in positions 1 and 2, but mixed a YouTube video into rank 3 and a Google Books page into rank 9.
Google treats filetype: more loosely on desktop, so leaving device on its default phone layout and verifying the file extension in code gives much cleaner document lists.
Python: fetch and filter real PDF or XLSX links
import os
import requests
API_KEY = os.environ["SERPBASE_API_KEY"]
def find_files(topic: str, ext: str = "pdf") -> list[dict]:
r = requests.post(
"https://api.serpbase.dev/google/search",
headers={"X-API-Key": API_KEY},
json={"q": f"{topic} filetype:{ext}", "gl": "us", "hl": "en"},
timeout=60,
).json()
if r.get("status") != 0:
raise RuntimeError(r.get("error"))
suffix = f".{ext.lower()}"
return [
o for o in r.get("organic", [])
if o.get("url", "").lower().split("?")[0].endswith(suffix)
]
pdfs = find_files("climate change annual report", "pdf")
for item in pdfs:
print(f"#{item['rank']:>2} | {item['title']} -> {item['url']}")
print(f"Matched {len(pdfs)} direct PDF links")
Swapping the extension to xlsx works the same way: "us population by state filetype:xlsx" returned 10 spreadsheets on November 30, 2026, prefixed with Google's [XLS] label (starting with www2.census.gov).
Three small gotchas to watch
-
No space after the colon. Writing
filetype: pdfmakes Google treat them as two plain words instead of an operator. -
Always check the URL extension (and handle
google.com/gotowrappers). Strip query strings before checking.endswith(".pdf"). If an item'surlis agoogle.com/gotowrapper,display_linkstill tells you the host domain. -
Result counts are rough estimates.
"About 88 results"is Google's rounding, not an exact page-through total.
Full test payloads and field notes are documented in the google filetype search api walkthrough.
Top comments (0)