# Google Lens Image Upload

Send the image as the multipart field `image` or as `image_base64` (raw base64 or a data URI), not both. The maximum size is 10 MB. JPEG, PNG, WebP, GIF and AVIF are accepted. The image is resized to at most 1600 px, converted to JPEG and stripped of EXIF data. It is kept at most 15 minutes and deleted right after the search. The response has the same `visual_matches`, `exact_matches`, and `related_content` arrays as the URL search. `search_parameters.url` is null and `search_parameters.image` is `upload`.

- **Documentation:** [https://scrappa.co/docs/google-lens-api/google-lens-upload](https://scrappa.co/docs/google-lens-api/google-lens-upload)
- **API group:** Google Lens API
- **Endpoint:** `POST 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 |
| --- | --- | --- | --- |
| `image` | file | No | Image file as a multipart form field. Send this or `image_base64`. |
| `image_base64` | string | No | Base64 encoded image or a `data:image/...;base64,` URI. Send this or `image`. |
| `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 response

```json
{
    "search_parameters": {
        "url": null,
        "image": "upload",
        "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 | Upload only (POST). The file is not a JPEG, PNG, WebP, GIF or AVIF image that can be decoded. Not billed. Retrying the same file does not help. |
| 422 | Error | Google Lens reported that it could not load the image. Not billed. Retrying the same URL does not help. |
| 422 | Error | Google Lens returned an empty result page. This usually means Google could not download the image (HTTP error, hotlink or bot protection, or an expired signed URL). Not billed. Retrying the same URL does not help; use a URL that loads publicly. |
| 503 | Error | Google blocked the request. Not billed and retryable. |
| 503 | 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)
