logo

Google Lens API

View as Markdown

Search Google Lens by image URL and return visual matches, exact-image pages, and related searches as structured JSON

The Google Lens API searches with a public image URL and returns structured JSON. Use it to find visually similar images, discover pages that contain the exact image, identify products and prices, or collect related search suggestions without rendering Google Lens yourself.

Credit Usage: Each successful request costs 10 credits, regardless of the selected result type. A search that finds no matches, or whose image Google cannot load, still succeeds and costs 10 credits. Failed requests that return 502 are not charged. To run many searches, send requests in parallel; your plan's concurrency limit applies.

Key Features

  • Visual matches: find pages with visually similar images and receive page, source, thumbnail, and full-size image details.
  • Exact-image matches: use type=exact to find pages that contain the same image.
  • Product data: receive prices, normalized price values, currencies, ratings, review counts, and stock status when Google shows them.
  • Combined image and text search: add q to refine visual matches by color, model, product detail, or another keyword.
  • Related searches: the default type=all response includes Google's suggested searches for the image when q is not sent.
  • Localized results: control the interface language with hl and the result country, prices, and currencies with gl.

Endpoint

GET https://api.scrape.do/plugin/google/lens

Request Parameters

Required

ParameterTypeDescription
tokenstringYour Scrape.do API authentication token
urlstringPublic http or https URL of the image to search. The image must be reachable by Google
ParameterTypeDefaultDescription
typestringallResult type: all returns visual results and related searches, visual returns visual results only, and exact returns pages containing the exact image
qstring-Optional text to search with the image, such as a color or product detail. Not supported with type=exact
safestringGoogle's defaultactive filters explicit results; off disables the filter

Localization

ParameterTypeDefaultDescription
hlstringenInterface language, for example en, de, fr, ja, or tr
glstringusTwo-letter ISO 3166-1 country code, for example us, gb (not uk), de, or jp. Controls the market Google uses for results, prices, and currencies

Output

ParameterTypeDefaultDescription
include_htmlbooleanfalseSet to true or 1 to include the Google Lens results page in the html response field at no extra cost

Example Usage

curl -G "https://api.scrape.do/plugin/google/lens" \
  --data-urlencode "token=$TOKEN" \
  --data-urlencode "url=https://m.media-amazon.com/images/I/61bK6PMOC3L._AC_SL1500_.jpg"

Refine an Image Search with Text

curl -G "https://api.scrape.do/plugin/google/lens" \
  --data-urlencode "token=$TOKEN" \
  --data-urlencode "url=https://m.media-amazon.com/images/I/61bK6PMOC3L._AC_SL1500_.jpg" \
  --data-urlencode "q=blue"

Exact-Image Matches

curl -G "https://api.scrape.do/plugin/google/lens" \
  --data-urlencode "token=$TOKEN" \
  --data-urlencode "url=https://m.media-amazon.com/images/I/61bK6PMOC3L._AC_SL1500_.jpg" \
  --data-urlencode "type=exact"

Response

Visual Results

Returned for type=all and type=visual. A typical search returns about 60 results.

{
  "search_parameters": {
    "image_url": "https://m.media-amazon.com/images/I/61bK6PMOC3L._AC_SL1500_.jpg",
    "type": "all",
    "hl": "en",
    "gl": "us"
  },
  "visual_results": [
    {
      "position": 1,
      "title": "Amazon.com: Apple iPhone 14, 128GB, Blue for T-Mobile ...",
      "link": "https://www.amazon.com/Apple-iPhone-128GB-T-Mobile-Renewed/dp/B0BN746959",
      "source": "Amazon.com",
      "domain": "www.amazon.com",
      "price": "$350*",
      "extracted_price": 350,
      "currency": "$",
      "rating": 4.3,
      "reviews": 2076,
      "in_stock": true,
      "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:...",
      "image": {
        "link": "https://m.media-amazon.com/images/I/61aEBeER-+L._AC_UF894,1000_QL80_.jpg",
        "width": 755,
        "height": 1000
      }
    }
  ],
  "related_searches": [
    {
      "query": "Apple iPhone 14",
      "link": "https://www.google.com/search?q=Apple+iPhone+14&kgmid=/g/11s7qfcm0s&..."
    }
  ]
}

search_parameters

Shows the parameters used for the search: image_url, type, q, hl, gl, and safe. Optional q and safe fields appear only when sent. The response always includes the effective type, hl, and gl, including their defaults.

visual_results[]

FieldTypeDescription
positioninteger1-based result position
titlestringTitle of the page showing the image
linkstringURL of the page
sourcestringSite name
domainstringSite domain
pricestringPrice as Google displays it. An asterisk is Google's marker for a price it may not have verified
extracted_pricenumberNumeric value parsed from price
currencystringCurrency symbol or code shown with the price
ratingnumberProduct rating out of 5, when available
reviewsintegerNumber of reviews associated with the rating, when available
in_stockbooleanStock status when shown. Available only for English results that include stock information
thumbnailstringMatching image thumbnail URL
imageobjectFull-size matching image with link, width, and height in pixels

When Google finds no visual match or cannot load the supplied image, the request can still succeed without a visual_results field.

Returned only for type=all without q.

FieldTypeDescription
querystringRelated search Google suggests for the image
linkstringGoogle Search URL for the suggested query

Exact Results

With type=exact, the response contains exact_results instead of visual_results and related_searches.

{
  "search_parameters": {
    "image_url": "https://m.media-amazon.com/images/I/61bK6PMOC3L._AC_SL1500_.jpg",
    "type": "exact",
    "hl": "en",
    "gl": "us"
  },
  "exact_results": [
    {
      "position": 1,
      "title": "Apple iPhone 14 A2649 Unlocked 256GB Blue Good - eBay",
      "link": "https://www.ebay.com/itm/...",
      "source": "eBay",
      "price": "$315.26",
      "extracted_price": 315.26,
      "currency": "$",
      "in_stock": true,
      "image_size": {
        "width": 756,
        "height": 1000
      }
    }
  ]
}

An image used widely returns up to 400 exact matches. If Google finds no page containing the exact image, the request can still succeed without an exact_results field.

FieldTypeDescription
positioninteger1-based result position
titlestringTitle of the page containing the image
linkstringURL of the page. The first 50 of up to 400 results are resolved page URLs; later results and links that cannot be resolved in time may remain Google redirect URLs
sourcestringSite name
pricestringPrice as Google displays it, when available
extracted_pricenumberNumeric value parsed from price
currencystringCurrency symbol or code shown with the price
in_stockbooleanStock status when Google shows it. Available only for English results
image_sizeobjectWidth and height of the image on the result page, in pixels

Use the Google Redirect (Goto) Link Resolver to resolve an exact_results[].link that starts with https://www.google.com/goto?url=. Resolving links returned after the first 50 exact matches costs 1 credit per link.

HTML

When include_html=true, the response also includes html with the results page exactly as Google served it. This field is included even when the search finds no matches.

Links in html remain Google redirect URLs and are not replaced with the resolved links from exact_results. A typical results page is 0.7 to 1.3 MB and is usually smaller when no results match.


Usage Notes

  • The image URL must be publicly reachable by Google. Hosts that block Google from fetching images can produce a successful response with no result array.
  • type=all and type=visual usually complete in about 5 seconds.
  • type=exact usually takes about 20 seconds and can take up to about 35 seconds because page links are resolved before the response is returned.
  • Results come from one live search. Repeating the same request can return a different result set.
  • q cannot be combined with type=exact.
  • A two-letter code that is not a country, such as uk or en, is not rejected up front. The request fails with 502 after about a minute. Use ISO 3166-1 codes such as gb for the United Kingdom.

Error Handling

StatusBodyCause
400{ "error": "token is required" }The token parameter is missing
400{ "error": "url must be the http(s) URL of an image" }url is missing or is not an http or https URL
400{ "error": "type must be all, visual or exact" }type has an unsupported value
400{ "error": "q is not supported with type exact" }q was sent with type=exact
400{ "error": "safe must be active or off" }safe has an unsupported value
400{ "error": "gl must be a two-letter country code" }gl is not two letters
400{ "error": "include_html must be true or false" }include_html is not a boolean value
401 / 402Standard API errorThe token is invalid or the account does not have enough credits
502{ "error": "request failed", "message": "Please try again, and if the issue continues, contact support." }The search could not be completed. Retry the request

On this page