Google Shopping Filters API

SerpApi Google Shopping API scrapes the type, text, and tbs of filters which are needed to narrow down the search results.
Google shopping supports list and grid layouts. You should use the tbs parameter to force a specific layout. Set tbs=vw:l to force list layout. Set tbs=vw:g to force grid layout.

JSON structure overview

{
  ...
  "filters": [
    {
      "type": "String - Block title (Ex: 'Shipping & returns')",
      "options": [
        {
          "text": "String - Filter name (Ex: 'Free returns')",
          "tbs": "String - tbs value (Ex: 'mr:1,free_return:1')"
        },
        ...
      ]
    },
    ...
  ],
  ...
}

API Examples

Results with tbs values

To apply filters for the Google Shopping search, you need to update the tbs parameter with the appropriate value. You can get the tbs values for each filter from the filters array in the JSON results for a Google Shopping API search.

Results with tbs values

JSON Example

{
  ...
  "filters": [
    {
      "type": "Show only",
      "options": [
        {
          "text": "Buy on Google",
          "tbs": "mr:1,buy:g"
        },
        {
          "text": "On sale",
          "tbs": "mr:1,sales:1"
        }
      ]
    },
    {
      "type": "Price",
      "options": [
        {
          "text": "Up to $200",
          "tbs": "mr:1,price:1,ppr_max:200"
        },
        {
          "text": "$200 – $400",
          "tbs": "mr:1,price:1,ppr_min:200,ppr_max:400"
        },
        {
          "text": "$400 – $800",
          "tbs": "mr:1,price:1,ppr_min:400,ppr_max:800"
        },
        {
          "text": "Over $800",
          "tbs": "mr:1,price:1,ppr_min:800"
        }
      ]
    },
    {
      "type": "Brand",
      "options": [
        {
          "text": "Samsung",
          "tbs": "mr:1,pdtr0:708987%7C709001"
        },
        {
          "text": "LG",
          "tbs": "mr:1,pdtr0:708987%7C708995"
        },
        {
          "text": "Hisense",
          "tbs": "mr:1,pdtr0:708987%7C1000526"
        },
        ...
      ]
    },
    ...
  ],
  ...
}

Results with  multiple filters  of the same type

The tbs parameter is constructed in the following manner:

mr:1 + prefix + : + filter-type + | + value

Note that the | symbol is displayed as %7C in the JSON.

To add multiple values of the same type (I.e multiple brands, or multiple colors) use the following format:

mr:1 + prefix + : + filter-type + | + first value + ! + second value + ! + third value

Google may use different formats for some filters. To quickly build your tbs value, or to examine how tbs values are put together for different filters, you can try a search in Google Shopping in your browser, select some filters, and extract the tbs value from the address bar.

Results with  multiple filters  of the same type

JSON Example

{
  ...
  "filters": [
    {
      "type": "Show only",
      "options": [
        {
          "text": "Buy on Google",
          "tbs": "mr:1,buy:g,pdtr0:708987%7C709001!708995!1000526"
        },
        {
          "text": "Available nearby",
          "tbs": "mr:1,local_avail:1,ss:55,pdtr0:708987%7C709001!708995!1000526"
        },
        {
          "text": "On sale",
          "tbs": "mr:1,sales:1,pdtr0:708987%7C709001!708995!1000526"
        }
      ]
    },
    {
      "type": "Brand",
      "options": [
        {
          "text": "Samsung",
          "tbs": "mr:1,pdtr0:708987%7C708995!1000526"
        },
        {
          "text": "LG",
          "tbs": "mr:1,pdtr0:708987%7C709001!1000526"
        },
        {
          "text": "Hisense",
          "tbs": "mr:1,pdtr0:708987%7C709001!708995"
        }
      ]
    },
    ...
  ],
  ...
}

Results with  multiple filters  of different types

The prefix is usually pdtr[n] where n is a number that starts with 0 and increments with each filter type you add. So to add two values for two different types of filters:

mr:1 + pdtr[n] + : + first-filter-type + | + first value +! + second value + , + pdtr[n + 1] + : + second-filter-type + | + first value + ! + second value

Note that the | symbol is displayed as %7C in the JSON.

Google may use different formats for some filters. To quickly build your tbs value, or to examine how tbs values are put together for different filters, you can try a search in Google Shopping in your browser, select some filters, and extract the tbs value from the address bar.

Results with  multiple filters  of different types

JSON Example

{
  ...
  "filters": [
    {
      "type": "Brand",
      "options": [
        {
          "text": "Samsung",
          "tbs": "mr:1,pdtr0:2622114%7C3964445"
        },
        {
          "text": "LG",
          "tbs": "mr:1,pdtr0:708987%7C709001!708995,pdtr1:2622114%7C3964445"
        },
        {
          "text": "Sony",
          "tbs": "mr:1,pdtr0:708987%7C709001!709004,pdtr1:2622114%7C3964445"
        },
        ...
      ]
    },
    {
      "type": "Display Type",
      "options": [
        {
          "text": "LED",
          "tbs": "mr:1,pdtr0:708987%7C709001"
        },
        {
          "text": "QLED",
          "tbs": "mr:1,pdtr0:708987%7C709001,pdtr1:2622114%7C3964445!3856195"
        },
        {
          "text": "OLED",
          "tbs": "mr:1,pdtr0:708987%7C709001,pdtr1:2622114%7C3964445!2622117"
        }
      ]
    },
    ...
  ],
  ...
}

Filtering by  multiple sellers

When listing multiple sellers, | is used to separate the values instead of !:

mr:1 + merchagg + : + first value + | + second value + | + third value

Google may use different formats for some other filters as well. To quickly build your tbs value, or to examine how tbs values are put together for different filters, you can try a search in Google Shopping in your browser, select some filters, and extract the tbs value from the address bar.

Filtering by  multiple sellers

JSON Example

{
  ...
  "filters": [
   {
      "type": "Shipping & returns",
      "options": [
        {
          "text": "Free returns",
          "tbs": "mr:1,merchagg:g113872638%7Cg7187155%7Cg784994%7Cm7388148%7Cm114193152%7Cm1311674%7Cm10046,free_return:1"
        },
        {
          "text": "Free shipping",
          "tbs": "mr:1,ship:1,merchagg:g113872638%7Cg7187155%7Cg784994%7Cm7388148%7Cm114193152%7Cm1311674%7Cm10046"
        }
      ]
    },
    {
      "type": "Product rating",
      "options": [
        {
          "text": "4 and up",
          "tbs": "mr:1,merchagg:g113872638%7Cg7187155%7Cg784994%7Cm7388148%7Cm114193152%7Cm1311674%7Cm10046,avg_rating:400"
        },
        {
          "text": "3 and up",
          "tbs": "mr:1,merchagg:g113872638%7Cg7187155%7Cg784994%7Cm7388148%7Cm114193152%7Cm1311674%7Cm10046,avg_rating:300"
        },
        {
          "text": "2 and up",
          "tbs": "mr:1,merchagg:g113872638%7Cg7187155%7Cg784994%7Cm7388148%7Cm114193152%7Cm1311674%7Cm10046,avg_rating:200"
        },
        ...
      ]
    },
    {
      "type": "Seller",
      "options": [
        {
          "text": "Amazon.com - Seller",
          "tbs": "mr:1,merchagg:g7187155%7Cg784994%7Cm1311674%7Cm10046"
        },
        {
          "text": "Best Buy",
          "tbs": "mr:1,merchagg:g113872638%7Cg784994%7Cm7388148%7Cm114193152%7Cm10046"
        },
        {
          "text": "Target",
          "tbs": "mr:1,merchagg:g113872638%7Cg7187155%7Cm7388148%7Cm114193152%7Cm1311674"
        },
        ...
      ]
    },
    ...
  ],
  ...
}