---
title: "Google Lens API: Reverse Image Search as JSON | Perceptlayer"
description: "Call GET /v1/google-lens/lens with an image URL and get visual matches as JSON for 1 credit. Parameters, a real response and uses for finding sources."
url: https://perceptlayer.com/blog/google-lens-api-reverse-image-search
---

[Blog](https://perceptlayer.com/blog) / [API guides](https://perceptlayer.com/blog/category/api-guides)

# Google Lens API: Reverse Image Search as JSON

26 Sept 2026 Perceptlayer 6 min read

You can run a Google Lens reverse image search over HTTP with one GET request to `/v1/google-lens/lens` and an image URL in the `url` parameter. The response is JSON, with matches listed by `position`, each with a `title`, a `link` and a `source`. A successful call costs 1 credit, and a failed call costs nothing.

## Key takeaways

-   One endpoint, `GET /v1/google-lens/lens`, takes a required `url` (up to 2048 characters) and optional `q` and `type`.
-   `type` accepts `all`, `products`, `exact_matches` or `visual_matches`, so you can ask for one kind of match instead of everything.
-   The recorded `visual_matches` response returns `title`, `link`, `source` and `position` per match.
-   Each successful call costs 1 credit; 5,000 lookups × 1 credit = 5,000 credits. Failed calls return `X-Credits-Used: 0`.
-   The endpoint takes an image address, not an uploaded file, so the image has to be reachable at a URL.

## What does the Google Lens API return?

[Google Lens](https://lens.google/) takes a picture and finds pages that show the same or similar images. The Perceptlayer endpoint wraps that lookup: you send an image URL, and you get back JSON with the matches Lens found, in ranked order. There's no HTML to parse and no browser session to drive.

The API page for [Google Lens](https://perceptlayer.com/apis/google-lens) lists a single endpoint, [Lens](https://perceptlayer.com/apis/google-lens/lens), in the [Search engines](https://perceptlayer.com/verticals/search) area. It's a standard-tier endpoint, so it works with an ordinary key and doesn't need the restricted-endpoint terms.

What you get depends on `type`. The recorded sample for this article uses `type=visual_matches`, so the response excerpt below shows that group. We haven't recorded the other three values, so this guide doesn't describe their fields. Run them in the playground on the API page to see what they return for your own images.

## How do you make a reverse image search request?

Send a GET request with the image address URL-encoded in `url` and your key in the `X-API-Key` header. Keys start with `sk_live_`, and the [authentication docs](https://docs.perceptlayer.com/authentication) cover the `api_key` query parameter for clients that can't set headers. If you don't have a key yet, [get a free API key](https://perceptlayer.com/signup).

This request searches for matches of a coffee photo hosted on Wikimedia Commons:

```bash
curl "https://api.perceptlayer.com/v1/google-lens/lens?url=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2F4%2F45%2FA_small_cup_of_coffee.JPG&type=visual_matches" \
  -H "X-API-Key: $API_KEY"
```

The `url` value is percent-encoded because it contains `:` and `/` characters inside a query string. If you build requests in code, let your HTTP library do the encoding. In Python, passing a dict to `params` does it for you:

```python
import os
import requests

resp = requests.get(
    "https://api.perceptlayer.com/v1/google-lens/lens",
    params={
        "url": "https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG",
        "type": "visual_matches",
    },
    headers={"X-API-Key": os.environ["API_KEY"]},
    timeout=60,
)
resp.raise_for_status()
for match in resp.json()["visual_matches"]:
    print(match["position"], match["title"])
```

The image in these examples is the Commons file [A small cup of coffee](https://commons.wikimedia.org/wiki/File:A_small_cup_of_coffee.JPG). Swap in any image address your own pipeline holds.

## Which parameters does the Lens endpoint take?

The endpoint takes one required parameter and two optional ones. `url` is the image to look up, `q` adds a text query alongside the image, and `type` narrows the response to one kind of match. Nothing else about them is documented, so there are no stated defaults to rely on: pass `type` explicitly when you care which group you get.

| Parameter | Type | Required | Notes |
| --- | --- | --- | --- |
| `url` | string | yes | Address of the image; up to 2048 characters |
| `q` | string | no | Text query to go with the image; up to 500 characters |
| `type` | string | no | One of `all`, `products`, `exact_matches`, `visual_matches` |

The four `type` values map to different jobs, which is how you'd choose between them:

| `type` | Use it when you want |
| --- | --- |
| `visual_matches` | Pages with images that look like yours |
| `exact_matches` | Pages that show the same image |
| `products` | Product results for the item in the image |
| `all` | Every group in one response |

The `q` parameter is useful when the image has more than one subject. If a photo shows a desk with a lamp on it and you care about the lamp, a short text query gives Lens something to focus on. Keep it within 500 characters.

## What does a response look like?

The response echoes your inputs under `search_parameters`, then lists matches under the group you asked for. Here is an excerpt from the recorded response for the coffee photo, trimmed with `…` where the long `link` values are cut:

```json
{
  "search_parameters": {
    "url": "https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG",
    "type": "visual_matches"
  },
  "visual_matches": [
    {
      "source": "google.com",
      "title": "Coffee - Wikipedia",
      "link": "https://www.google.com/goto?url=CAESYAHrOzAVjqyZsRw2qYBWnGTQxvo0jp82FNgkFtdeekgdFsMzllECFQuW0N_YE0jQU21l8peWTBGW9imMZMQnJR97PbsxrAVhJlwl7Y3TiYThovCMSqoX1PYgBXCF…",
      "position": 1
    },
    {
      "source": "google.com",
      "title": "Un espresso con carácter: tueste oscuro, aroma a chocolate y ...",
      "link": "https://www.google.com/goto?url=CAESYwHrOzAVNdoGpK3FtZxCqcuZTEUq7d9luEWqqwu14ENvcGHD8sy55sN4m7HGYYUpQ0EeamvXBbXOfY-pkMl80yJ8WBgs9vWiCC9-HhswGQ8J1dWANIdzkP-CGSaR…",
      "position": 2
    }
  ]
}
```

Three details from this sample matter if you build on it. First, `position` is the rank, starting at 1. Second, `title` is the title of the matched page, and it comes back in the page's own language: the second match is Spanish. Third, in this recording `link` is a `google.com/goto` address and `source` is `google.com`, so neither field names the destination site by itself.

That last point affects how you'd use the data. If you need the destination domain, test a few results from your own images before you design around `source`. Don't assume it carries the site name.

## How do you use it to find a product source or duplicate listings?

Reverse image search answers a narrow question: where else does this picture appear? That makes it a good fit for two jobs. One is tracing a product photo back to the pages that sell or describe the item. The other is spotting the same photo reused across listings, such as a used-car ad or a rental that appears on more than one site.

For product sourcing, call the endpoint with a supplier or marketplace photo and `type=products`, then review the matches by hand or pass the titles to a matcher. For listing checks, call it with `type=exact_matches` and treat any other page that shows the same image as a candidate duplicate. A shared photo is a signal, not proof: agents and dealers legitimately post the same pictures in several places, and a different photo doesn't prove two listings differ.

So combine the image signal with fields you already have. Compare price, location and attributes before you merge two records. The post on [deduplicating listings across sources](https://perceptlayer.com/blog/deduplicate-listings-across-sources) covers matching without shared IDs, and the guides to the [AutoScout24 API](https://perceptlayer.com/blog/autoscout24-api-car-listings-json) and the [Rightmove API](https://perceptlayer.com/blog/rightmove-api-property-data) show where listing photos come from in the first place.

For a visual pass over a phrase instead of a photo, the [Google Images API](https://perceptlayer.com/blog/google-images-api-json) searches by text. For prices on a product once you know what it is, see the [Google Shopping API](https://perceptlayer.com/blog/google-shopping-api-product-prices).

## What does it cost, and how fast can you call it?

Each successful call costs 1 credit, and a failed call costs nothing. Every successful response carries `X-Credits-Used` and `X-Credits-Remaining`, so you can track spend per call. The [credits docs](https://docs.perceptlayer.com/credits) explain how the balance works.

A worked example: one pass over 5,000 listing photos is 5,000 calls × 1 credit, or 5,000 credits. The free tier gives 100 credits after you verify an email address, with no credit card, so the first 100 of those lookups are free and the rest need a pack. Purchased credits come in prepaid packs from 10,000 credits and last 12 months. See [pricing](https://perceptlayer.com/pricing) for what credits cost.

Rates are per account and counted per minute. Free accounts get 1 request a second (60 a minute), and paying accounts get at least 5 a second (300 a minute). A rate-limited call returns 429 with a `Retry-After` header, and the [rate limits docs](https://docs.perceptlayer.com/rate-limits) have the rest. For a batch of images, a bounded worker loop is enough; the post on [concurrent requests in Python under rate limits](https://perceptlayer.com/blog/concurrent-api-requests-python-rate-limit) shows one.

Failures arrive as an HTTP status and a JSON body with `error.code`, `error.message` and `error.request_id`. A bad `url` or `type` returns `invalid_parameters` (422). Requests have no idempotency key, so a call that timed out on your side may still have succeeded and been billed. The [errors docs](https://docs.perceptlayer.com/errors) list every code.

Next step: open the [Lens endpoint page](https://perceptlayer.com/apis/google-lens/lens), paste one of your own image URLs into the playground, and run a real call with your key.

## APIs in this post

-   [Google Lens **1 credit per call** · 2 endpoints](https://perceptlayer.com/apis/google-lens)

## Frequently asked questions

### Can I upload an image file to the Google Lens API?

The endpoint takes an image address in the `url` parameter, not a file upload. The only documented image input is `url`, up to 2048 characters. If your image sits on a local disk, host it somewhere reachable first and pass that address.

### How much does a Google Lens API call cost?

A successful call to `/v1/google-lens/lens` costs 1 credit. Failed calls cost nothing and return `X-Credits-Used: 0`. Checking 2,000 images = 2,000 calls × 1 credit = 2,000 credits. The free tier includes 100 credits once, on signup, and [pricing](https://perceptlayer.com/pricing) shows what additional credits cost.

### Which match types can I request?

The `type` parameter accepts `all`, `products`, `exact_matches` and `visual_matches`. Leave it out and you rely on undocumented behaviour, so set it explicitly. The recorded sample in this guide covers `visual_matches`, whose entries have `title`, `link`, `source` and `position`.

### Does a match prove two listings are the same?

No. A match tells you the same or a similar picture appears on another page. Sellers reuse photos legitimately, so use the match as one signal and compare price, location and attributes before merging records. The data is returned as found at the time of the call.

### Can an AI agent call this endpoint?

Yes. The MCP server at `https://perceptlayer.com/mcp` exposes `search_endpoints`, `get_endpoint` and `call_endpoint`. An agent can look up the Lens endpoint for free and call it with an image URL, spending 1 credit on success. See the [AI agents docs](https://docs.perceptlayer.com/ai-agents).

google lens reverse image search image search product sourcing duplicate listings

## More from the blog

1.  [API guides](https://perceptlayer.com/blog/category/api-guides) 5 Nov 2026 Perceptlayer 8 min read
    
    ## [Google Images Scraper or API: What You Get](https://perceptlayer.com/blog/google-images-scraper-vs-api)
    
    Compare a Google Images scraper with one 1-credit call that returns position, source, link, original URL, pixel size and is\_product for each result.
    
2.  [API guides](https://perceptlayer.com/blog/category/api-guides) 6 Aug 2026 Perceptlayer 7 min read
    
    ## [Google Images API: Search Image Results as JSON](https://perceptlayer.com/blog/google-images-api-json)
    
    One GET to /v1/google-images/images returns image results as JSON for 1 credit: parameters, cURL and Python calls, a real response and licensing notes.
    
3.  [API guides](https://perceptlayer.com/blog/category/api-guides) 26 Nov 2026 Perceptlayer 7 min read
    
    ## [Depop API: Resale Listings as JSON](https://perceptlayer.com/blog/depop-api-json)
    
    Search Depop listings as JSON with brand, condition, sizes and price.amount per item; the recorded jacket search had a total\_count of 6,815,522. 1 credit.
