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 a knowledge graph, visual matches, video, text, 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.
API Parameters
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
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 Results
JSON Results
JSON output includes structured data for "Visual matches", "Knowledge graph", "Text results", "Related content" and "Reverse image search".
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
This API does not have the full html response. search_metadata.prettify_html_file
contains prettified version of result. It is displayed in playground.
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.
API Examples
Example with url: https://i.imgur.com/HBrB8p0.png
{
"search_metadata": {
"id": "6380ad5dde983400b1fa6938",
"status": "Success",
"json_endpoint": "https://serpapi.com/searches/f6000d11bb444c9d/6380ad5dde983400b1fa6938.json",
"created_at": "2022-11-25 11:56:13 UTC",
"processed_at": "2022-11-25 11:56: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",
"prettify_html_file": "https://serpapi.com/searches/f6000d11bb444c9d/6380ad5dde983400b1fa6938.prettify",
"total_time_taken": 2.75
},
"search_parameters": {
"engine": "google_lens",
"url": "https://i.imgur.com/HBrB8p0.png"
},
"knowledge_graph": [
{
"title": "Danny DeVito",
"subtitle": "American actor",
"link": "https://www.google.com/search?q=Danny+DeVito&kgmid=/m/0q9kd&hl=en&gl=US",
"more_images": {
"link": "https://www.google.com/search?q=Danny+DeVito&kgmid=/m/0q9kd&ved=0EOTpBwgAKAAwAA&source=.lens.button&tbm=isch&hl=en&gl=US",
"serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=google_images&gl=US&google_domain=google.com&hl=en&q=Danny+DeVito"
},
"thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRMLD_Ff8SPnXg5lP46m0Vq319gWJA33v2SM-95m01xm6ynHSNJrlFcyJNhydawpUpt_mU",
"images": [
{
"title": "Image #1 for Danny DeVito",
"source": "https://www.reddit.com/user/neodiogenes/",
"link": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQri_oPDW2JJmoPHi-uPQQi7ij4aC8zgojZhn9FOZ50Vh2HiLh-",
"size": {
"width": 310,
"height": 162
}
},
...
]
},
{
"title": "Tony DeVito",
"subtitle": "American professional wrestler",
"link": "https://www.google.com/search?q=Tony+DeVito&kgmid=/m/06g2j9&hl=en&gl=US",
"thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTmnVrAz0VBdVVT3yGFVsY9bicxyC0CZFBrrxG8P9PpliSr5hqEcQCasl0TZ_SuC1nVo0w",
"images": [
{
"title": "Image #1 for Tony DeVito",
"source": "https://dom2-tv.xyz/brian-devito-facebook.html",
"link": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQKkfXYfi_39BFVG4aXsoq3VBt3-l2p87KyRzD1KZbEJrQoaoZO",
"size": {
"width": 181,
"height": 278
}
},
...
]
},
{
"title": "Gage Skidmore",
"subtitle": "American photographer",
"link": "https://www.google.com/search?q=Gage+Skidmore&kgmid=/g/11crz_tb2h&hl=en&gl=US",
"thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQpi6H5mnWFrJKGhc6GNo8Or55e8SUZnfgMvNlXetPYSWQCg0dB",
"images": [
{
"title": "Image #1 for Gage Skidmore",
"source": "http://www.gageskidmore.com/",
"link": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQpi6H5mnWFrJKGhc6GNo8Or55e8SUZnfgMvNlXetPYSWQCg0dB",
"size": {
"width": 275,
"height": 183
}
},
...
]
}
],
"visual_matches": [
{
"position": 1,
"title": "File:Danny DeVito by Gage Skidmore.jpg - Wikipedia",
"link": "https://en.wikipedia.org/wiki/File:Danny_DeVito_by_Gage_Skidmore.jpg",
"source": "wikipedia.org",
"source_icon": "https://encrypted-tbn2.gstatic.com/favicon-tbn?q=tbn:ANd9GcRLIcgPlYxOaoBg0MnSobLYyflrgF_RLdwAY09AXHWGy2jqWQnuIBNCY5I1BuzY7jeAJga0y0b9htBHe94i3Pg4B0NhHMNDVsmS-FVRKL014d-Xf6sX",
"thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS_EZZflK6_1HccjH6c-eZbcBIqmW7CZi1EL6Nfjm-2iiJoE6Am"
},
{
"position": 2,
"title": "Danny DeVito gets his own day in his native New Jersey",
"link": "https://www.wowt.com/content/news/Danny-DeVito-gets-his-own-day-in-his-native-New-Jersey-481195051.html",
"source": "wowt.com",
"source_icon": "https://encrypted-tbn0.gstatic.com/favicon-tbn?q=tbn:ANd9GcSVS8rpJSkeh0oF49zOIkukNBkwhiOPhg25uAwQPduIqJjmu2tpFhgKz3uab91Zhvoei4tphrzYTCGGF2ifTsrhQiWZRLPjdGZDJcM5VQ-b3VM",
"thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQlRycvDiA1DhF7j8NtRoTpUOJNYzek1UML4jggGuegndiRzWNw"
},
{
"position": 3,
"title": "Danny Devito Earrings - Etsy Israel",
"link": "https://www.etsy.com/il-en/listing/857117638/danny-devito-earrings",
"source": "etsy.com",
"source_icon": "https://encrypted-tbn2.gstatic.com/favicon-tbn?q=tbn:ANd9GcSBC4oQ3bkBuevoH8XpxAl0ri8XiuLd4I543l3vUizk2p7JnS_Kl1aJTVxs9nt4vEC2m0siqwjI-o3Mysd9TaJqSrdOdkseIKFJA66bIfBIaDs",
"thumbnail": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcS3w5zFc3jROLJYb_b8lmPJRkmMQRxsngR4zxtpAKl-F83Y5sk0"
},
...
],
"reverse_image_search": {
"link": "https://www.google.com/search?tbs=sbi:AMhZZitM8l2rzmKo2mryfKQQ3vsvvac0sLKW6CjYJPr_109zyj0G3pP0hpVr9mxAcDyp6ZUtAZmz3--5Jg2K_1EfNMzRYsPDjZ2DNFZqWhXm_1CO9CMZCBwViH5oeybf-9uJcRHA-ibPhY-8-M07Avncl-zpMR5Mw6Xuw"
}
}
Example with knowledge_graph
{
...
"knowledge_graph": [
{
"title": "Statue of Liberty",
"subtitle": "Historical landmark",
"link": "https://www.google.com/search?q=statue+of+liberty&kgmid=/m/072p8&hl=en&gl=us",
"rating": 4.7,
"more_images": {
"link": "https://www.google.com/maps/uv?pb=!1s0x89c25090129c363d:0x40c6a5770d25022b!3m1!7e164&hl=en&viewerState=ga",
"serpapi_link": "https://serpapi.com/search.json?data_id=0x89c25090129c363d%3A0x40c6a5770d25022b%213m1%217e164&engine=google_maps_photos&hl=en"
},
"images": [
{
"title": "Image #1 for Statue of Liberty",
"source": "https://i.natgeofe.com/k/611a7aa1-57b3-4884-a2f6-2e0857c02257/united-states-statue-of-liberty-vertical.jpg?w=1084.125&h=1517.25",
"link": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSpO3-xbBSFs7rfZH_GBTIqUNE8olW-jH8_zM7awXNXssjCvjmJ",
"size": {
"width": 1084,
"height": 1517
}
},
{
"title": "Image #2 for Statue of Liberty",
"source": "https://www.google.com/search?q=Statue+of+Liberty&kgmid=/m/072p8&hl=en&gl=US",
"link": "https://lh5.googleusercontent.com/p/AF1QipOSbowFlywcnfBetYZK99hl9skuYWAjzcPPNSRB=w360-h240-k-no-pi-20.600374-ya357.52344-ro-0-fo100",
"size": {
"width": 5376,
"height": 2688
}
},
{
"title": "Image #3 for Statue of Liberty",
"source": "https://www.google.com/search?q=Statue+of+Liberty&kgmid=/m/072p8&hl=en&gl=US",
"link": "https://lh5.googleusercontent.com/p/AF1QipNOkjsKcMBL_Fia95bCQvwISPZBNG_Addfw3AYm=w360-h240-n-k-no",
"size": {
"width": 12240,
"height": 16320
}
},
...
]
}
],
...
}
Example with url: https://io.google/2021/assets/io_social_asset.jpg
{
...
"text_results": [
{
"query": "May",
"link": "https://www.google.com/search?q=May",
"serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=May"
},
{
"query": "18-20",
"link": "https://www.google.com/search?q=18-20",
"serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=18-20"
},
{
"query": "#Googlel",
"link": "https://www.google.com/search?q=#Googlel",
"serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=google&google_domain=google.com&q=%23Googlel"
},
...
],
"related_content": [
{
"query": "#googlel",
"link": "https://www.google.com/search?q=%23googlel&hl=en&gl=US",
"serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=google&gl=US&google_domain=google.com&hl=en&q=%23googlel"
}
],
...
}
Example: shopping_results
in Knowledge Graph
{
...
"knowledge_graph": [
{
"title": "Apple AirPods Max",
"rating": 4.6,
"reviews": 15,
"link": "https://www.google.com/search?q=Apple+AirPods+Max&kgmid=/g/11ll63vy_y&source=.lens.button&hl=en-US&gl=US",
"images": [
{
"title": "Image for Apple AirPods Max",
"source": "https://www.google.com/imgres?h=500&w=435&tbnh=241&tbnw=209&osm=1&hcb=1&source=lens-native&usg=AI4_-kRt4d1eQBzaFjNtgGmO5xaDlolzZw&imgurl=https://encrypted-tbn2.gstatic.com/images?q%3Dtbn:ANd9GcS9UFvH2to2PvFhp5CrmifSUdKwlClUt4Aj6jykSBch6F_ob8Qa&imgrefurl=https://www.cashconverters.co.uk/shop/music-tv--video/headphones--portable-equipment/headphones/headphones---cordless/016500219491&tbnid=DgYaYOFV5bsQiM&docid=YqrTN6BEi2yatM&hcb=1",
"link": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQNsBXB9NwfiYLfWOCkUx3ZRPbwh6WAcUw5oMn9i6I8IKi3UwXV",
"size": {
"width": 209,
"height": 241
}
}
],
"shopping_results": [
{
"source": "Sweetwater",
"source_logo": "https://encrypted-tbn2.gstatic.com/favicon-tbn?q=tbn:ANd9GcQ3j4Wus8gSlKXY2uMAIGxNU7kLWV19YgObpZloYUWeSbPwza8aMyzluMx1vi6KV88mn0uJg9K7bxC3SsFhBWGNQs2fYU_45QuOdjHM4PMywJV9Jtyk0HQ",
"price": "$549.00",
"extracted_price": 549,
"link": "https://www.sweetwater.com/store/detail/AirPodsMaxGr--apple-airpods-max-over-ear-bluetooth-headphone-space-gray",
"snippet": "1st offer for $549.00 from Sweetwater"
},
{
"source": "Best Buy",
"source_logo": "https://encrypted-tbn1.gstatic.com/favicon-tbn?q=tbn:ANd9GcQRElpIn0_ngPFmOJ5ZdW65M7G4nuI9MycoEeMitUDh35QpZN3krTU2tf03QRaenlaJn4hTIdv1gBd0yWlFCTuep64IeIo7wzb0RKajGmDwhoSbHbc",
"price": "$499.99",
"extracted_price": 499.99,
"link": "https://www.bestbuy.com/site/apple-airpods-max-space-gray/6373460.p?skuId=6373460",
"snippet": "2nd offer for $499.99 from Best Buy"
},
{
"source": "Amazon.com",
"source_logo": "https://encrypted-tbn1.gstatic.com/favicon-tbn?q=tbn:ANd9GcRm4oMDPHDSWBDQhB5-csYIdmVde_ZfnfUYnfzlJJ9w7zjXG34H4SL9TXI2H8XWInsqPagyhBQjtImrHgLv9Bwvw_d2JvfjMfz3ox9yR82MKQ7yrQ",
"price": "$36.99",
"extracted_price": 36.99,
"link": "https://www.amazon.com/Replacement-Earpads-Protein-Compatible-Headphones/dp/B09H4LQGQY",
"snippet": "3rd offer for $36.99 from Amazon.com"
}
]
}
],
...
}
Example with country: gb
(United Kingdom)
Searches made with country parameter return results with more localized data. For example, country=gb
will mostly return results with £ (British Pound).
{
...
"visual_matches": [
{
"position": 1,
"title": "Apple MacBook Pro 13\" Screen",
"link": "https://www.radiomusicstore.co.uk/apple-macbook-pro/p-3607",
"source": "Radio Music Store",
"source_icon": "https://encrypted-tbn3.gstatic.com/favicon-tbn?q=tbn:ANd9GcRwjzfyfVjHbnlbaPDwjt-d6YinnBqDKj1GC6ta9AN7IIykZDqE-undOMJoK-pAqx_lBOUesUmfdm5Klrwy5Q5oDYF4BglM5yymHUykfLB4w-v60lPc1goVrUQlWhoO",
"price": {
"value": "£1469.99*",
"extracted_value": 1469.99,
"currency": "£"
},
"thumbnail": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSGsNb4-lvu7a-Ro8gzcHfGFynyiZBaQbpXAm6dvS4Ay2Zhd0GH"
},
{
"position": 2,
"title": "Macbook pro 2022 512gb • Find (2 products) Klarna »",
"link": "https://www.klarna.com/us/shopping/sp/macbook-pro-2022-512gb/",
"source": "Klarna",
"source_icon": "https://encrypted-tbn0.gstatic.com/favicon-tbn?q=tbn:ANd9GcS-w3EjXoEvIugxq6XzwFA6qQ14KWczRDuphyFK-8eoI9OtVd3EaJi1rJ9SKFLSTA5HRvWAZNVIOkI-BxqBHtkrt5wmaFPHWqBKQUxLcbCojageeA",
"thumbnail": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcST-VMQAMoT0BPCcpMlXa_B2H4FK70HVPXr6EwkTjxlMLEHqzMr"
},
{
"position": 3,
"title": "Apple MacBook Pro 13\" M2 Chip (2022) 256GB SSD Silver | Harrods CO",
"link": "https://www.harrods.com/en-co/shopping/apple-macbook-pro-13-m2-chip-2022-256gb-ssd-silver-18602670",
"source": "Harrods",
"source_icon": "https://encrypted-tbn1.gstatic.com/favicon-tbn?q=tbn:ANd9GcQUxkytspUh8qCOUeghLOssHwqfUgTxDqT8JDX709SW_gF0MSWmUKjHtJinpT6Eq0xYIwDLRrQr9_-VRTzt79AiCFza6wc31VhGs9TScdCyI3ilGsc",
"thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSIoX610Hk4jfrnLXImWBfXyI1t6vzZBKyuVTEo68YkwGgFBBlR"
},
...
],
...
}
Example with video_results
{
...
"video_results": [
{
"title": "#playstation 🎮 #evolution",
"link": "https://www.youtube.com/watch?v=I1vZyUCNz7s",
"video_preview_link": "https://encrypted-vtbn1.gstatic.com/video?q=tbn:ANd9GcTuLeVzS--jkvx8rZQJpIgFsAWOIrOQJmOqHjew9saMgv5nv35Y",
"source": "youtube.com",
"source_icon": "https://encrypted-tbn0.gstatic.com/favicon-tbn?q=tbn:ANd9GcQHQslzHLLyLc_qne5jxn7JocidlmUPyegZ8ojX3WVlorFk8BxW9a3vJWjDzN99UHVTqSaNBj_-6XykhxuVQfF3Ye7xScSWSuc2QHXi0a12CkVwBmo",
"duration": "0:29",
"profile_name": "HYPER TIMELINE",
"thumbnail": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRjEm-u2PJWvIMGuW3fo9QzoE8fvVgBBUeG_33fL7ieHRuXaBkp",
"thumbnail_width": 168,
"thumbnail_height": 300
},
{
"title": "Playstation Controller Evolution",
"link": "https://www.youtube.com/watch?v=_Ns23n0Ckc8",
"video_preview_link": "https://encrypted-vtbn0.gstatic.com/video?q=tbn:ANd9GcSVv-iPYugFh289hb0RZMDcWbAnCQIceAXk3iH4JsylwLGHztXq",
"source": "youtube.com",
"source_icon": "https://encrypted-tbn0.gstatic.com/favicon-tbn?q=tbn:ANd9GcQHQslzHLLyLc_qne5jxn7JocidlmUPyegZ8ojX3WVlorFk8BxW9a3vJWjDzN99UHVTqSaNBj_-6XykhxuVQfF3Ye7xScSWSuc2QHXi0a12CkVwBmo",
"duration": "0:16",
"profile_name": "DR WHY TECH",
"thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQju_Sc-gJIVhJwo3_8LHbi1qzlfhm2WgWis9Ep1vAB_2TMtO95",
"thumbnail_width": 168,
"thumbnail_height": 300
},
{
"title": "#ps5 #ps5accessories #dualsense #mediaremoteps5 #ps5headset #ps5camera | TikTok",
"link": "https://www.tiktok.com/@ps5.official.page/video/6859291337619950853",
"video_preview_link": "https://encrypted-vtbn3.gstatic.com/video?q=tbn:ANd9GcTypvgVC31gPFNiqM4_dMP473Nyrv8nnxvh9CQW-mTH8s2tG0qP",
"source": "tiktok.com",
"source_icon": "https://encrypted-tbn3.gstatic.com/favicon-tbn?q=tbn:ANd9GcTiWsZg_7Q-8bAQYHlD9VtdBO8GLzYtDmFFmMRclrXQhRI17hRJ77T_Rc7VFiml61ZZKCAxlqLWhaBMeobWN_zExBK3t3LPjYWjTlpJS_fXur2RjQ",
"duration": "0:20",
"profile_name": "PlayStation 5",
"thumbnail": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTXB4NYxZ3YePo225pz9yV6XTmNmSZ5TjIOY5aB7VYHEGSX080q",
"thumbnail_width": 225,
"thumbnail_height": 225
},
...
],
...
}
JSON structure overview
{
...
"knowledge_graph": [
{
"title": "String - Title of the image",
"subtitle": "String - Subtitle of the image",
"rating": "Float - Rating of the item in the image",
"reviews": "Integer - Number of reviews of the item in the image",
"link": "String - URL to the Google knowledge graph search",
"more_images": {
"link": "URL to the Google images search",
"serpapi_link": "String - URL to the SerpApi images search"
},
"thumbnail": "String - URL to the image thumbnail",
"images": [
{
"title": "String - Title of the image",
"source": "String - Source URL of the website containing the image",
"link": "String - URL to the image",
"size": {
"width": "Integer - Width of the image",
"height": "Integer - Height of the image"
}
},
...
],
"shopping_results": [
{
"source": "String - Source name of the product website",
"source_logo": "String - Logo URL of the product website",
"price": "String - Price of the product",
"extracted_price": "Float - Extracted price of the product",
"link": "String - Direct link to the product website",
"snippet": "String - Description of the product"
},
...
]
},
...
],
"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"
},
"thumbnail": "String - URL to the image thumbnail",
"in_stock": "Boolean - Availability of the item in the image",
"condition": "String - Condition of the item in the image"
},
...
],
"video_results": [
{
"title": "String - Title of the video",
"link": "String - URL of the video",
"video_preview_link": "String - URL of the video preview",
"source": "String - The platform that the video is posted on",
"source_icon": "String - The icon of the platform",
"duration": "String - Duration of the video",
"profile_name": "String - The profile name of the user who posted the video",
"thumbnail": "String - Thumbnail of the video",
"thumbnail_width": "Integer - Width of the thumbnail",
"thumbnail_height": "Integer - Height of the thumbnail"
},
...
],
"text_results": [
{
"text": "String - Text extracted from the image",
"link": "String - URL to the Google search",
"serpapi_link": "String - URL to the SerpApi search"
},
...
],
"related_content": [
{
"query": "String - Related image query",
"link": "String - URL to the Google search",
"serpapi_link": "String - URL to the SerpApi search"
},
...
],
"reverse_image_search": {
"link": "String - URL to the Google Reverse Image search"
},
"image_sources_search": {
"page_token": "String - Page Token for Google Lens Image Sources API",
"serpapi_link": "String - SerpApi Google Lens Image Sources API's endpoint"
}
}