Google Lens Scraper - A tool to scrape Google Lens visual search results with a simple API. Get visual matches, product information, exact matches, and AI-powered image analysis results.
We provide the results in a structured JSON format, eliminating the need for parsing, coding, proxies, or any other web scraping headaches for developers.
Using a simple GET request, you can retrieve Google Lens search results:
https://serpapi.com/search.json?engine=google_lens&url=https://example.com/image.jpg&api_key=YOUR_API_KEY
- Register for free at SerpApi to get your API Key
urlparameter: defines the URL of an image to perform the Google Lens search.typeparameter (optional): specifies search category (all,products,visual_matches,exact_matches).
Here are some code examples based on your favorite programming languages.
curl --get https://serpapi.com/search \
-d engine="google_lens" \
-d url="https://example.com/image.jpg" \
-d api_key="secret_api_key"Step 1:
Create a new main.py file.
Step 2: Install requests package with:
pip install requests
Step 3: Add this code to your file:
import requests
SERPAPI_API_KEY = "YOUR_SERPAPI_API_KEY"
params = {
"api_key": SERPAPI_API_KEY,
"engine": "google_lens",
"url": "https://example.com/image.jpg"
}
search = requests.get("https://serpapi.com/search", params=params)
response = search.json()
print(response)If you're only interested in the visual_matches, you can print them from the response directly:
print(response["visual_matches"])Step 1: Install the SerpApi JavaScript package:
npm install serpapi
Step 2:
Create a new index.js file.
Step 3: Add this to your file:
const { getJson } = require("serpapi");
getJson({
api_key: API_KEY,
engine: "google_lens",
url: "https://example.com/image.jpg"
}, (json) => {
console.log(json["visual_matches"]);
});While you can use our APIs using a simple GET request with any programming language, you can also see our ready-to-use libraries here: SerpApi Integrations.
Please find the parameters for the Google Lens API below:
| Name | Description | Requirement |
|---|---|---|
| url | Parameter defines the URL of an image to perform the Google Lens search | Required |
| Search Type | ||
| type | Parameter defines the search type: all (default), about_this_image, products, exact_matches, visual_matches |
Optional |
| Localization | ||
| hl | Parameter defines the two-letter language code (e.g., en, es, fr) |
Optional |
| country | Parameter defines the two-letter country code for localized results | Optional |
| Filters | ||
| q | Parameter defines a search query to refine results | Optional |
| safe | Parameter defines content filtering: active or off |
Optional |
| Advanced | ||
| no_cache | Parameter to force fresh results | Optional |
Visit our documentation for more information on all available parameters.
Google Lens can return different information from time to time. Here is what the visual_matches array may contain:
"visual_matches": [
{
"position": "Integer - Position of the result",
"title": "String - Title of the matching result",
"link": "String - URL to the source page",
"source": "String - Source website name",
"thumbnail": "String - URL to the thumbnail image",
"image": "String - URL to the full image",
"rating": "Float - Product rating (if applicable)",
"reviews": "Integer - Number of reviews (if applicable)",
"price": {
"value": "Float - Numeric price value",
"currency": "String - Currency code",
"extracted_value": "Float - Extracted numeric price"
},
"in_stock": "Boolean - Whether the product is in stock"
}
],The API response also includes:
related_content: Related search queries and suggestionsai_overview: AI-generated summary (when available)
Here are some use cases for the Google Lens API:
- Build visual search applications to identify products from images.
- Create price comparison tools by searching for products using images.
- Build plant, animal, or object identification apps.
- Create reverse image search tools for content verification.
- Build shopping apps that let users search by taking photos.
- Identify artwork, landmarks, or text from images.
- Scraping Google Lens' (visual and exact matches)
- Scrape Google Lens with Python
- How to Scrape Google Lens Results
Interesting use cases:
- Build "Plant Identifier" app with Google Lens API
- Building an Image Search Engine app with Google Lens API
- Uploading Images and Searching with Google Lens via SerpApi
Feel free to reach out via contact@serpapi.com.
Check other Google Scrapers from SerpApi.
