Content Analysis – Rating Distribution API


This endpoint will provide you with rating distribution data for the keyword and other parameters specified in the request.

checked POST
Pricing

Your account will be charged for each request.
The cost can be calculated on the Pricing page.

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, each Live API call can contain only one task. The maximum number of calls that can be sent simultaneously is limited to 30.

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 nameTypeDescription
keywordstring

target keyword
required field
UTF-8 encoding
the keywords will be converted to a lowercase format;
Note: to match an exact phrase instead of a stand-alone keyword, use double quotes and backslashes;
example:
"keyword": "\"tesla palo alto\""

learn more about rules and limitations of keyword and keywords fields in DataForSEO APIs in this Help Center article

keyword_fieldsobject

target keyword fields and target keywords
optional field
use this parameter to filter the dataset by keywords that certain fields should contain;
fields you can specify: title, main_title, previous_title, snippet
you can indicate several fields;
Note: to match an exact phrase instead of a stand-alone keyword, use double quotes and backslashes;
example:
"keyword_fields": {
"snippet": "\"logitech mouse\"",
"main_title": "sale"
}

page_typearray

target page types
optional field
use this parameter to filter the dataset by page types
possible values:
"ecommerce", "news", "blogs", "message-boards", "organization"

internal_list_limitinteger

maximum number of elements within internal arrays
optional field
you can use this field to limit the number of elements within the following arrays:
top_domains
text_categories
page_categories
countries
languages
default value: 1
maximum value: 20

search_modestring

results grouping type
optional field
possible grouping types:
as_is - returns all citations for the target keyword
one_per_domain - returns one citation of the keyword per domain
default value: as_is

positive_connotation_thresholdfloat

positive connotation threshold
optional field
specified as the probability index threshold for positive sentiment related to the citation content
if you specify this field, connotation_types object in the response will only contain data on citations with positive sentiment probability more than or equal to the specified value
possible values: from 0 to 1
default value: 0.4

sentiments_connotation_thresholdfloat

sentiment connotation threshold
optional field
specified as the probability index threshold for sentiment connotations related to the citation content
if you specify this field, sentiment_connotations object in the response will only contain data on citations where the probability per each sentiment is more than or equal to the specified value
possible values: from 0 to 1
default value: 0.4

initial_dataset_filtersarray

initial dataset filtering parameters
optional field
initial filtering parameters that apply to fields in the Search endpoint
you can add several filters at once (8 filters maximum)
you should set a logical operator and, or between the conditions
the following operators are supported:
regex, not_regex, <, <=, >, >=, =, <>, in, not_in, like,not_like, has, has_not, match, not_match
you can use the % operator with like and not_like to match any string of zero or more characters
example:
["domain","<>", "logitech.com"]

[["domain","<>","logitech.com"],"and",["content_info.connotation_types.negative",">",1000]]

[["domain","<>","logitech.com"]],
"and",
[["content_info.connotation_types.negative",">",1000],
"or",

["content_info.text_category","has",10994]]]
for more information about filters, please refer to Content Analysis API - Filters
learn more about the initial dataset filters in this help center article.

rank_scalestring

defines the scale used for calculating and displaying the rank values
optional field

you can use this parameter to choose whether rank values are presented on a 0–100 or 0–1000 scale

possible values:
one_hundred — rank values are displayed on a 0–100 scale
one_thousand — rank values are displayed on a 0–1000 scale

default value: one_thousand

learn more about how this parameter works in this Help Center article

tagstring

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 nameTypeDescription
versionstring

the current version of the API

status_codeinteger

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_messagestring

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

timestring

execution time, seconds

costfloat

total tasks cost, USD

tasks_countinteger

the number of tasks in the tasks array

tasks_errorinteger

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

tasksarray

array of tasks

    idstring

task identifier
unique task identifier in our system in the UUID format

    status_codeinteger

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_messagestring

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

    timestring

execution time, seconds

    costfloat

cost of the task, USD

    result_countinteger

number of elements in the result array

    patharray

URL path

    dataobject

contains the same parameters that you specified in the POST request

    resultarray

array of results

        typestring

type of element='content_analysis_rating_distribution'n

        minfloat

min rating on a distribution scale

        maxfloat

max rating on a distribution scale

        metricsobject

contains rating distribution metrics

            typestring

type of element='content_analysis_summary'n

            total_countinteger

total amount of results in our database relevant to your request

            rankinteger

rank of all URLs citing the keyword
normalized sum of ranks of all URLs citing the target keyword

            top_domainsarray

top domains citing the target keyword
contains objects with top domains citing the target keyword and citation count per each domain

            sentiment_connotationsobject

sentiment connotations
contains sentiments (emotional reactions) related to the target keyword citation and the number of citations per each sentiment;
possible connotations: "anger", "happiness", "love", "sadness", "share", "fun"

            connotation_typesobject

connotation types
contains types of sentiments (sentiment polarity) related to the keyword citation and citation count per each sentiment type;
possible connotation types: "positive", "negative", "neutral"

            text_categoriesarray

text categories
contains objects with text categories and citation count in each text category
to obtain a full list of available categories, refer to the Categories endpoint

            page_categoriesarray

page categories
contains objects with page categories and citation count in each page category
to obtain a full list of available categories, refer to the Categories endpoint

            page_typesobject

page types
contains page types and citation count per each page type

            countriesobject

countries
contains countries and citation count in each country
to obtain a full list of available countries, refer to the Locations endpoint

            languagesobject

languages
contains languages and citation count in each language
to obtain a full list of available languages, refer to the Languages endpoint

‌‌

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

# Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access 
login="login" 
password="password" 
cred="$(printf ${login}:${password} | base64)" 
curl --location --request POST "https://api.dataforseo.com/v3/content_analysis/rating_distribution/live" 
--header "Authorization: Basic ${cred}"  
--header "Content-Type: application/json" 
--data-raw '[
    {
    	"keyword": "logitech",
    	"search_mode": "as_is",
    	"internal_list_limit": 10
    }
]'
<?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(
   "keyword" => "logitech",
   "search_mode" => as_is,
   "internal_list_limit" => 10
);
try {
   // POST /v3/content_analysis/rating_distribution/live
   $result = $client->post('/v3/content_analysis/rating_distribution/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;
?>
const post_array = [];

post_array.push({
    	"keyword": "logitech",
    	"search_mode": "as_is",
    	"internal_list_limit": 10
});

const axios = require('axios');

axios({
  method: 'post',
  url: 'https://api.dataforseo.com/v3/content_analysis/rating_distribution/live',
  auth: {
    username: 'login',
    password: 'password'
  },
  data: post_array,
  headers: {
    'content-type': 'application/json'
  }
}).then(function (response) {
  var result = response['data']['tasks'];
  // Result data
  console.log(result);
}).catch(function (error) {
  console.log(error);
});
from client import RestClient
# You can download this file from here https://cdn.dataforseo.com/v3/examples/python/python_Client.zip
client = RestClient("login", "password")
post_data = dict()
# simple way to set a task
post_data[len(post_data)] = dict(
    keyword="logitech",
    search_mode="as_is",
    internal_list_limit=10
)
# POST /v3/content_analysis/rating_distribution/live
response = client.post("/v3/content_analysis/rating_distribution/live", post_data)
# you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
if response["status_code"] == 20000:
    print(response)
    # do something with result
else:
    print("error. Code: %d Message: %s" % (response["status_code"], response["status_message"]))
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace DataForSeoDemos
{
    public static partial class Demos
    {
        public static async Task content_analysis_summary_live()
        {
            var httpClient = new HttpClient
            {
                BaseAddress = new Uri("https://api.dataforseo.com/"),
                // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
                DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) }
            };
            var postData = new List<object>();
            postData.Add(new
            {
                keyword = "logitech",
                search_mode = "as_is",
                internal_list_limit = 10
            });
            // POST /v3/content_analysis/rating_distribution/live
            // the full list of possible parameters is available in documentation
            var taskPostResponse = await httpClient.PostAsync("/v3/content_analysis/rating_distribution/live", new StringContent(JsonConvert.SerializeObject(postData)));
            var result = JsonConvert.DeserializeObject<dynamic>(await taskPostResponse.Content.ReadAsStringAsync());
            // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
            if (result.status_code == 20000)
            {
                // do something with result
                Console.WriteLine(result);
            }
            else
                Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}");
        }
    }
}

The above command returns JSON structured like this:

{
  "version": "0.1.20220819",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "16.8783 sec.",
  "cost": 0.0203,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "11041243-1535-0466-0000-3280caf1189e",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "16.8151 sec.",
      "cost": 0.0203,
      "result_count": 10,
      "path": [
        "v3",
        "content_analysis",
        "rating_distribution",
        "live"
      ],
      "data": {
        "api": "content_analysis",
        "function": "rating_distribution",
        "keyword": "logitech",
        "search_mode": "as_is",
        "internal_list_limit": 10
      },
      "result": [
        {
          "type": "content_analysis_rating_distribution",
          "min": 0,
          "max": 0.1,
          "metrics": {
            "type": "content_analysis_summary",
            "total_count": 189,
            "rank": 211,
            "top_domains": [
              {
                "domain": "pcwelt.de",
                "count": 35
              },
              {
                "domain": "macwelt.de",
                "count": 21
              },
              {
                "domain": "macworld.com",
                "count": 3
              },
              {
                "domain": "pcworld.com",
                "count": 1
              },
              {
                "domain": "pocket-lint.com",
                "count": 1
              },
              {
                "domain": "techadvisor.com",
                "count": 1
              }
            ],
            "sentiment_connotations": {
              "anger": 0,
              "happiness": 18,
              "love": 0,
              "sadness": 0,
              "share": 0,
              "fun": 2
            },
            "connotation_types": {
              "positive": 51,
              "negative": 32,
              "neutral": 67
            },
            "text_categories": [
              {
                "category": [
                  10013,
                  10019,
                  10167,
                  10002,
                  10028,
                  10222,
                  13813
                ],
                "count": 13
              },
              {
                "category": [
                  10019,
                  10167,
                  10013,
                  10007,
                  13418
                ],
                "count": 12
              },
              {
                "category": [
                  10019,
                  10167,
                  10013,
                  10002,
                  10028,
                  10222,
                  13813
                ],
                "count": 11
              },
              {
                "category": [
                  10013,
                  10019,
                  10167
                ],
                "count": 9
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054,
                  10168,
                  10883,
                  12187,
                  13068
                ],
                "count": 6
              },
              {
                "category": [
                  10019,
                  10167,
                  10013
                ],
                "count": 6
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054,
                  10013
                ],
                "count": 5
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  13418,
                  10013
                ],
                "count": 5
              },
              {
                "category": [
                  10013,
                  10019,
                  10167,
                  10007,
                  13418
                ],
                "count": 4
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054,
                  10108
                ],
                "count": 4
              }
            ],
            "page_categories": [
              {
                "category": [
                  10019,
                  10167,
                  10168,
                  10883,
                  12187,
                  13068,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 2
              },
              {
                "category": [
                  10019,
                  10167,
                  10872,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 2
              },
              {
                "category": [
                  10019,
                  10168,
                  10886,
                  12216,
                  12222
                ],
                "count": 2
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10001,
                  10026,
                  10209,
                  10019,
                  10167
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10009,
                  10410,
                  10417
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10013,
                  10019,
                  10167
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10019,
                  10167,
                  10168,
                  10886,
                  12216
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10019,
                  10167,
                  10873,
                  12138,
                  10013,
                  10109,
                  10592,
                  13537
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10108,
                  10004,
                  10276,
                  11088,
                  13412
                ],
                "count": 1
              },
              {
                "category": [
                  10004,
                  10307,
                  10002,
                  10028,
                  10222,
                  13813,
                  10013
                ],
                "count": 1
              }
            ],
            "page_types": {
              "blogs": 35,
              "organization": null,
              "news": 1,
              "message-boards": null,
              "ecommerce": 61
            },
            "countries": {
              "DE": 56,
              "US": 5,
              "WW": 1
            },
            "languages": {
              "de": 175,
              "en": 14
            }
          }
        },
        {
          "type": "content_analysis_rating_distribution",
          "min": 0.1,
          "max": 0.2,
          "metrics": {
            "type": "content_analysis_summary",
            "total_count": 1840,
            "rank": 270,
            "top_domains": [
              {
                "domain": "csh.ro",
                "count": 170
              },
              {
                "domain": "plazacompare.com",
                "count": 30
              },
              {
                "domain": "x-kom.pl",
                "count": 30
              },
              {
                "domain": "trending-electronics.com",
                "count": 24
              },
              {
                "domain": "geendank.com",
                "count": 23
              },
              {
                "domain": "mediamarkt.de",
                "count": 23
              },
              {
                "domain": "scoopdeals.com",
                "count": 21
              },
              {
                "domain": "librarii.ro",
                "count": 20
              },
              {
                "domain": "pcoverhauls.com",
                "count": 14
              },
              {
                "domain": "dealwithit.gr",
                "count": 13
              }
            ],
            "sentiment_connotations": {
              "anger": 5,
              "happiness": 75,
              "love": 0,
              "sadness": 5,
              "share": 38,
              "fun": 6
            },
            "connotation_types": {
              "positive": 280,
              "negative": 648,
              "neutral": 905
            },
            "text_categories": [
              {
                "category": null,
                "count": 499
              },
              {
                "category": [
                  10013,
                  10108,
                  13691
                ],
                "count": 103
              },
              {
                "category": [
                  10019,
                  10167
                ],
                "count": 43
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  13418
                ],
                "count": 34
              },
              {
                "category": [
                  10108,
                  13691,
                  10013,
                  10103,
                  10556
                ],
                "count": 32
              },
              {
                "category": [
                  10019,
                  10167,
                  10013
                ],
                "count": 30
              },
              {
                "category": [
                  10019,
                  10168,
                  10886,
                  12222,
                  12216
                ],
                "count": 29
              },
              {
                "category": [
                  10013,
                  10019,
                  10167
                ],
                "count": 25
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 25
              },
              {
                "category": [
                  10108,
                  13691,
                  10013
                ],
                "count": 25
              }
            ],
            "page_categories": [
              {
                "category": null,
                "count": 229
              },
              {
                "category": [
                  10019,
                  10167
                ],
                "count": 15
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 14
              },
              {
                "category": [
                  10019,
                  10168,
                  10886,
                  12216,
                  12222
                ],
                "count": 14
              },
              {
                "category": [
                  10019,
                  10168,
                  10883,
                  12187,
                  13069,
                  10886,
                  12216,
                  12188,
                  13073
                ],
                "count": 12
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  13418
                ],
                "count": 9
              },
              {
                "category": [
                  10019,
                  10168,
                  10883,
                  12187,
                  13069,
                  10886,
                  12216,
                  13068
                ],
                "count": 8
              },
              {
                "category": [
                  10019,
                  10168,
                  10886,
                  12222,
                  12216
                ],
                "count": 8
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  13418,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 5
              },
              {
                "category": [
                  10019,
                  10167,
                  10013
                ],
                "count": 5
              }
            ],
            "page_types": {
              "blogs": 146,
              "organization": 89,
              "news": 8,
              "message-boards": null,
              "ecommerce": 445
            },
            "countries": {
              "RO": 190,
              "US": 90,
              "PL": 32,
              "WW": 30,
              "DE": 26,
              "FR": 18,
              "UA": 17,
              "GR": 13,
              "GB": 12,
              "AR": 9
            },
            "languages": {
              "en": 1094,
              "pl": 181,
              "de": 141,
              "nl": 68,
              "ro": 65,
              "ru": 59,
              "es": 55,
              "it": 44,
              "fr": 41,
              "vi": 32
            }
          }
        }
      ]
    }
  ]
}