Tutorial + Template: Backlink Analysis Using the DataForSEO

Antonio Blago
Antonio Blago

Tutorial + Template: Backlink Analysis with DataForSEO API Key   Minutes reading time remaining By Antonio Blago February 15, 2025

SEO, Tutorial

Are you looking for backlink analyses, keyword data, or comprehensive SEO insights? Then DataForSEO might be just the right choice. In this blog post, you'll learn step by step how to create an account, obtain your API key, and make your first data requests. Sounds good? Then let's get started!

Here is the template: https://docs.google.com/spreadsheets/d/1DJCYhud0uqagVo1AlsR656l1N_bp8UtpK04rzQRMul4/edit?usp=sharing

To the YouTube video:

1. What is DataForSEO?

DataForSEO is a flexible API platform that provides you with various SEO and marketing data – from keyword rankings and SERP data to detailed backlink information. Instead of being tied to rigid tools, you can use their interfaces to integrate the data into your own environment, for example in Google Sheets, web apps, or desktop tools.

Why DataForSEO?

Wide range of endpoints: Rankings, keywords, backlinks, competitor analyses, and more.

Pay-as-you-go or subscription: You can retrieve data as needed and only pay for what you actually use.

Quick integration: Thanks to a simple request and response structure, you can get started quickly.

2. Create an Account & Obtain API Key

To use the API, you first need a DataForSEO account. Go to dataforseo.com, choose a suitable option there (e.g., a trial period or directly a paid version), and create your account.

Registration

Enter email address

Set password

Provide business information if required

Confirmation

DataForSEO will send you an email.

Click the confirmation link included to activate your account.

Access Data

After logging in, you will find your API credentials in the dashboard (e.g., "API Credentials" or "API Documentation").

Usually, you will receive a username and a password, which are used in Base64-encoded form as a header.

In many cases, you will get a string like "bG9naW46cGFzc3dvcmQ=". This Base64 string represents your username and password, combined by a colon and then encrypted.

Attention: The key gives you full access to your DataForSEO resources – so keep it safe and do not store it publicly in code or in repos like GitHub!

3. Getting Started with the API

a) cURL Example

The simplest way to test everything is via cURL. Suppose you want to query backlink information for a specific domain. It could look like this:

curl --location --request POST 'https://api.dataforseo.com/v3/backlinks/summary/live' \
--header 'Authorization: Basic bG9naW46cGFzc3dvcmQ=' \
--header 'Content-Type: application/json' \
--data-raw '[{
"target": "beispielseite.de",
"backlinks_status_type": "live",
"include_subdomains": true,
"exclude_internal_backlinks": true,
"include_indirect_links": true
}]'

What happens here:

Authorization header: Basic bG9naW46cGFzc3dvcmQ= transmits your API key.

Content-Type: application/json signals to the server that you are sending JSON data.

Payload (JSON): An array with objects in which you specify the target (i.e., your domain) and various parameters.

After execution, you will receive a JSON response with the desired data, for example, number of backlinks, referring domains, spam score, and much more.

4. Integration into Google Sheets (Apps Script)

If you want to insert the data directly into Google Sheets, this works great via Apps Script. Here is a short example of how you can use a script to:

Retrieve the API key from the script properties

Send a POST request to DataForSEO

Write the response into your table

function importDataforSEOBacklinks() {
// 1) URL of the endpoint
var url = 'https://api.dataforseo.com/v3/backlinks/summary/live';

// 2) API key from script properties
var apiKey = PropertiesService.getScriptProperties().getProperty('API_KEY');
if (!apiKey) {
Logger.log("No API_KEY stored in the script properties.");
return;
}

// 3) Request payload
var payload = [
{
"target": "beispielseite.de",
"backlinks_status_type": "live",
"include_subdomains": true,
"exclude_internal_backlinks": true,
"include_indirect_links": true
}
];

// 4) Define request options
var options = {
'method': 'post',
'contentType': 'application/json',
'headers': {
'Authorization': 'Basic ' + apiKey
},
'payload': JSON.stringify(payload),
'muteHttpExceptions': true
};

// 5) Execute request
var response = UrlFetchApp.fetch(url, options);
var httpCode = response.getResponseCode();
var responseText = response.getContentText();

// 6) Process response
if (httpCode === 200) {
var data = JSON.parse(responseText);
// Normally: data.tasks[0].result[0] contains the most important fields.
var resultItem = data.tasks[0].result[0];

// 7) Write to Google Sheet
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var rowValues = [
resultItem.target,
resultItem.rank,
resultItem.backlinks,
resultItem.backlinks_spam_score,
// and so on ...
];

// Find next free row
var lastRow = sheet.getLastRow();
// Write values to columns A-D
sheet.getRange(lastRow + 1, 1, 1, rowValues.length).setValues([rowValues]);

Logger.log('Import successful!');
} else {
Logger.log('Error: HTTP-' + httpCode + ' / ' + responseText);
}
}

How to set your API key in the script properties:

Open Apps Script (menu Extensions → Apps Script).

Click the gear icon (Project Settings) in the top left.

Script Properties → Edit → Create new entry:

Name: API_KEY

Wert: bG9naW46cGFzc3dvcmQ= (your actual Base64 string)

Save. From then on, you can use PropertiesService.getScriptProperties().getProperty('API_KEY') .

5. Important Tips & Tricks

Limitations : DataForSEO works with credits per API call. Keep an eye on your balance and your rate limit.

Error messages : If you receive a non-200 status code, log the responseText to see if, for example, you have exhausted your balance or are sending incorrect parameters.

Pagination & Batch Requests : For large amounts of data (many backlinks, keywords, etc.), it can make sense to split the requests into multiple calls.

Security : Do not store your auth data in plain text in the code, but in encrypted or hidden environments (e.g., Script Properties or an external solution).

6. Summary

DataForSEO is a practical service if you want to build your own SEO data base and automate reports. With just a few simple steps, you have:

Created your account

Received your API key (Base64)

Executed your first requests in cURL or Google Apps Script (or any other HTTP client)

Once you get the hang of it, you have numerous analysis options available to you – from backlink monitoring to keyword research to SERP tracking.

Good luck trying it out! If you have questions about specific endpoints or data formats, feel free to check the DataForSEO documentation or join their community. On your way to automated SEO insights, I wish you lots of fun experimenting!

E-commerce SEO Case Study for PURELEI

E-commerce SEO Case Study:  PURELEI.com  +100% visibility in 8 months

Read More

Case study, SEO, strategies

E-commerce SEO Case Study for PURELEI

E-commerce SEO Case Study:  PURELEI.com  +100% visibility in 8 months [...]

Case study, SEO

Case Study: How We Generated Over €1.2 Million in Revenue with Targeted Blog Content

Brief overview A fast-growing brand was able to generate over €1.2 million in revenue within 12 months through targeted content strategies and [...]

Automation, AI, SEO

Finally Accessible: Efficiently Fill ALT Texts with AI

5 (1) Practical example in Shopify In my job as an SEO freelancer [...]

Automation

Create Apify Account

Tutorial: Create & Start Apify Account Step 1: Go to apify.com Open [...]

Analysis, AI, SEO, SEO Tools

AI Prompt Keyword Mapper

0 (0) How to automatically analyze prompts Nowadays, prompts – that is, [...]

AI, AI Tools, SEO Tools

ChatGPT German: Use Chat GPT for Free Without Registration

[borlabs-cookie id="aichatbot" type="content-blocker"][/borlabs-cookie]ChatGPT, the advanced language model from OpenAI, is revolutionizing the way [...]

Use My SEO Roadmap to Get to Page 1 on Google!

Sign up for my newsletter and get access to free guides, checklists, and tools.

 
Cookie-Settings