Google Search

Search Google and retrieve web search results in JSON format.

Endpoint

GET /v1/search/{query}

Description

The Google Search endpoint allows you to perform web searches and retrieve results from Google. The query parameter should be a URL-encoded query string that follows Google's search parameter format.

For reference on Google search parameters, check out our Google Search Operators guide.

Authentication

All requests require authentication using the X-Api-Key header. See the Authentication guide for more details.

Path Parameters

query (required)

Type: string

A URL-encoded query string. This should follow Google's search parameter format.

Examples:

  • q=search+api
  • q=search+api&num=100

Request Headers

X-Proxy-Location (optional)

Type: string

Specify the proxy location for the search. This determines the geographic location from which the search is performed.

Allowed values:

  • EU - European Union
  • CA - Canada
  • US - United States
  • IE - Ireland
  • GB - United Kingdom
  • FR - France
  • DE - Germany
  • SE - Sweden
  • IN - India
  • JP - Japan
  • KR - South Korea
  • SG - Singapore
  • AU - Australia
  • BR - Brazil

X-User-Agent (optional)

Type: string

Specify the device type for the search. Defaults to desktop if not provided.

Allowed values:

  • desktop - Desktop browser (default)
  • mobile - Mobile device

Request Example

Using cURL

curl --request GET \
  --url 'https://api.serply.io/v1/search/q=search+api' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'X-Proxy-Location: US' \
  --header 'X-User-Agent: desktop' | jq

Using JavaScript/Node.js

const response = await fetch('https://api.serply.io/v1/search/q=search+api', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'X-Proxy-Location': 'US',
    'X-User-Agent': 'desktop'
  }
});
const data = await response.json();
console.log(data);

Using Python

import requests

headers = {
    'X-Api-Key': 'YOUR_API_KEY',
    'X-Proxy-Location': 'US',
    'X-User-Agent': 'desktop'
}

response = requests.get(
    'https://api.serply.io/v1/search/q=search+api',
    headers=headers
)
data = response.json()
print(data)

Response

The API returns a JSON object containing an array of search results.

Response Structure

{
  "results": [
    {
      "title": "Result Title",
      "link": "https://example.com",
      "description": "Result description text..."
    }
  ],
  "total": 1840000000,
  "answer": null
}

Response Fields

  • results (array): An array of search result objects
    • title (string): The title of the search result
    • link (string): The URL of the search result
    • description (string): The description/snippet of the search result
  • total (number): The total number of search results available
  • answer (array[string] | null): Optional answer box content, if available

Example Response

{
  "results": [
    {
      "title": "Custom Search JSON API | Google Developers",
      "link": "https://developers.google.com/custom-search/v1/overview",
      "description": "Jun 11, 2019 - The Custom Search JSON API lets you develop websites and applications to retrieve and display search results from Google Custom Search ..."
    },
    {
      "title": "Using REST to Invoke the API | Custom Search | Google ...",
      "link": "https://developers.google.com/custom-search/v1/using_rest",
      "description": "As a result, the API provides a single URI that acts as the service endpoint. You can retrieve results for a particular search by sending an HTTP GET request to its ..."
    }
  ],
  "total": 1840000000,
  "answer": null
}

Status Codes

  • 200 OK - Successful response
  • 404 Not Found - The requested resource was not found
  • 422 Unprocessable Entity - The request was well-formed but contains semantic errors
  • 429 Too Many Requests - Rate limit exceeded

Error Responses

See the Errors guide for information on error response formats.