Google Shopping Light Filters API

SerpApi Google Shopping Light API scrapes the text, and tbs of filters which are needed to narrow down the search results.

API Examples

Results for: macbook

Results for: macbook

JSON Example

{
  ...
  "filters": [
    {
      "type": "Mixed Options",
      "options": [
        ...
        {
          "text": "Free returns",
          "tbs": "mr:1,free_return:1"
        },
        {
          "text": "On sale",
          "tbs": "mr:1,sales:1"
        },
        {
          "text": "Mac OS",
          "tbs": "mr:1,pdtr0:703981%7C703985"
        },
        ...
      ]
    }
  ],
  ...
}

Applying one filter

To apply filters for the Google Shopping Light 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 Light API search.
The applied filter will include the tbs parameter to allow for filter removal.

Applying one filter

JSON Example

{
  ...
  "filters": [
    {
      "type": "Mixed Options",
      "options": [
        {
          "text": "Free returns",
          "tbs": "mr:1"
        },
        {
          "text": "On sale",
          "tbs": "mr:1,sales:1,free_return:1"
        },
        {
          "text": "Mac OS",
          "tbs": "mr:1,free_return:1,pdtr0:703981%7C703985"
        },
        ...
      ]
    }
  ],
  ...
}

Applying  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 Light in your browser, select some filters, and extract the tbs value from the address bar.

Applying  multiple filters  of the same type

JSON Example

{
  ...
  "filters": [
    {
      "type": "Mixed Options",
      "options": [
        {
          "text": "USB-C",
          "tbs": "mr:1,pdtr0:4094604%7C4094610"
        },
        {
          "text": "3.5 mm Jack",
          "tbs": "mr:1,pdtr0:4094604%7C4094606"
        },
        {
          "text": "On sale",
          "tbs": "mr:1,sales:1,pdtr0:4094604%7C4094606!4094610"
        },
        ...
      ]
    }
  ],
  ...
}

Applying  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 Light in your browser, select some filters, and extract the tbs value from the address bar.

Applying  multiple filters  of different types

JSON Example

{
  ...
  "filters": [
    {
      "type": "Mixed Options",
      "options": [
        {
          "text": "Silver",
          "tbs": "mr:1,pdtr0:4094604%7C4094606"
        },
        {
          "text": "USB-C",
          "tbs": "mr:1,pdtr0:1716119%7C1716122"
        },
        {
          "text": "On sale",
          "tbs": "mr:1,sales:1,pdtr0:4094604%7C4094606,pdtr1:1716119%7C1716122"
        },
        ...
      ]
    }
  ],
  ...
}

JSON structure overview

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