Website map and link discovery

Before you fetch a site, you need to know what is on it. One call returns the addresses of a website – from the page you name and from the site’s sitemaps – each one once, ready to crawl.

Start with 50 free creditsOpen playground

You send

POST /v1/map
{
  "url": "https://shop.example/",
  "search": "/product/",
  "limit": 500
}
Endpoint
POST /v1/map
Cost
Each page or file read as one request
Plans
All plans, Free included
Failed requests
Not charged
Documentation
Step-by-step guide

Collecting addresses by hand means reading robots.txt, unpacking sitemap indexes and compressed files, merging them with the links on the page and removing duplicates and other domains – before the real work has even started.

How VirginProxy helps

  • POST /v1/map reads the page and the sitemaps named in robots.txt – or /sitemap.xml if there are none – including sitemap indexes and compressed files.
  • Only addresses of the same site, without #fragments, each one once; subdomains if you want them.
  • "search" keeps only addresses or link texts that contain a word – for example only the product pages.
  • Up to 5,000 addresses per call, each with its link text and where it was found.

How it works, step by step

  1. Name a page of the site

    Usually the home page. sitemap chooses the sources: include for links and sitemaps, skip for the page alone, only for the sitemaps alone.

  2. Narrow it down

    search keeps addresses or link texts that contain a word; limit sets how many come back, up to 5,000.

  3. Get the list

    Each address once – the page’s links first, in page order, then the sitemap entries. total says how many were found in all.

  4. Fetch what you need

    Send the addresses as a job, or start a crawl that finds and fetches the pages in one go.

Example request

The product pages of a shop, collected from its home page and its sitemaps.

curl https://api.virginproxy.com/v1/map \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example/",
    "search": "/product/",
    "limit": 500
  }'
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/map",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={
        "url": "https://shop.example/",
        "search": "/product/",
        "limit": 500
    },
    timeout=150,
)
data = r.json()
print(data["total"], data["cost"]["credits"])
const res = await fetch("https://api.virginproxy.com/v1/map", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.VP_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "url": "https://shop.example/",
    "search": "/product/",
    "limit": 500
  }),
});
const data = await res.json();
console.log(data.total, data.cost.credits);
$ch = curl_init("https://api.virginproxy.com/v1/map");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("VP_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://shop.example/",
        "search" => "/product/",
        "limit" => 500,
    ]),
    CURLOPT_TIMEOUT => 150,
]);
$data = json_decode(curl_exec($ch), true);
echo $data["total"], " ", $data["cost"]["credits"];
body := strings.NewReader(`{
  "url": "https://shop.example/",
  "search": "/product/",
  "limit": 500
}`)
req, _ := http.NewRequest("POST", "https://api.virginproxy.com/v1/map", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))
req.Header.Set("Content-Type", "application/json")

res, err := http.DefaultClient.Do(req)
if err != nil {
	log.Fatal(err)
}
defer res.Body.Close()
var data map[string]any
json.NewDecoder(res.Body).Decode(&data)
fmt.Println(data["total"], data["cost"].(map[string]any)["credits"])

Documentation for this feature · API reference

What comes back

The addresses, plus every read with its cost:

{
  "url": "https://shop.example/",
  "host": "shop.example",
  "links": [
    { "url": "https://shop.example/product/12", "text": "Desk lamp", "source": "page" },
    { "url": "https://shop.example/product/48", "source": "sitemap" }
  ],
  "total": 412,
  "truncated": false,
  "sitemaps": { "read": 1 },
  "requests": [
    { "url": "https://shop.example/", "status": 200, "credits": 1 },
    { "url": "https://shop.example/robots.txt", "status": 200, "credits": 1 },
    { "url": "https://shop.example/sitemap.xml", "status": 200, "credits": 1 }
  ],
  "cost": { "credits": 3 }
}

What it costs

A map has no price of its own: every page and file it reads is an ordinary request – 1 credit per started MB – and shows up in your request log. A typical map costs 3 credits; at most it reads the page, robots.txt and 5 sitemap files. max_credits sets an upper limit for the whole call, and requests lists every read with its cost.

Pricing and cost examples

Good to know

  • If your plan allows few requests per second, map waits for your rate between the reads instead of failing – on Free it simply takes a few seconds.
  • render loads the page in a browser first (10 credits or more), for menus built with JavaScript.
  • include_subdomains also keeps addresses such as blog.example.com when you map example.com.
  • If the page itself does not answer, the call fails like a request and costs nothing.

Questions

What does a map cost?

Every page and file it reads is an ordinary request, usually 1 credit each. A typical map reads the page, robots.txt and one sitemap: 3 credits.

What if a site has no sitemap?

Then you get the links of the page. A missing robots.txt or sitemap is no error – it is simply left out.

How many addresses can come back?

Up to 5,000 per call (limit, 1,000 by default). total says how many were found, truncated whether the list was cut.

Does map follow links to further pages?

No. It reads one page and the sitemaps. To go deeper, start a crawl.

Can I skip the page and read only the sitemaps?

Yes, with "sitemap": "only" – the page is then not loaded at all.

Try it with 50 free credits

Pick up where you left off

No card needed. Your first request takes two minutes.

Your credits, keys and recent requests are waiting in the dashboard.

Start with 50 free creditsGo to dashboard