# Real-Time Lens Data API (`openweb-ninja/real-time-lens-data`) Actor

Fast and reliable Google Lens API - search by image and get visual matches, exact matches, object detection, and image to text (OCR) in real-time.

- **URL**: https://apify.com/openweb-ninja/real-time-lens-data.md
- **Developed by:** [OpenWeb Ninja](https://apify.com/openweb-ninja) (community)
- **Categories:** E-commerce, AI
- **Security:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 99.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.75 / 1,000 api requests

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Real-Time Lens Data API

Real-Time Lens Data is a fast and reliable Google Lens API for searching by image in real-time. It returns visual matches, OCR text, and object data as structured JSON via REST.

What it returns: image search and visual matches, exact matches, object detection, and image-to-text (OCR).

This actor runs the same Real-Time Lens Data API that developers use on RapidAPI and OpenWeb Ninja, with the same endpoints, parameters and output.

### What you can do with it

- Find products and visually similar items from a photo
- Track where an image appears on the web with exact matches
- Detect objects and extract text (OCR) from images
- Power visual search and shopping features

### Endpoints

Pick the endpoint in the **Endpoint** field. Each run makes one call to that endpoint and writes its results to the dataset.

#### Image Search

`GET /search`

Search image by url and get visual matches, knowledge graph, and products found on the web. See it in action on - [Google Lens](https://lens.google.com/uploadbyurl?url=https%3A%2F%2Fi.imgur.com%2FHBrB8p0.png).

| Parameter | Required | Description |
|---|---|---|
| `url` | Yes | URL of an image with which to perform the search. |
| `query` | No | Search query to further refine the results. |
| `language` | No | Set the language of the results (Google's hl parameter). Allowed values: 2-letter language code, see ISO 639-1. Default: `en`. |
| `country` | No | Set the country for the search (Google's gl parameter). Allowed values: 2-letter country code, see ISO 3166. Default: `us`. |

#### Visual Matches

`GET /visual-matches`

Get visual matches from the web for an image and optionally a query. This endpoint implements the "Visual Matches" on Google Lens.

| Parameter | Required | Description |
|---|---|---|
| `url` | Yes | URL of an image for which to get visual matches. |
| `query` | No | Search query to further refine the results. |
| `language` | No | Set the language of the results (Google's hl parameter). Allowed values: 2-letter language code, see ISO 639-1. Default: `en`. |
| `country` | No | Set the country for the search (Google's gl parameter). Allowed values: 2-letter country code, see ISO 3166. Default: `us`. |

#### Exact Matches

`GET /exact-matches`

Send an image URL and get the top 500 web pages with the same image (reverse image search). This endpoint implements the "Exact Matches" tab on Google Lens.

| Parameter | Required | Description |
|---|---|---|
| `url` | Yes | URL of the image for which to find sources |
| `limit` | No | Maximum number of results to return. Default: `500`. |
| `safe_search` | No | How to show explicit content in your search results, like sexual activity and graphic violence. Values: `off`, `blur`. Default: `blur`. |

#### Object Detection

`GET /object-detection`

Detect landmarks, places, plants, animals, products, and other objects in an image, including bounding boxes, labels / types and confidence score.

| Parameter | Required | Description |
|---|---|---|
| `url` | Yes | URL of an image to perform Google Lens object detection. |

#### Image to Text

`GET /ocr`

Extract text from an image and get paragraph, sentence and word level text detections from Google Lens.

| Parameter | Required | Description |
|---|---|---|
| `url` | Yes | URL of an image from which to extract text. |
| `language` | No | Set the language of the results. Allowed values: 2-letter language code, see ISO 639-1. Default: `en`. |

### Example input

```json
{
  "endpoint": "/search",
  "url": "https://i.imgur.com/HBrB8p0.png"
}
```

### Example output

One dataset item per result. A Image Search item looks like this (trimmed):

```json
{
  "position": 1,
  "title": "Amazon.com | Nike mens Air Jordan 1 Mid Shoes, Cement Grey ...",
  "link": "https://www.amazon.com/Grey-Cement-White-True-Jordan/dp/B0G625STJX",
  "source": "www.amazon.com",
  "source_name": "Amazon.com",
  "source_icon": "https://encrypted-tbn2.gstatic.com/faviconV2?url=https://www.amazon.com&client=HORIZON&size=96&type=FAVICON&fallback_opts=TYPE,SIZE,URL&nfrp=2",
  "thumbnail": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT9wC6dsXmBCk0GgIOG9d0zt6vDEqYkdiRHYsjew8hrc-7f9tEU",
  "thumbnail_width": 225,
  "thumbnail_height": 225,
  "image": "https://images-na.ssl-images-amazon.com/images/I/61dLDXdOEhL._AC_UL600_SR600,600_.jpg",
  "image_width": 600,
  "image_height": 600
}
```

The run's key-value store `OUTPUT` record holds the request parameters, the request id and any non-list fields of the response (for example a pagination cursor).

### Pricing

Pay per event: you pay per API request, at the same rates as our API plans. Most runs are one request; some parameters (such as fetching several pages at once) count as several, exactly as they do on the API.

| Apify plan | Price per 1,000 requests |
|---|---|
| Free | $5.00 |
| Starter (Bronze) | $2.50 |
| Scale (Silver) | $1.50 |
| Business (Gold) and above | $0.75 |

A request that fails is not charged.

### Using it from code

Run it through the [Apify API](https://docs.apify.com/api/v2) or a client library, with the input above as the JSON body:

```bash
curl -X POST "https://api.apify.com/v2/acts/openweb-ninja~real-time-lens-data/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"endpoint":"/search","url":"https://i.imgur.com/HBrB8p0.png"}'
```

Need higher volume or a direct REST API? Real-Time Lens Data API is also available as an API on [OpenWeb Ninja](https://www.openwebninja.com/api/real-time-lens-data) and [RapidAPI](https://rapidapi.com/letscrape-6bRBa3QguO5/api/real-time-lens-data).

### Support

For custom plans, high volumes or anything else:

- Email: support@openwebninja.com
- Discord: https://discord.gg/wxJxGsZgha

# Actor input Schema

## `endpoint` (type: `string`):

Which endpoint of the API to call. Each endpoint uses the parameters listed in its section below; parameters of other endpoints are ignored.

## `url` (type: `string`):

URL of an image with which to perform the search.<br><br><em>Used by: Image Search, Visual Matches, Exact Matches, Object Detection, Image to Text. Required for Image Search, Visual Matches, Exact Matches, Object Detection, Image to Text.</em>

## `query` (type: `string`):

Search query to further refine the results.<br><br><em>Used by: Image Search, Visual Matches.</em>

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

Set the language of the results (Google's hl parameter). Allowed values: 2-letter language code, see ISO 639-1.<br><br><em>Used by: Image Search, Visual Matches, Image to Text.</em>

## `country` (type: `string`):

Set the country for the search (Google's gl parameter). Allowed values: 2-letter country code, see ISO 3166.<br><br><em>Used by: Image Search, Visual Matches.</em>

## `limit` (type: `string`):

Maximum number of results to return.<br><br><em>Used by: Exact Matches.</em>

## `safe_search` (type: `string`):

How to show explicit content in your search results, like sexual activity and graphic violence.<br><br><em>Used by: Exact Matches.</em>

## Actor input object example

```json
{
  "endpoint": "/search",
  "url": "https://i.imgur.com/HBrB8p0.png",
  "language": "en",
  "country": "us",
  "limit": "500",
  "safe_search": "blur"
}
```

# Actor output Schema

## `results` (type: `string`):

One dataset item per result of the API call.

## `summary` (type: `string`):

Endpoint, parameters, request id, billed requests and any non-list response fields (such as a pagination cursor).

# 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 = {
    "url": "https://i.imgur.com/HBrB8p0.png",
    "language": "en",
    "country": "us",
    "limit": "500"
};

// Run the Actor and wait for it to finish
const run = await client.actor("openweb-ninja/real-time-lens-data").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 = {
    "url": "https://i.imgur.com/HBrB8p0.png",
    "language": "en",
    "country": "us",
    "limit": "500",
}

# Run the Actor and wait for it to finish
run = client.actor("openweb-ninja/real-time-lens-data").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "url": "https://i.imgur.com/HBrB8p0.png",
  "language": "en",
  "country": "us",
  "limit": "500"
}' |
apify call openweb-ninja/real-time-lens-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,openweb-ninja/real-time-lens-data"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/XggXoEKNCbGC0FjOW/builds/fdcYZTkQ2twzLtriO/openapi.json
