# Google Lens Visual Search

Submit a public HTTPS image URL to Google Lens. The response has stable `visual_matches`, `exact_matches`, and `related_content` arrays. Use `type` to focus the search; `q` can refine all, product, and visual-match searches.

- **Documentation:** [https://scrappa.co/docs/google-lens-api/google-lens](https://scrappa.co/docs/google-lens-api/google-lens)
- **API group:** Google Lens API
- **Endpoint:** `GET https://scrappa.co/api/google/lens`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | Yes | Public HTTPS URL for the image to search. |
| `q` | string | No | Optional text used to refine visual or product matches. |
| `type` | string | No | One of `all`, `products`, `exact_matches`, or `visual_matches`. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/google/lens?url=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2F4%2F45%2FA_small_cup_of_coffee.JPG&type=visual_matches"
```

## Example response

```json
{
    "search_parameters": {
        "url": "https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG",
        "q": null,
        "type": "visual_matches"
    },
    "visual_matches": [
        {
            "source": "Wikipedia",
            "title": "Coffee cup",
            "link": "https://en.wikipedia.org/wiki/Coffee",
            "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:example",
            "price": null,
            "position": 1
        }
    ],
    "exact_matches": [],
    "related_content": []
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Error | The URL is unsafe or the image is invalid. Not billed. |
| 502 | Error | Google blocked the request. Not billed and retryable. |
| 502 | Error | Google returned an unexpected result layout. Not billed and retryable. |
| 503 | Error | The upstream service is temporarily unavailable. Please retry shortly. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
