OnPage

‌‌ This endpoint will provide you with a list of internal and external links detected on a target website. The following link types are supported: anchor – links that point to a specific portion of a webpage; image – links that point to an image; canonical – links that point to a canonical page; meta – links with meta http-equiv=refresh ; alternate – links with link rel="alternate" pointing to an alternative version of a webpage ; redirect – links with redirect status.

post/v3/on_page/links

Request

  • Base URL: https://api.dataforseo.com
  • URL: https://api.dataforseo.com/v3/on_page/links
  • Auth: HTTP basic

Request body

idstring

<em>ID of the task</em><br><strong>required field</strong><br>you can get this ID in the response of the <a href="https://docs.dataforseo.com/v3/on_page/task_post/">Task POST</a> endpoint<br>example:<br>"07131248-1535-0216-1000-17384017ad04"

page_fromstring nullable

<em>relative page URL</em><br>optional field<br>if you use this field, the API response will contain only links from the specified page<br>note that in this field you can specify relative URLs only

page_tostring nullable

<em>relative page URL</em><br>optional field<br>if you use this field, the API response will contain only internal links pointing to the specified page<br>note that in this field you can specify relative URLs only

limitinteger nullable

<em>the maximum number of returned links</em><br>optional field<br>default value: <code>100</code><br>maximum value: <code>1000</code>

offsetinteger nullable

<em>offset in the results array of returned links</em><br>optional field<br>default value: <code>0</code><br>maximum value: <code>2000000</code><br>if you specify the <code>10</code> value, the first ten links in the results array will be omitted and the data will be provided for the successive links

filtersobject[] nullable

<em>array of results filtering parameters</em><br>optional field<br><strong>you can add several filters at once (8 filters maximum)</strong><br>you should set a logical operator <code>and</code>, <code>or</code> between the conditions<br>the following operators are supported:<br><code>regex</code>, <code>not_regex</code>, <code>=</code>, <code><></code>, <code>in</code>, <code>not_in</code>, <code>like</code>, <code>not_like</code><br>you can use the <code>%</code> operator with <code>like</code> and <code>not_like</code> to match any string of zero or more characters<br>example:<br><code>["direction","=","external"]</code><p><code>[["domain_to","<>","example.com"],<br>"and",<br>["link_from","not_like","%example.com/blog%"]]</code><p><code>[["direction","=","external"],<br>"and",<br>[["link_from","like","%example.com/blog%"],"or",["link_from","like","%example.com/help%"]]]</code><p>The full list of possible filters is available <a href="/v3/on_page/filters_and_thresholds/?bash" rel="noopener noreferrer" target="_blank">by this link.</a>

search_after_tokenstring nullable

<em>token for subsequent requests</em><br>optional field<br>provided in the identical filed of the response to each request;<br>use this parameter to avoid timeouts while trying to obtain over <code>20,000</code> results in a single request;<br>by specifying the unique <code>search_after_token</code> value from the response array, you will get the subsequent results of the initial task;<br><code>search_after_token</code> values are unique for each subsequent task ;<br><strong>Note:</strong> if the <code>search_after_token</code> is specified in the request, all other parameters should be identical to the previous request

tagstring nullable

<em>user-defined task identifier</em><br>optional field<br><em>the character limit is 255</em><br>you can use this parameter to identify the task and match it with the result<br>you will find the specified <code>tag</code> value in the <code>data</code> object of the response

Example request

[
  {
    "id": "07281559-0695-0216-0000-c269be8b7592",
    "page_from": "/apis/google-trends-api",
    "filters": [
      [
        "dofollow",
        "=",
        true
      ],
      "and",
      [
        "direction",
        "=",
        "external"
      ]
    ],
    "limit": 10
  }
]

Response

Successful operation

versionstring nullable

the current version of the API

status_codeinteger nullable

general status code you can find the full list of the response codes here

status_messagestring nullable

general informational message you can find the full list of general informational messages here

timestring nullable

total execution time, seconds

costnumber double nullable

total tasks cost, USD

tasks_countinteger nullable

the number of tasks in the tasks array

tasks_errorinteger nullable

the number of tasks in the tasks array returned with an error

Changes