NAVNavbar
Logo
cURL php NodeJS Python cSharp

Backlinks History


This endpoint will provide you with historical backlinks data back to the beginning of 2019. You can receive the number of backlinks a given domain had in a specific time period, the number of new & lost backlinks, referring domains, and more.

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-access

<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
$client = new RestClient($api_url, null, 'login', 'password');
$post_array = array();
// simple way to set a task
$post_array[] = array(
   "target" => "cnn.com",
   "date_from" => "2020-01-01",
   "date_to" => "2021-01-01"
);
try {
   // POST /v3/backlinks/history/live
   $result = $client->post('/v3/backlinks/history/live', $post_array);
   print_r($result);
   // do something with post result
} catch (RestClientException $e) {
   echo "n";
   print "HTTP code: {$e->getHttpCode()}n";
   print "Error code: {$e->getCode()}n";
   print "Message: {$e->getMessage()}n";
   print  $e->getTraceAsString();
   echo "n";
}
$client = null;
?>

The above command returns JSON structured like this:

{
  "version": "0.1.20230825",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.1571 sec.",
  "cost": 0.02012,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "09291750-1535-0266-0000-7aab5e588023",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.0662 sec.",
      "cost": 0.02012,
      "result_count": 1,
      "path": [
        "v3",
        "backlinks",
        "history",
        "live"
      ],
      "data": {
        "api": "backlinks",
        "function": "history",
        "target": "ibm.com",
        "date_from": "2020-08-01",
        "date_to": "2021-01-01"
      },
      "result": [
        {
          "target": "ibm.com",
          "date_from": "2020-08-01",
          "date_to": "2021-01-01",
          "items_count": 4,
          "items": [
            {
              "type": "backlinks_history",
              "date": "2020-08-31 00:00:00 +00:00",
              "rank": 598,
              "backlinks": 7960551,
              "new_backlinks": 528250,
              "lost_backlinks": 243962,
              "new_referring_domains": 3439,
              "lost_referring_domains": 860,
              "crawled_pages": 2317216,
              "info": {
                "server": null,
                "cms": null,
                "platform_type": null,
                "ip_address": "104.109.76.210",
                "country": null,
                "is_ip": false,
                "target_spam_score": 0
              },
              "internal_links_count": 48310894,
              "external_links_count": 7036559,
              "broken_backlinks": 0,
              "broken_pages": 150008,
              "referring_domains": 191515,
              "referring_domains_nofollow": 4489,
              "referring_main_domains": 146676,
              "referring_main_domains_nofollow": 3438,
              "referring_ips": 95885,
              "referring_subnets": 54931,
              "referring_pages": 7265491,
              "referring_links_tld": {
                "com": 3581003,
                "org": 883349,
                "tv": 868565,
                "edu": 595793,
                "net": 347933,
                "ru": 115490,
                "io": 113234,
                "de": 61048,
                "com.br": 55193,
                "fr": 34685
              },
              "referring_links_types": {
                "anchor": 7206570,
                "redirect": 57359,
                "canonical": 1545,
                "alternate": 17
              },
              "referring_links_attributes": {
                "nofollow": 973850,
                "noopener": 753384,
                "noreferrer": 144929,
                "external": 82838,
                "ugc": 6768,
                "bookmark": 1519,
                "alternate": 668,
                "author": 474,
                "tag": 350,
                "sponsored": 110
              },
              "referring_links_platform_types": {
                "unknown": 6418758,
                "cms": 696561,
                "blogs": 631531,
                "wikis": 38885,
                "ecommerce": 18248,
                "message-boards": 15656
              },
              "referring_links_semantic_locations": {
                "": 3687993,
                "footer": 1779772,
                "section": 997508,
                "article": 426672,
                "aside": 114124,
                "header": 111368,
                "nav": 103593,
                "main": 38299,
                "figure": 4910,
                "figcaption": 889
              },
              "referring_links_countries": null,
              "referring_pages_nofollow": 33339
            },
            {
              "type": "backlinks_history",
              "date": "2020-09-30 00:00:00 +00:00",
              "rank": 600,
              "backlinks": 8231030,
              "new_backlinks": 407125,
              "lost_backlinks": 155261,
              "new_referring_domains": 4555,
              "lost_referring_domains": 751,
              "crawled_pages": 2390151,
              "info": {
                "server": "ustream/web",
                "cms": null,
                "platform_type": [
                  "unknown"
                ],
                "ip_address": "104.109.76.210",
                "country": null,
                "is_ip": false,
                "target_spam_score": 0
              },
              "internal_links_count": 48306246,
              "external_links_count": 6814735,
              "broken_backlinks": 0,
              "broken_pages": 153405,
              "referring_domains": 196837,
              "referring_domains_nofollow": 4730,
              "referring_main_domains": 150753,
              "referring_main_domains_nofollow": 3635,
              "referring_ips": 98439,
              "referring_subnets": 55945,
              "referring_pages": 7523423,
              "referring_links_tld": {
                "com": 3649487,
                "org": 1011765,
                "tv": 867263,
                "edu": 597002,
                "net": 355506,
                "ru": 138864,
                "io": 115358,
                "de": 68799,
                "com.br": 57495,
                "fr": 34360
              },
              "referring_links_types": {
                "anchor": 7462829,
                "redirect": 58950,
                "canonical": 1626,
                "alternate": 18
              },
              "referring_links_attributes": {
                "nofollow": 971813,
                "noopener": 748692,
                "noreferrer": 154975,
                "external": 85418,
                "ugc": 7674,
                "bookmark": 2439,
                "alternate": 676,
                "author": 415,
                "tag": 356,
                "sponsored": 116
              },
              "referring_links_platform_types": {
                "unknown": 6630888,
                "cms": 737977,
                "blogs": 673558,
                "wikis": 39589,
                "ecommerce": 19351,
                "message-boards": 16027
              },
              "referring_links_semantic_locations": {
                "": 3761537,
                "footer": 1935941,
                "section": 986991,
                "article": 445547,
                "header": 120263,
                "aside": 116787,
                "nav": 108846,
                "main": 40953,
                "figure": 5269,
                "figcaption": 929
              },
              "referring_links_countries": null,
              "referring_pages_nofollow": 36250
            },
            {
              "type": "backlinks_history",
              "date": "2020-10-31 00:00:00 +00:00",
              "rank": 602,
              "backlinks": 8561190,
              "new_backlinks": 455524,
              "lost_backlinks": 156158,
              "new_referring_domains": 4580,
              "lost_referring_domains": 388,
              "crawled_pages": 2485792,
              "info": {
                "server": null,
                "cms": null,
                "platform_type": [
                  "unknown"
                ],
                "ip_address": "104.109.76.210",
                "country": null,
                "is_ip": false,
                "target_spam_score": 0
              },
              "internal_links_count": 49573669,
              "external_links_count": 6900594,
              "broken_backlinks": 0,
              "broken_pages": 157439,
              "referring_domains": 203646,
              "referring_domains_nofollow": 4969,
              "referring_main_domains": 155524,
              "referring_main_domains_nofollow": 3812,
              "referring_ips": 101117,
              "referring_subnets": 57034,
              "referring_pages": 7831950,
              "referring_links_tld": {
                "com": 3718284,
                "org": 1170115,
                "tv": 867765,
                "edu": 598029,
                "net": 366456,
                "ru": 167229,
                "io": 118880,
                "de": 72381,
                "com.br": 65144,
                "it": 35100
              },
              "referring_links_types": {
                "anchor": 7770042,
                "redirect": 60217,
                "canonical": 1672,
                "alternate": 19
              },
              "referring_links_attributes": {
                "nofollow": 970935,
                "noopener": 745230,
                "noreferrer": 167836,
                "external": 88874,
                "ugc": 8085,
                "bookmark": 2462,
                "alternate": 687,
                "author": 398,
                "tag": 362,
                "sponsored": 124
              },
              "referring_links_platform_types": {
                "unknown": 6897418,
                "cms": 776539,
                "blogs": 710442,
                "wikis": 40448,
                "ecommerce": 22248,
                "message-boards": 16470
              },
              "referring_links_semantic_locations": {
                "": 3845675,
                "footer": 2146663,
                "section": 974315,
                "article": 463646,
                "header": 124594,
                "aside": 118868,
                "nav": 107545,
                "main": 43866,
                "figure": 5432,
                "figcaption": 988
              },
              "referring_links_countries": null,
              "referring_pages_nofollow": 46312
            },
            {
              "type": "backlinks_history",
              "date": "2020-12-31 00:00:00 +00:00",
              "rank": 603,
              "backlinks": 8900727,
              "new_backlinks": 185603,
              "lost_backlinks": 68434,
              "new_referring_domains": 1466,
              "lost_referring_domains": 153,
              "crawled_pages": 2610252,
              "info": {
                "server": null,
                "cms": null,
                "platform_type": [
                  "unknown"
                ],
                "ip_address": "104.109.76.210",
                "country": null,
                "is_ip": false,
                "target_spam_score": 0
              },
              "internal_links_count": 52322051,
              "external_links_count": 7251238,
              "broken_backlinks": 0,
              "broken_pages": 162728,
              "referring_domains": 209218,
              "referring_domains_nofollow": 5153,
              "referring_main_domains": 159477,
              "referring_main_domains_nofollow": 3954,
              "referring_ips": 103145,
              "referring_subnets": 57852,
              "referring_pages": 8156763,
              "referring_links_tld": {
                "com": 3766489,
                "org": 1352682,
                "tv": 868091,
                "edu": 598769,
                "net": 376591,
                "ru": 206205,
                "io": 127906,
                "de": 76675,
                "com.br": 71597,
                "it": 37572
              },
              "referring_links_types": {
                "anchor": 8093750,
                "redirect": 61248,
                "canonical": 1745,
                "alternate": 20
              },
              "referring_links_attributes": {
                "nofollow": 970410,
                "noopener": 736981,
                "noreferrer": 175502,
                "external": 91788,
                "ugc": 8854,
                "bookmark": 2472,
                "alternate": 659,
                "author": 401,
                "tag": 366,
                "sponsored": 133
              },
              "referring_links_platform_types": {
                "unknown": 7201817,
                "cms": 793888,
                "blogs": 726552,
                "wikis": 41098,
                "ecommerce": 24428,
                "message-boards": 16765
              },
              "referring_links_semantic_locations": {
                "": 3939792,
                "footer": 2366930,
                "section": 963461,
                "article": 477386,
                "header": 131548,
                "aside": 121288,
                "nav": 102878,
                "main": 46563,
                "figure": 5535,
                "figcaption": 1020
              },
              "referring_links_countries": null,
              "referring_pages_nofollow": 13800
            }
          ]
        }
      ]
    }
  ]
}

All POST data should be sent in the JSON format (UTF-8 encoding). The task setting is done using the POST method. When setting a task, you should send all task parameters in the task array of the generic POST array. You can send up to 2000 API calls per minute.

You can specify the time range, and we will provide historical backlink data within the set period.

Below you will find a detailed description of the fields you can use for setting a task.

Description of the fields for setting a task:

Field name Type Description
target string domain
required field
a domain should be specified without https:// and www.
date_from string starting date of the time range
optional field
minimum value 2019-01-01
if you don’t specify this field, the minimum value will be used by default
date format: "yyyy-mm-dd"
example:
"2019-01-15"
date_to string ending date of the time range
optional field
if you don’t specify this field, the today’s date will be used by default
date format: "yyyy-mm-dd"
example:
"2019-01-15"
tag string user-defined task identifier
optional field
the character limit is 255
you can use this parameter to identify the task and match it with the result
you will find the specified tag value in the data object of the response

As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.

Description of the fields in the results array:

Field name Type Description
version string the current version of the API
status_code integer general status code
you can find the full list of the response codes here
Note: we strongly recommend designing a necessary system for handling related exceptional or error conditions
status_message string general informational message
you can find the full list of general informational messages here
time string execution time, seconds
cost float total tasks cost, USD
tasks_count integer the number of tasks in the tasks array
tasks_error integer the number of tasks in the tasks array returned with an error
tasks array array of tasks
        id string task identifier
unique task identifier in our system in the UUID format
        status_code integer status code of the task
generated by DataForSEO; can be within the following range: 10000-60000
you can find the full list of the response codes here
        status_message string informational message of the task
you can find the full list of general informational messages here
        time string execution time, seconds
        cost float cost of the task, USD
        result_count integer number of elements in the result array
        path array URL path
        data object contains the same parameters that you specified in the POST request
        result array array of results
            target string target from the POST array
            date_from string starting date of the time range
in the UTC format: “yyyy-mm-dd”
example:
2019-01-01
            date_to string ending date of the time range
in the UTC format: "yyyy-mm-dd"
example:
"2019-01-15"
            items_count integer the number of results returned in the items array
            items array contains historical backlink data for the specified domain
the data is provided month-by-month;
the metrics are aggregated according to the backlinks the specified domain had on the first day of each given month
                type string type of element = ‘backlinks_history’
                date string date and time when the data for the target was stored
in the UTC format: “yyyy-mm-dd hh-mm-ss +00:00”
example:
2019-11-15 12:57:46 +00:00
                rank integer domain rank on the given date
learn more about the metric and how it is calculated in this help center article
                backlinks integer number of backlinks
                new_backlinks integer number of new backlinks for the target
data is provided based in a comparison with the previous period
Note: this data is available from May 2021;
if the date range specified in the POST request precedes May 2021, the field will equal 0
                lost_backlinks integer number of lost backlinks for the target
data is provided based in a comparison with the previous period
Note: this data is available from May 2021;
if the date range specified in the POST request precedes May 2021, the field will equal 0
                new_referring_domains integer number of new referring domains for the target
data is provided based in a comparison with the previous period
Note: this data is available from May 2021;
if the date range specified in the POST request precedes May 2021, the field will equal 0
                lost_referring_domains integer number of lost referring domains for the target
data is provided based in a comparison with the previous period
Note: this data is available from May 2021;
if the date range specified in the POST request precedes May 2021, the field will equal 0
                crawled_pages integer number of crawled pages for the target
                info object information about the target
                    server string server
                    cms string content management system
                    platform_type array platform type
                    ip_address string IP address of the target
                    country string country code that the target domain is determined to belong to
                    is_ip boolean indicates if the target is IP
if true, the domain, subdomain or webpage functions as an IP address and does not have a domain name
                    target_spam_score integer spam score of the target
if the target is a domain/subdomain, this fields indicates the average spam score of all pages of that domain/subdomain;
learn more about how the metric is calculated on this help center page
                internal_links_count integer number of internal links
calculated as the sum of internal links on the pages of the specified target
                external_links_count integer number of external links on the page
calculated as the sum of external links on the pages of the specified target
                broken_backlinks integer number of broken backlinks
number of broken backlinks pointing to the target
                broken_pages integer number of broken pages
number of pages that receive backlinks but respond with 4xx or 5xx status codes
                referring_domains integer number of referring domains
referring domains include subdomains that are counted as separate domains for this metric
                referring_domains_nofollow integer number of domains pointing at least one nofollow link to the target
                referring_main_domains integer number of referring main domains
                referring_main_domains_nofollow integer number of main domains pointing at least one nofollow link to the target
                referring_ips integer number of referring IP addresses
number of IP addresses pointing to this page
                referring_subnets integer number of referring subnetworks
                referring_pages integer number of pages pointing to the target
                referring_links_tld object top-level domains of the referring links
contains top-level domains and referring link count per each
                referring_links_types object types of referring links
indicates the types of the referring links and link count per each type
possible values:
anchor, image, link, meta, canonical, alternate, redirect
                referring_links_attributes object link attributes of the referring links
indicates link attributes of the referring links and link count per each attribute
                referring_links_platform_types object types of referring platforms
indicates referring platform types and and link count per each platform
                referring_links_semantic_locations object semantic locations of the referring links
indicates semantic elements in HTML where the referring links are located and link count per each semantic location
you can get the full list of semantic elements here
examples:
article, section, summary
                referring_links_countries object ISO country codes of the referring links
indicates ISO country codes of the domains where the referring links are located and the link count per each country
                referring_pages_nofollow integer number of referring pages pointing at least one nofollow link to the target

‌‌