Google Resolve API Documentation

POST   /api/v1/search?engine=google_resolve

Google serves some result links as encrypted redirects (https://www.google.com/goto?url=...). Most redirect links in a SearchApi response come with a token named after their field, such as link_token beside link or website_token beside website. Ads do not. Send those tokens to this API to get the destination URLs. Requests use no credits, and are limited to 120 per minute and 5 at a time.

Reading a response

Results come back in the order you sent them, one row per item, so a repeated token gets a row each time. A request attempts up to 25 distinct links that still need resolving, and any others come back with their token.

Row has Meaning What to do
No link_token Resolved Use link, the destination URL. A domain you sent becomes its host.
link_token and error Will not resolve Do not send it again.
link_token, no error Not ready Send it again after retry_after seconds, or right away when it is 0. It keeps any link you sent. Stop once a few resends in a row resolve nothing new, and keep the link you have.

Every item needs a link_token, and one item without it fails the whole request. Every other field you send on an item comes back unchanged on its row, so you can tag items with your own ids and match each row to your records. The destination always comes back in link, so a result that carries a link_token can be sent as it is, but for a website_token send the token as link_token with your id, not the whole result. Only the item's own link_token is resolved, not tokens nested inside it, and an error field you send is dropped.

A token has no expiry of its own and is not tied to your account, but Google can stop answering the redirect behind it. That comes back as an error row, or as a row that stays not ready.

API Parameters

Results

  • Name
    results
    Required
    Required
    Description

    The links to resolve, at most 100 items, in the JSON body. Each item is an object with the link_token returned beside a Google redirect link in a SearchApi response, and one item without it fails the whole request. A token is named after its field, so a redirect in website comes with website_token: send any of them as link_token. An item can also carry fields of your own, such as an id for your records, and they come back on its row with the destination in link. An error field you send is dropped. The whole array, your fields included, can be at most 1 MB as JSON.

Engine

  • Name
    engine
    Required
    Required
    Description

    Parameter defines an engine that will be used to retrieve real-time data. It must be set to google_resolve.

API key

  • Name
    api_key
    Required
    Required
    Description

    The api_key authenticates your requests. Use it as a query parameter (https://www.searchapi.io/api/v1/search?api_key=YOUR_API_KEY) or in the Authorization header (Bearer YOUR_API_KEY).

API Examples

Send a POST with this body:

{
  "engine": "google_resolve",
  "results": [
    {"link_token": "LINK_TOKEN_A", "id": "result-1"},
    {"link_token": "LINK_TOKEN_A", "id": "result-2"},
    {"link_token": "LINK_TOKEN_B", "id": "result-3"},
    {"link_token": "LINK_TOKEN_C", "id": "result-4"}
  ]
}

Its response keeps each row's id: result-1 and result-2 share a token and both resolved, result-3 is not ready, and result-4 will not resolve. Only results and retry_after are shown.

{
  "results": [
    {"id": "result-1", "link": "https://example.com/page"},
    {"id": "result-2", "link": "https://example.com/page"},
    {"link_token": "LINK_TOKEN_B", "id": "result-3"},
    {"link_token": "LINK_TOKEN_C", "id": "result-4", "error": "Google did not return a destination for this link."}
  ],
  "retry_after": 7
}