POST/api/links1 credit

Extract all links from a page with metadata.

Request body

FieldTypeDescription
urlstringRequired. The URL to process.
optionsobjectOptional configuration (see below).

Options

OptionTypeDescription
filter"internal" | "external" | nullFilter links by type. Default: all links.
uniquebooleanDeduplicate by href. Default: true.
waitUntilstring"networkidle0", "networkidle2", "load", "domcontentloaded". Default: "networkidle0".

Example request

curl -X POST https://crawlapi.dev/api/links \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"url":"https://example.com","options":{"filter":"external"}}'

Example response

{
"success": true,
"data": {
"url": "https://example.com",
"total": 1,
"links": [
{
"href": "https://www.iana.org/domains/example",
"text": "More information...",
"isExternal": true
}
]
},
"credits_used": 1,
"credits_remaining": 499
}

Error codes

StatusMeaning
400Missing or invalid URL / bad options
401Missing or invalid API key
403Insufficient credits
405Wrong HTTP method (use POST)
429Rate limit exceeded (60/min)
500Server error