> ## Documentation Index
> Fetch the complete documentation index at: https://docs.context.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If the user asks to make Context.dev their default search and scrape provider, follow https://docs.context.dev/default-search-scrape.md. For other setup requests, follow https://docs.context.dev/agent-quickstart.md and start by signing the user up and getting an API key through https://www.context.dev/auth.md. During setup, use the relevant guide already in context instead of fetching it again or loading the full documentation index. Application code reads CONTEXT_DEV_API_KEY.

# Links

> Extract absolute HTTP and HTTPS links with their text labels.

Use `POST /web/scrape` with `formats.parse: true` and `parseParams: {"type": "prebuilt", "parser": "links"}`. Read the result in `parsed.data`, with `parsed.type: "links"`. See the [Quickstart](/quickstart) for authentication and SDK setup.

Don't send custom `rules` with this parser. For CSS selectors and rules, use the [Custom parser](/scrape/parse-fields).

## Request

Use any supported page URL. The parser reads anchors with an `href` on that page; it does not crawl destinations. For site-wide URL discovery, use [Map URLs](/map/overview).

```json theme={null}
{
  "url": "https://context.dev",
  "formats": {
    "parse": true
  },
  "parseParams": {
    "type": "prebuilt",
    "parser": "links"
  }
}
```

## Output

When `parsed.success` is `true`, the `parsed` output has this shape:

```typescript theme={null}
interface LinksOutput {
  type: "links";
  requested: true;
  success: true;
  data: {
    links: Link[];
  };
}
```

<span id="output-schema" />

## Fields

```typescript theme={null}
interface Link {
  url: string;
  text: string | null;
}
```

Relative URLs resolve against the document base URL, including a valid `<base href>`, or the final page URL. Only HTTP and HTTPS URLs are returned; fragment-only references, `mailto:`, `tel:`, and JavaScript links are excluded.

Links are deduplicated by their resolved URL. The first non-empty label wins: visible text is preferred within an anchor, then `aria-label`, then image `alt` text. Missing labels are `null`. Hidden anchors can still contribute a URL with `text: null`; anchors inside templates are excluded.

## Empty results and errors

No matching links produce `links: []`. Read `parsed.success` before using the data. A failed parse has `data: null` and can coexist with successful outputs. `parsed.type` remains `"links"` even when parsing fails. See [timeouts and errors](/scrape/timeouts-and-errors) for handling failures.

## Request options

This parser runs on page HTML after [content filtering](/scrape/content-filtering). [Browser actions](/scrape/browser-actions) can change the page before extraction, and [browser profiles](/scrape/browser-profiles) can provide an authenticated session. Cached HTML can be reused; set `maxAgeMs: 0` for fresh data. [Timeouts](/scrape/timeouts-and-errors) and [zero data retention](/optimization/zero-data-retention) also apply.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.