---
title: "SerpAPI"
description: "SerpAPI's Google endpoints for classic SERP results and Google Lens for reverse image search."
canonical_url: "https://web.agntn.dev/providers/serpapi"
---
# SerpAPI

> SerpAPI's Google endpoints for classic SERP results and Google Lens for reverse image search.

<provider-facts provider="serpapi">



</provider-facts>

## Address it

```ts
import { create, searchByImage } from "@agntn/web";

const serpapi = await create("serpapi"); // SERPAPI_API_KEY
const results = await serpapi.search("query", { maxResults: 10 });
const in2021 = await serpapi.search("node.js release", {
  startPublishedDate: "2021-01-01",
  endPublishedDate: "2021-12-31",
});
const matches = await searchByImage("https://example.com/image.jpg", { provider: "serpapi" });
```

The key is a query parameter on `serpapi.com`.

## What it reads

| Call | Endpoint |
| --- | --- |
| `search` | `GET /search?engine=google&q=…&num=…&start=…`, plus `tbs=cdr:1,cd_min:M/D/YYYY,cd_max:M/D/YYYY` when a date bound is set |
| `searchByImage` | `GET /search?engine=google_lens&url=…` |

## What comes back

Search: `publishedDate`, `image` (thumbnail), `favicon` and `metadata.{position, source, displayedLink}`. `startPublishedDate` and `endPublishedDate` go out as Google's custom date range, the only filter here, and `includeDomains` and friends come back in `ignoredFilters`. Paging through `start`. Image matches carry `pageUrl`, `imageUrl`, dimensions, `source`, `position` and `exactMatch`.

## Gotchas

- The date range takes whole days in US order, so each bound becomes its UTC day as `M/D/YYYY`. A lone bound goes out alone, because Google takes `cd_min` or `cd_max` by itself and there is no reason to make up the other end. `publishedDate` is Google's own text, `Oct 19, 2021` or `6 days ago`, and plenty of results have none.
- The only built-in reverse image provider. Everything under [Reverse image search](https://web.agntn.dev/guide/image) applies.
- 250 searches a month on the [free plan](https://serpapi.com/pricing) as of September 2026. A burst answers 429 fast.
- `maxResults` is applied on our side to whatever Google or Lens returns. Google pays little attention to `num` (a `maxResults: 1` call still brought back nine organic results) and hands a different page for a `start` off the ten grid, so a small `maxResults` walks each Google page in slices: the continuation fetches the same page again, which SerpAPI serves from its cache for an hour without charging, and `start` moves only once the page is used up.
- No matches is an empty list, not an error. An image Lens cannot fetch looks the same, so `[]` may also mean the provider never saw the picture.

## Where it lives

`src/providers/serpapi.ts`.


## Sitemap

See the full [sitemap](https://web.agntn.dev/sitemap.md) for all pages.
