# Link Scraper API

> Link Scraper is a website link extractor API that pulls internal and external links from any webpage URL in real time. It resolves relative paths to absolute URLs, strips empty fragments, and returns anchor text with internal and external counts.

**Endpoint:** `POST https://api.apiverve.com/v1/linkscraper`  
**Category:** Data Scraping  
**Cost:** 25 credits per call  
**Canonical page:** https://apiverve.com/marketplace/linkscraper

## Overview

Link Scraper works by parsing the HTML content of a web page to extract all the links. It returns the links in a structured format, including the link URL, title, and more.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/linkscraper" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html","maxlinks":20,"includequery":false,"unique":true}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | Yes | The URL of the web page to scrape links from (a full URL or a bare domain such as example.com; https:// is assumed when no scheme is given) |
| `maxlinks` | number | No | Maximum number of links to scrape and return. default 50. Premium field |
| `includequery` | boolean | No | Include query strings in the scraped links. default false |
| `unique` | boolean | No | Return each href once, skipping repeats before the maxlinks cap (by default every anchor is returned, repeats included). default false |

## Response fields

- `url` — string · The scraped page's URL, normalized to a bare http:// origin with any tabs, newlines and carriage returns stripped
- `linkCount` — number · Total number of links returned, after filtering out empty anchors and page-fragment links
- `externalLinkCount` — number · Number of returned links that point to a different domain than the scraped page
- `internalLinkCount` — number · Number of returned http(s) links that point to the same domain as the scraped page
  - `links.0.text` — string · The link's visible anchor text, with tabs, newlines and carriage returns removed; icon links fall back to the aria-label, title or inner image alt text
  - `links.0.href` — string · The link's destination URL, resolved to an absolute URL when the source was root-relative
  - `links.0.external` — boolean · Whether the link points to a different domain than the scraped page; false for tel:, mailto: and javascript: links, which have no domain
- `uniqueDomains` — array · List of unique external domains found · (premium)
- `maxLinksReached` — boolean · Whether the number of links found met or exceeded the maximum link limit, meaning more links may exist beyond what was returned

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "url": "http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html",
    "linkCount": 16,
    "externalLinkCount": 13,
    "internalLinkCount": 3,
    "links": [
      {
        "text": "Documentation",
        "href": "http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html/index.html",
        "external": false
      },
      {
        "text": "Amazon EC2 Instance Types Guide",
        "href": "https://docs.aws.amazon.com/ec2/latest/instancetypes/instance-types.html",
        "external": true
      },
      {
        "text": "Amazon EC2 Auto Scaling",
        "href": "https://docs.aws.amazon.com/autoscaling/",
        "external": true
      }
    ],
    "uniqueDomains": [
      "docs.aws.amazon.com",
      "aws.amazon.com"
    ],
    "maxLinksReached": false
  }
}
```

## Use cases

- **Site Architecture Audits** — Crawlers inspect internal navigation paths and anchor text across catalog pages to detect orphan URLs and track link equity distribution.
- **Dead Link Discovery** — Run published articles through the scraper to catch external links, resolve relative URLs, and forward destination targets to status checkers.
- **Competitor Footprint Mapping** — Growth analysts feed rival blog posts into the endpoint to inventory citation targets and detect outbound partner referrals.
- **Web Archival Pipelines** — When archiving resource directories, extract all outbound destinations and clean anchor text before caching document references.

## SDKs

- **npm** — `npm install @apiverve/linkscraper` (https://www.npmjs.com/package/@apiverve/linkscraper)
- **PyPI** — `pip install apiverve-linkscraper` (https://pypi.org/project/apiverve-linkscraper/)
- **NuGet** — `dotnet add package APIVerve.API.LinkScraper` (https://www.nuget.org/packages/APIVerve.API.LinkScraper)
- **Source** — https://github.com/apiverve/linkscraper-api

## More

- Full reference: https://docs.apiverve.com/ref/linkscraper
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
