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, 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.
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.
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
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"
},
...
],
"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"
}
}
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 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"
}
]
}
],
...
}