Google Lens API
The Google Lens API enables reverse image search functionality through Scrapingdog, supporting product results, visual matches, and exact matches from Google Lens. Costs 5 API credits per request.
Endpoint:
https://api.scrapingdog.com/google_lensAPI Parameters
π
Authentication
api_keyRequiredThis is your API key.
Type: StringurlRequiredThe Google Lens URL.
Type: String
π
Search Query
queryOptionalThe parameter specifies the search query you want to execute, just like a standard Google search. Example1 -query=pizza
Type - String
π
Geographic Location and Localization
countryOptionalThis is the ISO code of the country from which you are seeking Google Lens results.
Default Value -us
Type - StringlanguageOptionalLanguage of the results. Possible Values -en,es,fr,de, etc.
Default Value -en
Type - String
β
οΈ Result Type Parameters
productOptionalThis parameter is used to get product results from Google Lens. Set ittrueto enable it.
Default Value -false
Type: Stringvisual_matchesOptionalThis parameter is used to get visual match results from Google Lens. Set ittrueto enable it.
Default Value -false
Type: Stringexact_matchesOptionalThis parameter is used to get exact match results from Google Lens. Set ittrueto enable it.
Default Value -false
Type: String
API Examples
Code to Integrate
curl "https://api.scrapingdog.com/google_lens?api_key=APIKEY&url=https://lens.google.com/uploadbyurl?url=https://i.imgur.com/HBrB8p0.png"
import requests url = "https://api.scrapingdog.com/google_lens" params = { "api_key": "APIKEY", "url": "https://lens.google.com/uploadbyurl?url=https://i.imgur.com/HBrB8p0.png" } response = requests.get(url, params=params) if response.status_code == 200: print(response.json())
const axios = require('axios'); axios.get('https://api.scrapingdog.com/google_lens', { params: { api_key: 'APIKEY', url: 'https://lens.google.com/uploadbyurl?url=https://i.imgur.com/HBrB8p0.png' } }).then(response => console.log(response.data)) .catch(error => console.error(error.message));
<?php $url = 'https://api.scrapingdog.com/google_lens/?' . http_build_query([ 'api_key' => 'APIKEY', 'url' => 'https://lens.google.com/uploadbyurl?url=https://i.imgur.com/HBrB8p0.png', ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch); curl_close($ch);
require 'net/http' require 'uri' url = URI.parse("https://api.scrapingdog.com/google_lens/") url.query = URI.encode_www_form( 'api_key' => 'APIKEY', 'url' => 'https://lens.google.com/uploadbyurl?url=https://i.imgur.com/HBrB8p0.png' ) http = Net::HTTP.new(url.host, url.port) http.use_ssl = true puts http.request(Net::HTTP::Get.new(url)).body
import java.io.*; import java.net.*; public class Main { public static void main(String[] args) throws Exception { String apiUrl = "https://api.scrapingdog.com/google_lens/?api_key=APIKEY&url=" + URLEncoder.encode("https://lens.google.com/uploadbyurl?url=https://i.imgur.com/HBrB8p0.png", "UTF-8"); URL url = new URL(apiUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = reader.readLine()) != null) System.out.println(line); conn.disconnect(); } }
API Response
{
"lens_results": [
{
"position": 1,
"title": "Danny DeVito - Wikipedia",
"source": "en.wikipedia.org",
"link": "https://en.wikipedia.org/wiki/Danny_DeVito",
"thumbnail": "https://encrypted-tbn1.gstatic.com/images?q=..."
},
{
"position": 2,
"title": "Danny DeVito | Roald Dahl Wiki | Fandom",
"source": "fandom.com",
"link": "https://roalddahl.fandom.com/wiki/Danny_DeVito",
"thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=..."
}
]
}