/links - Retrieve links from a webpage·续
Retrieve only links from the same domain
Set the excludeExternalLinks parameter to true to exclude links pointing to external domains. By default, this is set to false.
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-run/links' \
-H 'Authorization: Bearer <apiToken>' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://developers.cloudflare.com/",
"excludeExternalLinks": true
}'
Handling JavaScript-heavy pages
For JavaScript-heavy pages or Single Page Applications (SPAs), the default page load behavior may return empty or incomplete results. This happens because the browser considers the page loaded before JavaScript has finished rendering the content.
The simplest solution is to use the gotoOptions.waitUntil parameter set to networkidle0 or networkidle2:
{
"url": "https://example.com",
"gotoOptions": {
"waitUntil": "networkidle0"
}
}
For faster responses, advanced users can use waitForSelector to wait for a specific element instead of waiting for all network activity to stop. This requires knowing which CSS selector indicates the content you need has loaded. For more details, refer to Quick Actions timeouts.
Set a custom user agent
You can change the user agent at the page level by passing userAgent as a top-level parameter in the JSON body. This is useful if the target website serves different content based on the user agent.
Note
The userAgent parameter does not bypass bot protection. Requests from Browser Run will always be identified as a bot. Because the User-Agent is configurable, destination servers looking to identify or block Browser Run requests should use the non-configurable headers rather than relying on the User-Agent string.
Troubleshooting
If you have questions or encounter an error, see the Browser Run FAQ and troubleshooting guide.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/browser-run/quick-actions/links-endpoint/#page","headline":"/links - Retrieve links from a webpage","description":"Extract all links from a webpage, including hidden ones, using the Browser Run /links endpoint.","url":"https://developers.cloudflare.com/browser-run/quick-actions/links-endpoint/","inLanguage":"en","image":"https://developers.cloudflare.com/browser-run/quick-actions/links-endpoint/og.png?v=32fd75d1ed3ecd8f","dateModified":"2026-10-12","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Convert webpage content to Markdown format using the Browser Run /markdown endpoint. title: /markdown - Extract Markdown from a webpage image: https://developers.cloudflare.com/browser-run/quick-actions/markdown-endpoint/og.png?v=f381b12e7d5a994d
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/browser-run/llms.txt
Use this file to discover all available pages before exploring further.
Docs