Google Lens API

Our Google Lens API allows you to scrape results from the Google Lens page when performing an image search. The results related to the image could contain visual matches and other data.

The API is accessed through the following endpoint: /search?engine=google_lens. A user may query the following: https://serpapi.com/search?engine=google_lens utilizing a GET request. Head to the playground for a live and interactive demo.

New Layout on Google Lens

Google has rolled out a new layout for Google Lens which has changed the type and structure of results returned.

As a result of this, only visual matches and related content items will be returned until we are able to extend support for the new layout.

API Parameters

Search Query

url

Required

Parameter defines the URL of an image to perform the Google Lens search.

Localization

hl

Optional

Parameter defines the language to use for the Google Lens search. It's a two-letter language code. (e.g., en for English, es for Spanish, or fr for French). Head to the Google languages page for a full list of supported Google languages.

country

Optional

Parameter defines the specific country location to use for the Google Lens search. It's a two-letter country code. (e.g., us for United States, fr for France, or de for Germany). Head to the Google Lens countries page for a full list of supported Google Lens countries.

Serpapi Parameters

engine

Required

Set parameter to google_lens to use the Google Lens API engine.

no_cache

Optional

Parameter will force SerpApi to fetch the Google Lens results even if a cached version is already present. A cache is served only if the query and all parameters are exactly the same. Cache expires after 1h. Cached searches are free, and are not counted towards your searches per month. It can be set to false (default) to allow results from the cache, or true to disallow results from the cache. no_cache and async parameters should not be used together.

async

Optional

Parameter defines the way you want to submit your search to SerpApi. It can be set to false (default) to open an HTTP connection and keep it open until you got your search results, or true to just submit your search to SerpApi and retrieve them later. In this case, you'll need to use our Searches Archive API to retrieve your results. async and no_cache parameters should not be used together. async should not be used on accounts with Ludicrous Speed enabled.

zero_trace

Optional

Enterprise only. Parameter enables ZeroTrace mode. It can be set to false (default) or true. Enable this mode to skip storing search parameters, search files, and search metadata on our servers. This may make debugging more difficult.

api_key

Required

Parameter defines the SerpApi private key to use.

output

Optional

Parameter defines the final output you want. It can be set to json (default) to get a structured JSON of the results, or html to get the raw html retrieved.

API Results

JSON Results

JSON output includes structured data for "Visual matches" and "Related content".

A search status is accessible through search_metadata.status. It flows this way: Processing -> Success || Error. If a search has failed, error will contain an error message. search_metadata.id is the search ID inside SerpApi.

HTML Results

HTML output is useful to debug JSON results or support features not supported yet by SerpApi.
HTML output gives you the raw HTML results from Google Lens.

API Examples

Example with url: https://i.imgur.com/HBrB8p0.png

Example with url: https://i.imgur.com/HBrB8p0.png

JSON Example

{
  "search_metadata": {
    "id": "6380ad5dde983400b1fa6938",
    "status": "Success",
    "json_endpoint": "https://serpapi.com/searches/f6000d11bb444c9d/6380ad5dde983400b1fa6938.json",
    "created_at": "2025-01-03 01:10:13 UTC",
    "processed_at": "2025-01-03 01:10:13 UTC",
    "google_lens_url": "https://lens.google.com/uploadbyurl?url=https://i.imgur.com/HBrB8p0.png",
    "raw_html_file": "https://serpapi.com/searches/f6000d11bb444c9d/6380ad5dde983400b1fa6938.html",
    "total_time_taken": 2.75
  },
  "search_parameters": {
    "engine": "google_lens",
    "url": "https://i.imgur.com/HBrB8p0.png"
  },
  "visual_matches": [
    {
      "position": 1,
      "title": "Danny DeVito — Wikipèdia",
      "link": "https://en.wikipedia.org/wiki/Danny_DeVito",
      "source": "Wikipedia",
      "source_icon": "https://serpapi.com/searches/6777d9c3c3b5a0ac7f1a42bc/images/a010fa01d135674248e5206802a18fa9a02a9ee7c2eacd0e143b39fa6fe2c735.png",
      "thumbnail": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR1_U0QyWS8IYr4VzfVX9CSvV_5NCeOvkvejcvNWuppNrJD4VEJ",
      "thumbnail_width": 245,
      "thumbnail_height": 206,
      "image": "https://upload.wikimedia.org/wikipedia/commons/2/21/Danny_DeVito_by_Gage_Skidmore.jpg",
      "image_width": 2216,
      "image_height": 1864
    },
    {
      "position": 2,
      "title": "Reveal all about Jackie Jackson - YouTube",
      "link": "https://www.youtube.com/watch?v=DijekY9jYAk",
      "source": "YouTube",
      "source_icon": "https://serpapi.com/searches/6777d9c3c3b5a0ac7f1a42bc/images/a010fa01d13567427aa89992990fe40fa1120f0c92a3b9855910d44e3f059421.png",
      "thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTaqmC3TCaRbjlCbE7RkwAjYTmUoAHdaM3HH9-q0Ja8PSOdeeKe",
      "thumbnail_width": 168,
      "thumbnail_height": 299,
      "image": "https://i.ytimg.com/vi/URMSh0gO_48/hq720.jpg?sqp=-oaymwEhCK4FEIIDSFryq4qpAxMIARUAAAAAGAElAADIQj0AgKJD&rs=AOn4CLALdJhqpbCqydHCAjSh_0_jx_CIcg",
      "image_width": 386,
      "image_height": 686
    },
    {
      "position": 3,
      "title": "✨Wiccan x Hulkling💚 on X: \"Danny DeVito y Joe Pesci rechazaron el papel de Iago. Finalmente el cómico Gilbert Gottfried fue quien le dió su voz y Danny daría la suya a Phil en Hercules años más tarde https://t.co/oarHZfEFLo\" / X",
      "link": "https://twitter.com/disneyfansontw1/status/1363894479825100800",
      "source": "X",
      "source_icon": "https://serpapi.com/searches/6777d9c3c3b5a0ac7f1a42bc/images/a010fa01d1356742bb4b23235244a6c457bac16f1bb318a131e937125502814b.png",
      "thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQZ_7u4RJS9XLT8AJW--iD67TeDmIs2ZSILFzvy-hleDueJZzNN",
      "thumbnail_width": 255,
      "thumbnail_height": 198,
      "image": "https://pbs.twimg.com/media/Eu2Gy8hXAAU_48Z.jpg",
      "image_width": 400,
      "image_height": 310
    },
    ...
  ],
  "related_content": [
    {
      "query": "Danny DeVito",
      "link": "https://lens.google.com/search?sca_esv=b9d59735341c7a85&hl=en&q=Danny+DeVito&kgmid=/m/0q9kd&sa=X&ved=2ahUKEwiKrva2yNmKAxUZTGwGHdTjAPQQ9_gLKAB6BQiJARAB",
      "thumbnail": "https://serpapi.com/searches/6777d9c3c3b5a0ac7f1a42bc/images/fbe7f81a6cec6c4671f9787e89ce797e072786289c7481dc36207997a4d6b5a0.jpeg",
      "serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&hl=en&kgmid=%2Fm%2F0q9kd&q=Danny+DeVito"
    }
  ]
}

Example with country: jp (Japan)

Searches made with country parameter return results with more localized data. For example, country=jp will mostly return results with ¥ (Japanese Yen).

Example with country: jp (Japan)

JSON Example

{
  ...
  "visual_matches": [
    {
      "position": 1,
      "title": "13インチMacBook Pro [整備済製品] 8コアCPUと10コアGPUを搭載したApple M2チップ - スペースグレイ - Apple(日本)",
      "link": "https://www.apple.com/jp/shop/product/G16S6J/A/Refurbished-13-inch-MacBook-Pro-Apple-M2-Chip-with-8‑Core-CPU-and-10‑Core-GPU-Space-Gray",
      "source": "Apple",
      "source_icon": "https://serpapi.com/searches/6777d881c3b5a0ac802e7c1c/images/db03bab616b5affda30c7b4c2aee1f2adae36e15b2d4412713e5d8c0b05ee082.png",
      "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ9l6Aka9uQF32Q89ldGHLvAPgctfOi96EQPi7YmttE1qdOhPoA",
      "thumbnail_width": 225,
      "thumbnail_height": 225,
      "image": "https://store.storeimages.cdn-apple.com/8567/as-images.apple.com/is/refurb-mbp13-m2-spacegray-202208?wid=1144&hei=1144&fmt=jpeg&qlt=90&.v=1659374923283",
      "image_width": 1144,
      "image_height": 1144
    },
    {
      "position": 2,
      "title": "MacBook Pro Retinaディスプレイ 13.3 MNEJ3J/A [スペースグレイ] : 4549995335798 : らいぶshop - 通販 - Yahoo!ショッピング",
      "link": "https://store.shopping.yahoo.co.jp/light-hikari/4549995335798.html",
      "source": "Yahoo! JAPAN",
      "source_icon": "https://serpapi.com/searches/6777d881c3b5a0ac802e7c1c/images/db03bab616b5affd2e5f37900058a53a2a314e0ee97a5719fa8c3951c93a2ea2.png",
      "price": {
        "value": "¥170,280*",
        "extracted_value": 170280,
        "currency": "¥"
      },
      "in_stock": true,
      "thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSGGNggAZyR6Ldk1b3UzlyC64ArZMD8c2Svvyudi4R6tWDc_D9S",
      "thumbnail_width": 225,
      "thumbnail_height": 225,
      "image": "https://item-shopping.c.yimg.jp/i/n/light-hikari_4549995335798",
      "image_width": 300,
      "image_height": 300
    },
    {
      "position": 3,
      "title": "Amazon.co.jp: 【整備済み品】 Apple MacBook Pro M2 2022 (13インチ,8GB RAM,256GB SSD,8コアCPU/10コアGPU) シルバー : パソコン・周辺機器",
      "link": "https://www.amazon.co.jp/Apple-MacBook-13インチ-8コアCPU-10コアGPU/dp/B0BCW2HQCC",
      "source": "Amazon.jp",
      "source_icon": "https://serpapi.com/searches/6777d881c3b5a0ac802e7c1c/images/db03bab616b5affda516499f5f22d89d746a2acd93358d2ec669d6afcc8980ec.png",
      "price": {
        "value": "¥169,000*",
        "extracted_value": 169000,
        "currency": "¥"
      },
      "condition": "Used",
      "thumbnail": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQBVDWGS0ii-BblP0avGtGvyCpDKPZahD_3GMNdeVHbXSTiNOxe",
      "thumbnail_width": 225,
      "thumbnail_height": 225,
      "image": "https://m.media-amazon.com/images/I/61vkJ9V6-dL.jpg",
      "image_width": 2560,
      "image_height": 2560
    },
    ...
  ],
  ...
}

JSON structure overview

{
  ...
  "visual_matches": [
    {
      "position": "Integer - Position of the image",
      "title": "String - Title of the image",
      "link": "String - Source URL of the website containing the image",
      "source": "String - Displayed URL of the website containing the image",
      "source_icon": "String - Icon URL of the source website containing the image",
      "rating": "Float - Rating of the item in the image",
      "reviews": "Integer - Number of reviews of the item in the image",
      "price": {
        "value": "String - Price of the item in the image",
        "extracted_value": "Float - Extracted price of the item in the image",
        "currency": "String - Price currency of the item in the image"
      },
      "in_stock": "Boolean - Availability of the item in the image",
      "condition": "String - Condition of the item in the image",
      "thumbnail": "String - URL to the image thumbnail",
      "thumbnail_width": "Integer - width of the image thumbnail",
      "thumbnail_height": "Integer - height of the image thumbnail",
      "image": "String - URL to the full image",
      "image_width": "Integer - width of the full image",
      "image_height": "Integer - height of the full image",
    },
    ...
  ],
  "related_content": [
    {
      "query": "String - Related image query",
      "link": "String - URL to the Google search",
      "thumbnail": "String - URL to the image thumbnail",
      "serpapi_link": "String - URL to the SerpApi search"
    },
    ...
  ]
}