Google Custom Search Site Restricted JSON API

Google Custom Search Site Restricted JSON API help

Rate this article

Share this article

In this article, we will see how to use the Google custom search site restricted JSON API. For people looking to skip coding and directly implement a search for their websites, go herecustom search site restricted json api

Custom Search Engine offers very similar functionality to the Google Site Search but comes with a major disadvantage: ads. If you’re not a nonprofit or school then you’ll be stuck with ads. On the plus side, you can monetize the ads by connecting your Adsense account, but you’ll still likely be advertising for competitors. You can try search engines other than google that don’t track you

Custom Search Site Restricted JSON API  intro

Points to remember- (if you do not adhere to the following points your API might not return the search results)

  1. Google Custom Search Site Restricted JSON API is similar to the JSON custom search API.
  2. You can search within 10 or lesser websites using this API.
  3. No daily Query limit.
  4. Make sure that the “search the entire web” is set to OFF.

Create your google custom search from

Google Custom Search Site Restricted JSON API is of the following format-[parameters]


Query parameters

Here parameters could be –

  1. q– query string
  2. cx– Custom search engine ID.
  3. fileType– bmp, gif, jpg, png, pdf etc
  4. num-number of search results to display
  5. searchType- search type.
  6. sort-Sort by functionality to use.

Here are the list of all parameters-

custom search site restricted json api

On-site search is a crucial feature on a website. When your visitors are on your website, no matter how they arrived, they might want to explore more. Of course, a popular posts widget on the sidebar or related posts listed under every blog post will help them read more content and stay on your site for a long time. But what if they are looking for something really specific on your website? Learn how to add a search bar to your website in HTML

Sample API Call

Here is a sample api call to get search results-{your_api_key}&cx={custom_search_engine_id}&q={search_keyword}

Search results in JSON format

Here are the search results in JSON format-

   "kind": "customsearch#result",
   "title": "LinkedIn: Log In or Sign Up",
   "htmlTitle": "\u003cb\u003eLinkedIn\u003c/b\u003e: Log In or Sign Up",
   "link": "",
   "displayLink": "",
   "snippet": "500 million+ members | Manage your professional identity. Build and engage \nwith your professional network. Access knowledge, insights and opportunities.",
   "htmlSnippet": "500 million+ members | Manage your professional identity. Build and engage \u003cbr\u003e\nwith your professional network. Access knowledge, insights and opportunities.",
   "cacheId": "AszVZRcWxZEJ",
   "formattedUrl": "",
   "htmlFormattedUrl": "https://www.\u003cb\u003elinkedin\u003c/b\",
   "pagemap": {
    "metatags": [
      "referrer": "origin",
      "pageimpressionid": "b502334b-1c2a-442a-b05b-6883abbfb21b",
      "appname": "chrome",
      "pagekey": "uno-reg-guest-home",
      "treeid": "bjU+kvwgSRWw0apPLysAAA==",
      "globaltrackingurl": "//",
      "globaltrackingappname": "chrome",
      "globaltrackingappid": "webTracking",
      "msapplication-tileimage": "",
      "msapplication-tilecolor": "#0077B5",
      "application-name": "LinkedIn",
      "remotenavjscontentbaseurl": "",
      "lnkd-track-json-lib": "",
      "apphost": "seo-directory-frontend",
      "appversion": "0.1.343",
      "appinstance": "i002",
      "locale": "en_US",
      "baidu-site-verification": "bqQqxRHTnv",
      "detectadblock": "//"

Adding a search box to a website can quickly get tricky if not done right. Developing a search engine from scratch is never a good idea keeping in mind the cost and quality. Google’s own solution to this was GSS which got shut down and replaced by Google Custom Search. You can learn how to Google search specific website

Getting your custom search API Key-

How to get your custom search API Key-

  1. Go to
  2. Click on get  a key.
  3. Click create new project.
  4. This will generate your new API custom search site restricted json api

Getting your CX / Search engine ID:

Go to your custom search / site search control panel-> edit search engine->Basics->Details->Search engine ID.

custom search site restricted json api


Testing with Google API explorer

You can test you google custom search api using the google api explorer 

custom search site restricted json api

Read more on google search script


Expertrec’s Google custom search replacement API to overcome google custom search limitations

Go to  and enter your website and sitemap URLs to get your crawl done. Go and click on your demo link.

Add Search to your Website

Go to to get your API keycustom search site restricted json api

A static website with a dynamic search function? Yes, Hugo provides an alternative to embeddable scripts from Google or other search engines for static websites. Check out hugo themes with search

Expertrec custom search API format

The API will be of this format-{org_id}/?q={keyword}&page={pagination}&size={number_of_search_results}

Expertrec site search API parameters-

  1. org_id- Your unique ID that identifies your website/ websites.
  2. q- Keyword.
  3. page- pagination
  4. size- number of search results to be displayed.

The results will be in JSON format and will be similar to this screen shot-





               "How&#32;to&#32;<span class=highlight>create</span>&#32;<span class=highlight>a</span>&#32;wordpress&#32;custom&#32;<span class=highlight>search</span>&#32;&#45;&#32;2018&#32;Expertrec&#10;&#160;&#10;Support&#10;<span class=highlight>magento</span>&#10;<span class=highlight>search</span>&#32;engine&#10;Google&#32;site&#32;<span class=highlight>search</span>&#32;<span class=highlight>replacement</span>&#10;Expertec&#10;Toggle&#32;<span class=highlight>Navigation</span>&#10;How&#32;to&#32;<span class=highlight>create</span>&#32;<span class=highlight>a</span>&#32;wordpress&#32;custom&#32;<span class=highlight>search</span>&#10;Published&#32;by&#32;<span class=highlight>muthali</span>&#32;<span class=highlight>ganesh</span>&#32;on&#32;<span class=highlight>April</span>&#32;8&#44;&#32;2018&#10;<span class=highlight>Creating</span>&#32;wordpress&#32;custom&#32;<span class=highlight>search</span>&#32;using&#32;expertrec&#32;is&#32;<span class=highlight>as</span>&#32;<span class=highlight>easy</span>&#32;<span class=highlight>and</span>&#32;<span class=highlight>can</span>&#32;be&#32;<span class=highlight>taken</span>&#32;live&#32;in&#32;5&#32;minutes&#46;&#32;"

               "How&#32;to&#32;<span class=highlight>create</span>&#32;<span class=highlight>a</span>&#32;wordpress&#32;custom&#32;<span class=highlight>search</span>&#32;&#45;&#32;2018&#32;Expertrec"
         "title":"How to create a wordpress custom search - 2018 Expertrec",



Add Search to your Website

Did you know that the default WordPress search engine isn’t really that efficient (and awesome) as the rest of WordPress? Check out here how you can get WordPress advanced search plugin.

Google search script for sites is an easy and effective way to add search capabilities to your site. You can learn more about Google custom search JS examples

You can try how to turn off Ads in Google search to remove ads in GCS.

If your Google site search is not working you can refer Google custom search support to find a solution. 

Looking for how to add multiple websites in google custom search include sites in bulk

Sometimes you might want to see more than ten results on the Google SERP (Search Engine Results Page). Increasing the result count per page is pretty simple. You can read google custom search pagination to know how

You can also try searching multiple websites at once


Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like