API Reference

Links

Extract links from a web page with optional filtering by type (internal/external) and CSS selector narrowing.

Use this to list every link on a page with its text, absolute URL, and whether it points inside or outside the site. Useful for crawling, sitemap building, and outbound link audits.

1 credit per request. Add render_js=true for pages that build their content with JavaScript (+4 credits).

Quick example

curl -G "https://api.webscraperapi.ai/v1/links" \
  -H "Authorization: Bearer $WEBSCRAPERAPI_API_KEY" \
  --data-urlencode "url=https://example.com" \
  --data-urlencode "link_type=external" \
  --data-urlencode "output=json"

Leave out link_type to get internal and external links together. Use css_selector to keep only the links in one part of the page (e.g., css_selector=nav or css_selector=article).

Full API reference

GET
/v1/links

Query Parameters

url*string

The URL to extract links from.

Formaturi
Length1 <= length <= 2083
link_type?|

Filter links: 'internal' or 'external'. Omit for all links.

css_selector?|

Optional CSS selector to narrow content.

render_js?|

Whether to render JavaScript.

Defaultfalse
output?|

Output format. Falls back to Accept header when not provided.

timeout_ms?|

Request timeout in milliseconds.

Response Body

application/json

application/json

curl -X GET "https://api.webscraperapi.ai/v1/links?url=http%3A%2F%2Fexample.com"
null
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  }
}