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

# Get Pages By Links

> Rank the pages of a domain by inbound links from Ahrefs Site Explorer: by external backlinks and referring domains (with new and lost links over a period) or by internal links

Rank the pages of a domain by inbound links from Ahrefs Site Explorer: by external backlinks and referring domains (with new and lost links over a period) or by internal links. Useful for finding link equity to redistribute and orphaned or broken linked pages.

|                      |                             |
| -------------------- | --------------------------- |
| **App**              | Ahrefs                      |
| **Operation ID**     | `ahrefs_get_pages_by_links` |
| **Type**             | Action                      |
| **Connection**       | `ahrefs` (required)         |
| **Credits per run**  | Free                        |
| **Agent / MCP tool** | Yes                         |

## Inputs

| Field        | Type                                | Required | Default      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------ | ----------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `target`     | string                              | Yes      | -            | The domain, subdomain or subfolder whose pages to rank by inbound links (e.g. example.com).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `mode`       | string or SelectableOption          | No       | `subdomains` | How to interpret the target: 'subdomains' (domain and all subdomains, default), 'domain' (the exact host only), 'prefix' (every URL starting with the target), or 'exact' (the exact URL only).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `report`     | string or SelectableOption          | No       | `backlinks`  | 'backlinks' (default): pages ranked by external backlinks and referring domains. 'internal\_links': pages ranked by internal links.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `history`    | string or SelectableOption          | No       | `all_time`   | Backlinks report only: 'live' counts only live links, 'all\_time' also includes lost ones. Ignored when since\_date is set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `since_date` | string                              | No       | -            | Backlinks report only: include links lost since this date (YYYY-MM-DD). Overrides history.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `metrics`    | array of string or SelectableOption | No       | -            | Fields to return (url\_to is always included). Both reports: title\_target, url\_rating\_target, links\_to\_target, dofollow\_to\_target, nofollow\_to\_target, redirects\_to\_target, first\_seen\_link, last\_seen, last\_visited\_target, http\_code\_target, target\_redirect, languages\_target, powered\_by\_target. Backlinks report only: refdomains\_target (5 units), top\_domain\_rating\_source, new\_links\_to\_target, lost\_links\_to\_target, is\_spam. Internal links report only: canonical\_to\_target. Defaults to title\_target, url\_rating\_target, links\_to\_target, dofollow\_to\_target, refdomains\_target (backlinks) or canonical\_to\_target (internal links), http\_code\_target. |
| `filters`    | array of FilterItem                 | No       | -            | Filters on the report's fields, e.g. links\_to\_target GREATER\_THAN 10 or url\_to CONTAINS '/blog/'.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `orders`     | array of OrderItem                  | No       | -            | Sort by one field (http\_code\_target, languages\_target, last\_visited\_target, powered\_by\_target, target\_redirect and title\_target are not sortable).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `limit`      | integer                             | No       | `100`        | Maximum number of pages to return. Defaults to 100. Your Ahrefs plan caps rows per request (Lite 100, Standard 250, Advanced 500).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

### FilterItem

| Field      | Type                       | Required | Default | Description                                                                                                                                                                             |
| ---------- | -------------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `field`    | string or SelectableOption | Yes      | -       | The field to filter on, must be one of the current selected metrics or dimensions.                                                                                                      |
| `operator` | string                     | Yes      | -       | The operator to use for filtering. Must be one of the supported values. Use REGEXP\_MATCH to search/filter by multiple OR values like '.*(summer\|holiday).*'                           |
| `value`    | string                     | Yes      | -       | The value to filter by, always as a string: text, a number, or a regex. For IN\_LIST and NOT\_IN\_LIST, pass the values as one comma-separated string such as 'a,b,c', not as an array. |

### OrderItem

| Field       | Type                       | Required | Default | Description                                                                      |
| ----------- | -------------------------- | -------- | ------- | -------------------------------------------------------------------------------- |
| `field`     | string or SelectableOption | Yes      | -       | The field to sort by. must be one of the current selected metrics or dimensions. |
| `direction` | string                     | Yes      | -       | The order to sort by, must be one of 'ASC', 'DESC'                               |

### SelectableOption

| Field   | Type   | Required | Default | Description |
| ------- | ------ | -------- | ------- | ----------- |
| `value` | string | Yes      | -       |             |
| `label` | string | Yes      | -       |             |

## Output

**Type**: `List[Dict]`

Returns one row per page: url\_to plus the selected fields such as title\_target, url\_rating\_target, links\_to\_target, dofollow\_to\_target, nofollow\_to\_target, redirects\_to\_target, refdomains\_target, top\_domain\_rating\_source, new\_links\_to\_target, lost\_links\_to\_target, canonical\_to\_target (internal links), http\_code\_target, target\_redirect, first\_seen\_link, last\_seen, is\_spam.

**Fields**: `url_to`, `title_target`, `url_rating_target`, `links_to_target`, `dofollow_to_target`, `refdomains_target`, `http_code_target`

**Example**:

```json theme={"dark"}
[
  {
    "url_to": "https://ahrefs.com/backlink-checker",
    "title_target": "Free Backlink Checker by Ahrefs",
    "url_rating_target": 27.0,
    "links_to_target": 812345,
    "dofollow_to_target": 640120,
    "refdomains_target": 4887,
    "http_code_target": 200
  }
]
```
