---
title: /links - Retrieve links from a webpage · Cloudflare Browser Rendering docs
description: The /links endpoint retrieves all links from a webpage. It can be
  used to extract all links from a page, including those that are hidden.
lastUpdated: 2025-11-17T19:02:41.000Z
chatbotDeprioritize: false
source_url:
  html: https://developers.cloudflare.com/browser-rendering/rest-api/links-endpoint/
  md: https://developers.cloudflare.com/browser-rendering/rest-api/links-endpoint/index.md
---

The `/links` endpoint retrieves all links from a webpage. It can be used to extract all links from a page, including those that are hidden.

## Endpoint

```txt
https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/links
```

## Required fields

You must provide either `url` or `html`:

* `url` (string)
* `html` (string)

## Common use cases

* Collect only user-visible links for UX or SEO analysis
* Crawl a site by discovering links on seed pages
* Validate navigation/footers and detect broken or external links

## Basic usage

### Get all links on a page

* curl

  This example grabs all links from the [Cloudflare Doc's homepage](https://developers.cloudflare.com/). The response will be a JSON array containing the links found on the page.

  ```bash
  curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/links' \
    -H 'Authorization: Bearer <apiToken>' \
    -H 'Content-Type: application/json' \
    -d '{
      "url": "https://developers.cloudflare.com/"
    }'
  ```

  ```json
  {
    "success": true,
    "result": [
      "https://developers.cloudflare.com/",
      "https://developers.cloudflare.com/products/",
      "https://developers.cloudflare.com/api/",
      "https://developers.cloudflare.com/fundamentals/api/reference/sdks/",
      "https://dash.cloudflare.com/",
      "https://developers.cloudflare.com/fundamentals/subscriptions-and-billing/",
      "https://developers.cloudflare.com/api/",
      "https://developers.cloudflare.com/changelog/",
  64 collapsed lines
      "https://developers.cloudflare.com/glossary/",
      "https://developers.cloudflare.com/reference-architecture/",
      "https://developers.cloudflare.com/web-analytics/",
      "https://developers.cloudflare.com/support/troubleshooting/http-status-codes/",
      "https://developers.cloudflare.com/registrar/",
      "https://developers.cloudflare.com/1.1.1.1/setup/",
      "https://developers.cloudflare.com/workers/",
      "https://developers.cloudflare.com/pages/",
      "https://developers.cloudflare.com/r2/",
      "https://developers.cloudflare.com/images/",
      "https://developers.cloudflare.com/stream/",
      "https://developers.cloudflare.com/products/?product-group=Developer+platform",
      "https://developers.cloudflare.com/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/",
      "https://developers.cloudflare.com/workers-ai/",
      "https://developers.cloudflare.com/vectorize/",
      "https://developers.cloudflare.com/ai-gateway/",
      "https://playground.ai.cloudflare.com/",
      "https://developers.cloudflare.com/products/?product-group=AI",
      "https://developers.cloudflare.com/cloudflare-one/access-controls/policies/",
      "https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/",
      "https://developers.cloudflare.com/cloudflare-one/traffic-policies/",
      "https://developers.cloudflare.com/cloudflare-one/remote-browser-isolation/",
      "https://developers.cloudflare.com/learning-paths/replace-vpn/concepts/",
      "https://developers.cloudflare.com/products/?product-group=Cloudflare+One",
      "https://workers.cloudflare.com/playground# ",
      "https://workers.cloudflare.com/playground# ",
      "https://workers.cloudflare.com/playground# ",
      "https://workers.cloudflare.com/playground# ",
      "https://workers.cloudflare.com/playground# ",
      "https://developers.cloudflare.com/cloudflare-one/team-and-resources/devices/warp/",
      "https://developers.cloudflare.com/ssl/origin-configuration/origin-ca/",
      "https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/",
      "https://developers.cloudflare.com/ssl/origin-configuration/ssl-modes/",
      "https://developers.cloudflare.com/waf/custom-rules/use-cases/allow-traffic-from-specific-countries/",
      "https://discord.cloudflare.com/",
      "https://x.com/CloudflareDev",
      "https://community.cloudflare.com/",
      "https://github.com/cloudflare",
      "https://developers.cloudflare.com/sponsorships/",
      "https://developers.cloudflare.com/style-guide/",
      "https://blog.cloudflare.com/",
      "https://developers.cloudflare.com/fundamentals/",
      "https://support.cloudflare.com/",
      "https://www.cloudflarestatus.com/",
      "https://www.cloudflare.com/trust-hub/compliance-resources/",
      "https://www.cloudflare.com/trust-hub/gdpr/",
      "https://www.cloudflare.com/",
      "https://www.cloudflare.com/people/",
      "https://www.cloudflare.com/careers/",
      "https://radar.cloudflare.com/",
      "https://speed.cloudflare.com/",
      "https://isbgpsafeyet.com/",
      "https://rpki.cloudflare.com/",
      "https://ct.cloudflare.com/",
      "https://x.com/cloudflare",
      "http://discord.cloudflare.com/",
      "https://www.youtube.com/cloudflare",
      "https://github.com/cloudflare/cloudflare-docs",
      "https://www.cloudflare.com/privacypolicy/",
      "https://www.cloudflare.com/website-terms/",
      "https://www.cloudflare.com/disclosure/",
      "https://www.cloudflare.com/trademark/"
    ]
  }
  ```

* TypeScript SDK

  ```typescript
  import Cloudflare from "cloudflare";


  const client = new Cloudflare({
    apiToken: process.env["CLOUDFLARE_API_TOKEN"],
  });


  const links = await client.browserRendering.links.create({
    account_id: process.env["CLOUDFLARE_ACCOUNT_ID"],
    url: "https://developers.cloudflare.com/",
  });


  console.log(links);
  ```

## Advanced usage

Looking for more parameters?

Visit the [Browser Rendering API reference](https://developers.cloudflare.com/api/resources/browser_rendering/subresources/links/methods/create/) for all available parameters, such as setting HTTP credentials using `authenticate`, setting `cookies`, and customizing load behavior using `gotoOptions`.

### Retrieve only visible links

Set the `visibleLinksOnly` parameter to `true` to only return links that are visible on the page. By default, this is set to `false`.

```bash
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/links' \
  -H 'Authorization: Bearer <apiToken>' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://developers.cloudflare.com/",
    "visibleLinksOnly": true
  }'
```

```json
{
  "success": true,
  "result": [
    "https://developers.cloudflare.com/",
    "https://developers.cloudflare.com/products/",
    "https://developers.cloudflare.com/api/",
    "https://developers.cloudflare.com/fundamentals/api/reference/sdks/",
    "https://dash.cloudflare.com/",
    "https://developers.cloudflare.com/fundamentals/subscriptions-and-billing/",
    "https://developers.cloudflare.com/api/",
    "https://developers.cloudflare.com/changelog/",
64 collapsed lines
    "https://developers.cloudflare.com/glossary/",
    "https://developers.cloudflare.com/reference-architecture/",
    "https://developers.cloudflare.com/web-analytics/",
    "https://developers.cloudflare.com/support/troubleshooting/http-status-codes/",
    "https://developers.cloudflare.com/registrar/",
    "https://developers.cloudflare.com/1.1.1.1/setup/",
    "https://developers.cloudflare.com/workers/",
    "https://developers.cloudflare.com/pages/",
    "https://developers.cloudflare.com/r2/",
    "https://developers.cloudflare.com/images/",
    "https://developers.cloudflare.com/stream/",
    "https://developers.cloudflare.com/products/?product-group=Developer+platform",
    "https://developers.cloudflare.com/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/",
    "https://developers.cloudflare.com/workers-ai/",
    "https://developers.cloudflare.com/vectorize/",
    "https://developers.cloudflare.com/ai-gateway/",
    "https://playground.ai.cloudflare.com/",
    "https://developers.cloudflare.com/products/?product-group=AI",
    "https://developers.cloudflare.com/cloudflare-one/access-controls/policies/",
    "https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/",
    "https://developers.cloudflare.com/cloudflare-one/traffic-policies/",
    "https://developers.cloudflare.com/cloudflare-one/remote-browser-isolation/",
    "https://developers.cloudflare.com/learning-paths/replace-vpn/concepts/",
    "https://developers.cloudflare.com/products/?product-group=Cloudflare+One",
    "https://workers.cloudflare.com/playground# ",
    "https://workers.cloudflare.com/playground# ",
    "https://workers.cloudflare.com/playground# ",
    "https://workers.cloudflare.com/playground# ",
    "https://workers.cloudflare.com/playground# ",
    "https://developers.cloudflare.com/cloudflare-one/team-and-resources/devices/warp/",
    "https://developers.cloudflare.com/ssl/origin-configuration/origin-ca/",
    "https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/",
    "https://developers.cloudflare.com/ssl/origin-configuration/ssl-modes/",
    "https://developers.cloudflare.com/waf/custom-rules/use-cases/allow-traffic-from-specific-countries/",
    "https://discord.cloudflare.com/",
    "https://x.com/CloudflareDev",
    "https://community.cloudflare.com/",
    "https://github.com/cloudflare",
    "https://developers.cloudflare.com/sponsorships/",
    "https://developers.cloudflare.com/style-guide/",
    "https://blog.cloudflare.com/",
    "https://developers.cloudflare.com/fundamentals/",
    "https://support.cloudflare.com/",
    "https://www.cloudflarestatus.com/",
    "https://www.cloudflare.com/trust-hub/compliance-resources/",
    "https://www.cloudflare.com/trust-hub/gdpr/",
    "https://www.cloudflare.com/",
    "https://www.cloudflare.com/people/",
    "https://www.cloudflare.com/careers/",
    "https://radar.cloudflare.com/",
    "https://speed.cloudflare.com/",
    "https://isbgpsafeyet.com/",
    "https://rpki.cloudflare.com/",
    "https://ct.cloudflare.com/",
    "https://x.com/cloudflare",
    "http://discord.cloudflare.com/",
    "https://www.youtube.com/cloudflare",
    "https://github.com/cloudflare/cloudflare-docs",
    "https://www.cloudflare.com/privacypolicy/",
    "https://www.cloudflare.com/website-terms/",
    "https://www.cloudflare.com/disclosure/",
    "https://www.cloudflare.com/trademark/"
  ]
}
```

### 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`.

```bash
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/links' \
  -H 'Authorization: Bearer <apiToken>' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://developers.cloudflare.com/",
    "excludeExternalLinks": true
  }'
```

### 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 Rendering will always be identified as a bot.

## Troubleshooting

If you have questions or encounter an error, see the [Browser Rendering FAQ and troubleshooting guide](https://developers.cloudflare.com/browser-rendering/faq/).
