Google Search API — Parse a Google Search URL
Documentation menu
FetchLayer FetchLayer API

Parse a Google search URL

Turn a Google URL into the request fields it encodes, without contacting Google. A search results URL, on any Google domain (google.de/search?q=wetter+berlin&hl=de&start=10&tbs=qdr:w), comes back as kind: "search" with its query, country, language, location, page, safe search, time range, the results tab when it is not web results (vertical, e.g. news or images) and the Google domain — ready to send to search. A Google redirect link that names its destination comes back as kind: "redirect" with where it leads in target. Fields the URL does not carry are null. Any other URL is a 400 saying why. Parsing a URL does not consume a credit.

POST /resolve-url Utility
https://api.fetchlayer.dev/google-search/resolve-url
OpenAPI JSON

Headers

Authorization string required

Bearer token — your FetchLayer API key.

Parameters

url string required

A Google search results URL, or a Google redirect link.

format string optional

json or markdown. (default: json)

timeoutMs number optional

Time limit for each result page read, in milliseconds (1000–60000).

Response Fields

resolve-url

Parse a Google search URL

kind string

search or redirect.

url string

The URL you sent.

query string

The query the URL carries, or null. Pass it to search.

country string

The country (gl) the URL carries, or null.

language string

The language (hl) the URL carries, or null.

location string

The location the URL carries, or null.

page number

The result page the URL points at, or null.

safeSearch string

on or off when the URL sets it, or null.

timeRange string

hour, day, week, month, year or any when the URL sets it, or null.

vertical string

A results tab other than web results, e.g. news or images, or null.

googleDomain string

The Google domain the URL is on, e.g. google.de.

target string

For a redirect link, where it leads; otherwise null.

Request

curl -X POST "https://api.fetchlayer.dev/google-search/resolve-url" \
  -H "Authorization: Bearer ss-your-key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.google.de/search?q=wetter+berlin&hl=de&start=10&tbs=qdr:w"}'

Response

{
  "url": "https://www.google.de/search?q=wetter+berlin&hl=de&start=10&tbs=qdr:w",
  "googleDomain": "google.de",
  "query": "wetter berlin",
  "country": "de",
  "language": "de",
  "location": null,
  "page": 2,
  "safeSearch": null,
  "timeRange": "week",
  "vertical": null,
  "target": null,
  "kind": "search"
}