> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapebadger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Resolve Google result links

> Get the real URL of each Google search result whose link is still a Google redirect.

Send the `link_token` of a search result here to get the result's own URL.
[Google Search](https://docs.scrapebadger.com/api-reference/google/google-search/google-web-search.md) and
[Google Light Search](https://docs.scrapebadger.com/api-reference/endpoint/google/light-search.md) set a
`link_token` on each `organic_results` item whose `link` is still a Google
redirect (`https://www.google.com/goto?url=...`). One call takes 1 to 25
results. Each result comes back with its own URL in `link`, with the time to
wait before you send it again, or with an `error`.

A call costs **0 credits**.

## Where a `link_token` comes from

Google hides a result's URL behind a redirect link. It also paces how fast the
links of a result page can be followed: a few at once, the rest over about a
minute, and every link once the result page is about 160 seconds old. A
search answers within seconds and does not wait for that.

Today a search returns the real URL for the first few results of a result
page, usually one to three. Each of the other results has two more fields:

| Field | Type | Meaning |
| - | - | - |
| `link_token` | string | Send it to this endpoint to get the result's own URL. |
| `retry_after_seconds` | integer | How long to wait before resolving this link. `0` means you can send it right away. |

Both fields are `null` on a result whose `link` is already the real URL.

## Body parameters

**results** `object[]` *required*

The results to resolve. Send 1 to 25 items.

Each item needs a non-empty string `link_token`. Any other fields on an item
(`position`, `title`, your own id) are returned unchanged on its row. You can
send the `organic_results` items of a search response as they are. Leave out
the items whose `link_token` is `null`.

**item fields**

**link\_token** `string` *required*

The `link_token` of a result. Take it from a search response, or from the
row of an earlier call to this endpoint.

## Response

The response has two fields:

* `results`: one row per item, in the order sent.
* `retry_after_seconds`: the smallest wait among the not-ready rows, or `null`
  when no row is waiting.

Each row is one of three kinds:

| Row | How to tell | What to do |
| - | - | - |
| Resolved | No `link_token`. `link` is the result's own URL. | Use `link`. |
| Not ready | `link_token` and `retry_after_seconds` (1 or more). | Wait that many seconds, then send the row's `link_token` again. The token can differ from the one you sent. Always keep the latest. |
| Failed | `link_token` and `error`. | Do not send it again. Run the search again if you need the link. |

```json theme={null}
{
  "results": [
    { "position": 2, "link": "https://example.com/pricing" },
    {
      "position": 3,
      "link_token": "sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG...",
      "retry_after_seconds": 12
    },
    {
      "position": 4,
      "link_token": "sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG...",
      "error": "Google no longer answers this link. Run the search again for a fresh token."
    }
  ],
  "retry_after_seconds": 12
}
```

The call never waits for Google. It answers in about a second.

A token sent before its wait is over is not an error and costs nothing. Its row
comes back not ready, with the wait that is left.

## Recommended loop

1. Send the results that have a `link_token`.
2. Keep the rows that still have a `link_token` and no `error`. Every other row
   is final.
3. If no rows are left, stop.
4. Wait the number of seconds in the response's top-level
   `retry_after_seconds`, then send the rows you kept. Go back to step 2.

In the SDKs, `resolve_all` (Python) and `resolveAll` (Node) keep calling until
every link is resolved or the time is up. See the [examples](#examples).

## Timing

Measured on 2026-11-23:

| Method | Calls | All ten links of the result page known |
| - | - | - |
| Call again after each top-level `retry_after_seconds` | 5 | 46 seconds after the search |
| Call once, wait for the longest row's `retry_after_seconds`, call again | 2 | 49 seconds after the search |
| Wait until the result page is 160 seconds old, then call once | 1 | 163 seconds after the search |

A token can be resolved much later too. Links were resolved 22 hours after
their search. Google can stop answering an old link. That link comes back as a
failed row, with `error`.

## Errors

| Status | Meaning |
| - | - |
| `422` | The body is invalid: no `results`, more than 25 items, or an item without `link_token`. |
| `503` | Link resolution is temporarily unavailable. The response has a `Retry-After` header. Wait that long, then call again. |

The async request forms (`async`, `callback_url`) are not available on this
endpoint.

## Examples

The SDK examples need `scrapebadger` 0.82.0 or later, on PyPI and on npm.

```bash cURL theme={null}
curl -X POST 'https://scrapebadger.com/v1/google/resolve' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "results": [
      {"position": 2, "link_token": "sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG..."},
      {"position": 3, "link_token": "sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG..."},
      {"position": 4, "link_token": "sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG..."}
    ]
  }'
```

```python Python theme={null}
from scrapebadger import ScrapeBadger  # SDK 0.82.0 or later

async with ScrapeBadger(api_key="YOUR_API_KEY") as client:
    serp = await client.google.search.search("vinted api")

    # One call. Send only the results that have a link_token.
    pending = [r for r in serp["organic_results"] if r.get("link_token")]
    if pending:
        response = await client.google.search.resolve(pending)
        print(response["results"], response["retry_after_seconds"])

    # Or keep calling until every link is resolved or 240 seconds have passed.
    results = await client.google.search.resolve_all(
        serp["organic_results"], max_wait=240.0
    )
    for r in results:
        if r.get("error"):
            print(r["position"], "failed:", r["error"])
        elif r.get("link_token"):
            print(r["position"], "not ready, wait", r["retry_after_seconds"], "s")
        else:
            print(r["position"], r["link"])
```

```typescript Node theme={null}
import { ScrapeBadger } from 'scrapebadger' // SDK 0.82.0 or later

const client = new ScrapeBadger({ apiKey: 'YOUR_API_KEY' })

const serp = await client.google.search.search({ q: 'vinted api' })
const organic = serp.organic_results as any[]

// One call. Send only the results that have a link_token.
const pending = organic.filter((r) => r.link_token)
if (pending.length > 0) {
  const response = await client.google.search.resolve({ results: pending })
  console.log(response.results, response.retry_after_seconds)
}

// Or keep calling until every link is resolved or 240 seconds have passed.
const results = await client.google.search.resolveAll(organic, { maxWaitMs: 240000 })
for (const r of results) {
  if (r.error) console.log(r.position, 'failed:', r.error)
  else if (r.link_token) console.log(r.position, 'not ready, wait', r.retry_after_seconds, 's')
  else console.log(r.position, r.link)
}
```


## OpenAPI

````yaml POST /v1/google/resolve
openapi: 3.1.0
info:
  title: ScrapeBadger Google Scraper
  description: >-
    Dedicated API for scraping Google products (SERP, Maps, News, Hotels,
    Trends, Jobs, Shopping, Patents, Scholar, Autocomplete, Images, Videos,
    Finance, AI Mode, Lens, Products).
  version: 1.0.0
servers:
  - url: https://scrapebadger.com
    description: Production
security:
  - apiKeyAuth: []
paths:
  /v1/google/resolve:
    post:
      tags:
        - Google Search
      summary: Resolve Google result links
      description: >-
        Get the real URLs of search results whose `link` is still a Google
        redirect (`https://www.google.com/goto?url=...`).


        Send the `link_token` values from a Google Search or Light Search
        response, 1 to 25 results per call. Each row comes back in the order
        sent, as one of:


        - **resolved**: no `link_token`; `link` is the result's own URL.

        - **not ready**: `link_token` and `retry_after_seconds`. Wait that long,
        then send the row's `link_token` again. The token can differ from the
        one sent: always keep the latest.

        - **failed**: `link_token` and `error`. Do not send it again; run the
        search again if you need the link.


        The call never waits for Google and answers in about a second. A token
        sent before its wait is over is not an error and costs nothing: the row
        comes back not ready with the wait that is left.


        Costs 0 credits. The async request forms (`async`, `callback_url`) are
        not available on this endpoint.
      operationId: google_resolve_api_v1_resolve_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResolveRequest'
            examples:
              tokens:
                summary: Three results from one search
                value:
                  results:
                    - position: 2
                      link_token: sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG...
                    - position: 3
                      link_token: sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG...
                    - position: 4
                      link_token: sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG...
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleResolveResponse'
              examples:
                mixed:
                  summary: One resolved row, one not-ready row, one failed row
                  value:
                    results:
                      - position: 2
                        link: https://example.com/pricing
                      - position: 3
                        link_token: sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG...
                        retry_after_seconds: 12
                      - position: 4
                        link_token: sbl1.MTc5NTQ2NDAwMHx8Q0FFU2xBRUJ4Q0pG...
                        error: >-
                          Google no longer answers this link. Run the search
                          again for a fresh token.
                    retry_after_seconds: 12
                resolved:
                  summary: Every row resolved
                  value:
                    results:
                      - position: 2
                        link: https://example.com/pricing
                      - position: 3
                        link: https://example.org/docs/api
                      - position: 4
                        link: https://example.net/blog/guide
                    retry_after_seconds: null
        '422':
          description: >-
            Validation Error: the body has no `results`, more than 25 items, or
            an item without `link_token`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: >-
            Link resolution is temporarily unavailable. Wait the time in the
            `Retry-After` header, then call again.
          headers:
            Retry-After:
              description: Seconds to wait before calling again.
              schema:
                type: integer
components:
  schemas:
    ResolveRequest:
      properties:
        results:
          items:
            $ref: '#/components/schemas/ResolveItem'
          type: array
          maxItems: 25
          minItems: 1
          title: Results
          description: >-
            The results to resolve, 1 to 25 items. Each item needs a non-empty
            string `link_token`. Any other fields on an item (`position`,
            `title`, your own id) are returned unchanged on its row, so a search
            response's `organic_results` items can be sent as they are.
      type: object
      required:
        - results
      title: ResolveRequest
      description: Request body of `POST /v1/google/resolve`.
    GoogleResolveResponse:
      properties:
        results:
          items:
            $ref: '#/components/schemas/ResolvedItem'
          type: array
          title: Results
          description: One row per item sent, in the order sent.
        retry_after_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Retry After Seconds
          description: >-
            The smallest wait, in seconds, among the not-ready rows. `null` when
            no row is waiting.
      type: object
      required:
        - results
        - retry_after_seconds
      title: GoogleResolveResponse
      description: Response of `POST /v1/google/resolve`.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ResolveItem:
      properties:
        link_token:
          type: string
          minLength: 1
          title: Link Token
          description: >-
            The `link_token` of an organic result, from a Google Search or Light
            Search response or from an earlier resolve response.
      additionalProperties: true
      type: object
      required:
        - link_token
      title: ResolveItem
      description: >-
        One result to resolve: its `link_token`, plus any other fields. The
        other fields are returned unchanged on its row.
    ResolvedItem:
      properties:
        link:
          type: string
          title: Link
          description: >-
            On a resolved row: the result's own URL. On any other row: the
            `link` that was sent, if any.
        link_token:
          type: string
          title: Link Token
          description: >-
            Not present on a resolved row. On a not-ready row: the token to send
            next time. It can differ from the one sent, so always keep the
            latest. A failed row has it together with `error`.
        retry_after_seconds:
          type: integer
          minimum: 1
          title: Retry After Seconds
          description: >-
            Only on a not-ready row: how long to wait, in seconds, before
            sending the row's `link_token` again.
        error:
          type: string
          title: Error
          description: >-
            Only on a failed row: why the link could not be resolved. Do not
            send this `link_token` again. Run the search again if you need the
            link.
      additionalProperties: true
      type: object
      title: ResolvedItem
      description: >-
        One row of the response. Resolved: no `link_token`, and `link` is the
        result's own URL. Not ready: `link_token` and `retry_after_seconds`.
        Failed: `link_token` and `error`. Other fields sent on the item are
        returned unchanged.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.