# Google Lens Reverse Image Search API (`s-r/google-lens`) Actor

- **URL**: https://apify.com/s-r/google-lens.md
- **Developed by:** [SR](https://apify.com/s-r) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Google Lens API: Reverse Image Search for Visual Matches, Products, and Prices

Run a reverse image search API at scale with clean JSON. This actor takes any direct image URL, uploads it to Google Lens, and returns the visual matches Lens finds across the web, each with a page URL, a title, the source domain, and a price when the match is a shopping result. Point it at a list of URLs for bulk reverse image search across a whole catalog. It also returns the image regions Lens detected, with normalized bounding boxes. No browser, no headless Chrome, just pure HTTP against the Lens upload endpoint.

If you have ever wanted a "search by image API" that gives you the same visual matches you see in the Google Lens results page, but as structured rows you can pipe into a database, this is that.

### What you get

- **Visual matches** for each input image: an array of results, where every match carries a `title`, a `page_url` (the web page the image appears on), a `source_domain` (for example amazon.com or etsy.com), a `thumbnail`, and, when Lens exposes it, a `price` and `currency`.
- **A match count** per image so you can filter, rank, or bill on volume.
- **Detected regions**: the bounding boxes Lens found inside the image, each with a `label` and a `box_cxcywh` (center-x, center-y, width, height, all normalized 0 to 1). Useful when an image has multiple objects.
- **The Lens results page URL** (`search_url`), so you can open the exact search a human would see.
- **Run metadata**: `attempts`, `error` (null on success), and `fetched_in_seconds` per image.

### Why use Google Lens reverse image search

Reverse image search answers a different question than text search. Instead of "what pages mention this phrase", it asks "where does this exact image, or something visually close to it, appear online". That is the right tool when you start from a picture and need context: a product photo with no name, a screenshot of a book cover, a creative asset you suspect was copied, a marketplace listing you want to trace back to its source.

Google Lens is the strongest public visual-match engine, and it is especially good at products. Feed it a product image and it tends to return shopping listings from real sellers, often with prices attached, which turns a single photo into a live price-comparison set. Feed it a book cover and it returns the sellers carrying that edition. Feed it a logo or a piece of packaging and it surfaces the pages using it.

The catch is that Google does not ship an official public Google Lens API. To get Lens results programmatically you either drive a real browser (slow, fragile, expensive) or you talk to the Lens upload endpoint directly. This actor does the latter. It uploads your image, follows the redirect to the results page, and parses the visual matches and regions out of the response, so you get Lens-quality data without running a browser.

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `image_urls` | array of strings | Yes | Direct image URLs (JPG, PNG, or WEBP). Each URL must point straight at the image file, not at a page that contains it. One output row is produced per URL. |
| `language` | string | No | Two-letter Google `hl` language code (for example `en`, `de`, `fr`). Controls the language of the Lens results page. |
| `retries` | integer (0 to 8) | No | Number of anti-bot retries. On a blocked response the actor rotates its session cookies and tries again, up to this many times. |

### Output

One dataset row per input image. Trimmed example showing a shopping match and a detected region:

```json
{
  "image_url": "https://example.com/book-cover.jpg",
  "search_url": "https://lens.google.com/search?ep=...",
  "match_count": 59,
  "matches": [
    {
      "title": "The Midnight Library by Matt Haig (Hardcover)",
      "page_url": "https://www.amazon.com/dp/0525559477",
      "source_domain": "amazon.com",
      "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=...",
      "price": "18.99",
      "currency": "USD"
    },
    {
      "title": "The Midnight Library - AbeBooks",
      "page_url": "https://www.abebooks.co.uk/9780525559474/...",
      "source_domain": "abebooks.co.uk",
      "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=...",
      "price": null,
      "currency": null
    }
  ],
  "regions": [
    {
      "label": "Book",
      "box_cxcywh": [0.5012, 0.4876, 0.7203, 0.9411]
    }
  ],
  "attempts": 1,
  "error": null,
  "fetched_in_seconds": 2.7
}
````

`price` and `currency` are populated only when Lens returns a shopping-style match. For pages that are not listings they stay `null`, but `page_url`, `title`, and `source_domain` are still filled. `box_cxcywh` is normalized: multiply by your image width and height to get pixels.

### Use cases

**Brand and counterfeit monitoring.** Take your official product photos and run them through Lens on a schedule. The visual matches tell you every marketplace and page carrying that image, which is exactly how you catch grey-market resellers and counterfeit listings reusing your studio shots. The `source_domain` field makes it trivial to flag domains that are not authorized retailers.

**Product identification.** You have a photo but no SKU, no name, no barcode. Lens matches it against real listings and hands back titles and seller pages. In the verified book-cover test, a single cover image returned around 59 matches from amazon.com, ebay.com, etsy.com, abebooks.co.uk, and other sellers, each with the product title and the page URL. That is enough to identify the item and pull its identifiers downstream.

**Price comparison from an image.** Because product matches often include a `price` and `currency`, one image can become a price sheet. Point it at a competitor's product photo and you get back the sellers listing it and what they charge, without ever knowing the product name up front.

**Image provenance and copyright.** Photographers, agencies, and rights holders can trace where an image has spread. The page URLs show which sites republished an asset, which is the raw material for takedown notices or licensing follow-up.

### How it compares

- **vs borderline/google-lens**: that actor charges per mode, from $0.0015 for a visual match up to a $0.01 start fee, so cost depends on which Lens features you trigger. This actor is a flat rate for reverse-image visual matches with no per-mode fees to reason about.
- **vs zen-studio Google Lens**: that one is OCR-focused (text extraction from images). This actor is built for visual matches, merchant and page results, and detected regions, not text reading. If you need OCR, use zen-studio; if you need "where does this image appear and what products match it", use this.
- **Flat, predictable pricing**: one event type, billed only when there is at least one match, so empty searches do not cost you.

### Pricing

Pay-per-event, so you pay for results, not for time.

- **$0.0015 per image search**, charged only when the image returns at least one match. No match, no charge.
- **$0.002 per-run actor-start fee**.

That works out to roughly **$1.50 per 1000 images** that return matches, plus the small start fee per run. Batch many images into one run to amortize the start fee.

### Limits and gotchas

- **Direct image URLs only.** Each entry in `image_urls` must resolve straight to a JPG, PNG, or WEBP file. A link to a product page or a gallery will not work; extract the image URL first.
- **Matches depend on web presence.** Lens can only match an image to pages where that image (or a close variant) already exists online. A brand-new photo that has never been published may return zero matches.
- **Art and generic images may return only regions.** Abstract art, plain textures, or highly generic scenes often produce detected regions but few or no merchant matches.
- **Anti-bot cookie rotation.** Google will occasionally block a request. The actor rotates session cookies and retries up to your `retries` value. Set it higher (4 to 8) for large batches to keep the success rate up.
- **Title pairing is best-effort.** Lens does not always attach a clean title to every visual match, so some matches may carry a `page_url` and `source_domain` but a thin or empty `title`.
- **Prices are not guaranteed.** `price` and `currency` appear only when Lens surfaces a shopping result. Non-listing pages return `null` for both.
- **Free-tier cap.** Free Apify accounts are limited to 10 results per run. Paid accounts run uncapped.

### FAQ

**How do I do a reverse image search with an API?**
Pass one or more direct image URLs in `image_urls` and run the actor. It uploads each image to Google Lens, follows the redirect to the results page, and returns the visual matches as structured JSON, one row per image. No browser automation on your side.

**Can I find products from an image?**
Yes. Product photos are where Lens is strongest. It matches your image against real seller listings and returns titles, page URLs, source domains, and a price plus currency when the match is a shopping result. A single product image commonly returns dozens of listings.

**Does it return the source websites of an image?**
Yes. Every match includes `page_url` (the exact page the image appears on) and `source_domain` (the host, for example amazon.com or etsy.com). That is what makes it usable for provenance, monitoring, and takedown work.

**Why did my image return regions but no matches?**
That usually means Lens detected objects inside the image but could not find published pages carrying a matching image. It is common for original art, generic scenes, or freshly created assets that have no web footprint yet.

**Can I control the language of the results?**
Yes. Set `language` to a two-letter `hl` code (for example `de` or `fr`) to get the Lens results page in that language. Leave it unset to use the default.

### Related Actors

- [Google Lens OCR](https://apify.com/s-r/google-lens-ocr) - Extract text from any image with word-level bounding boxes.
- [Google AI Overview](https://apify.com/s-r/google-ai-overview) - Scrape Google AI Overview answers and the sources they cite.
- [Free Google Maps Scraper](https://apify.com/s-r/free-google-maps-scraper) - Scrape Google Maps places: name, rating, phone, website, hours.

# Actor input Schema

## `image_urls` (type: `array`):

Direct URLs of images to reverse-search on Google Lens (JPG, PNG, WEBP). One per line, up to 100 per run.

## `language` (type: `string`):

Two-letter interface language code (hl).

## `retries` (type: `integer`):

Google Lens challenges cold sessions. On a bounce we rotate to a fresh warm cookie and retry. 4 is usually enough.

## Actor input object example

```json
{
  "image_urls": [
    "https://i.imgur.com/AD3MbBi.jpeg"
  ],
  "language": "en",
  "retries": 4
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "image_urls": [
        "https://i.imgur.com/AD3MbBi.jpeg"
    ],
    "language": "en",
    "retries": 4
};

// Run the Actor and wait for it to finish
const run = await client.actor("s-r/google-lens").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "image_urls": ["https://i.imgur.com/AD3MbBi.jpeg"],
    "language": "en",
    "retries": 4,
}

# Run the Actor and wait for it to finish
run = client.actor("s-r/google-lens").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "image_urls": [
    "https://i.imgur.com/AD3MbBi.jpeg"
  ],
  "language": "en",
  "retries": 4
}' |
apify call s-r/google-lens --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=s-r/google-lens",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Google Lens Reverse Image Search API",
        "description": "",
        "version": "0.1",
        "x-build-id": "oTNY8p8PuZ7J960Gu"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/s-r~google-lens/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-s-r-google-lens",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/s-r~google-lens/runs": {
            "post": {
                "operationId": "runs-sync-s-r-google-lens",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/s-r~google-lens/run-sync": {
            "post": {
                "operationId": "run-sync-s-r-google-lens",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "image_urls"
                ],
                "properties": {
                    "image_urls": {
                        "title": "Image URLs",
                        "type": "array",
                        "description": "Direct URLs of images to reverse-search on Google Lens (JPG, PNG, WEBP). One per line, up to 100 per run.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "language": {
                        "title": "Language",
                        "type": "string",
                        "description": "Two-letter interface language code (hl).",
                        "default": "en"
                    },
                    "retries": {
                        "title": "Anti-bot retries",
                        "minimum": 0,
                        "maximum": 8,
                        "type": "integer",
                        "description": "Google Lens challenges cold sessions. On a bounce we rotate to a fresh warm cookie and retry. 4 is usually enough.",
                        "default": 4
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
