Live Business Listings Categories Aggregation Tasks

‌‌
Business Listings Categories Aggregation endpoint provides results containing information about groups of related categories along with the number of entities in each category. The provided results are specific to the specified parameters.

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
categoriesarray

business categories
optional field
the categories you specify are used to search for business listings;
if you don't use this field, we will return business listings found in the specified location;
you can specify up to 10 categories

descriptionstring

description of the element in SERP
optional field
the description of the business entity for which the results are collected;
can contain up to 200 characters

titlestring

title of the element in SERP
optional field
the name of the business entity for which the results are collected;
can contain up to 200 characters

is_claimedboolean

indicates whether the business is verified by its owner on Google Maps
optional field

location_coordinatestring

GPS coordinates of a location
optional field
location_coordinate parameter should be specified in the "latitude,longitude,radius" format
the maximum number of decimal digits for "latitude" and "longitude": 7
the minimum value for "radius": 1
the maximum value for "radius": 100000
example:
53.476225,-2.243572,200

initial_dataset_filtersarray

array of results filtering parameters
optional field
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, match, not_match
you can use the % operator with like and not_like to match any string of zero or more characters
example:
["rating.value",">",3]

you can receive the list of available filters_by making a separate request to https://api.dataforseo.com/v3/business_data/business_listings/available_filters
the full list of possible filters is available here.
learn more about the initial dataset filters in this help center article.n

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 aggregated categories
default value: 10

limitinteger

the maximum number of returned businesses
optional field
default value: 100
maximum value: 1000

offsetinteger

the maximum number of returned businesses
optional field

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 tasksarray

tasks_errorinteger

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

tasksarray

array of tasks

    idstring

unique task identifier in our system
in the Universally unique identifier (UUID) format

    status_codeinteger

status code of the task
generated by DataForSEO; can be within the following range: 10000-60000

    status_messagestring

informational message of the task

    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

        total_countinteger

total number of results in our database relevant to your request

        countinteger

item types
the number of items in the items array

        offsetinteger

offset in the results array of returned categories

        offset_tokenobject

token for subsequent requests
by specifying the unique offset_token when setting a new task, you will get the subsequent results of the initial task;
offset_token values are unique for each subsequent task

            itemsarray

encountered item types
types of search engine results encountered in the items array;
possible item types: business_category

                typestring

type of element = ‘business_category’

                categoriesarray

business categories
Google My Business general category that best describes the cluster of related categories

                aggregationobject

aggregation of the category

                    top_categoriesobject

the most mentioned related categories
top categories displayed with the number of businesses in each category

                    top_countriesobject

the most mentioned counties
country codes with the biggest number of businesses in the category

                    websites_countinteger

number of unique websites

                    countinteger

number of unique entities

                    top_attributesobject

the most mentioned service details
service details of a business entity displayed in a form of checks and the number of entities mentioning each attribute

                    top_place_topicsobject

top keywords mentioned in customer reviews
contains most popular keywords related to products/services mentioned in customer reviews of a business entity and the number of reviews mentioning each keyword

‌‌

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/business_data/business_listings/categories_aggregation/live" 
--header "Authorization: Basic ${cred}"  
--header "Content-Type: application/json" 
--data-raw '[
  {
    "categories": [
      "pizza_restaurant"
    ],
    "description": "pizza",
    "title": "pizza",
    "is_claimed": true,
    "location_coordinate": "53.476225,-2.243572,10",
    "initial_dataset_filters": [
      [
        "rating.value",
        ">",
        3
      ]
    ],
    "limit": 3
  }
]'
<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip?202197
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 get a result
$post_array[] = array(
   "categories" => ["pizza_restaurant"],
   "description" => "pizza",
   "title" => "pizza",
   "is_claimed" => true,
   "location_coordinate" => "53.476225,-2.243572,10",
   "initial_dataset_filters" => [
      [ "rating.value",">",3 ]
   ],
   "internal_list_limit" => 10,
   "limit" => 3
);
try {
   // POST /v3/business_data/business_listings/categories_aggregation/live
   // the full list of possible parameters is available in documentation
   $result = $client->post('/v3/business_data/business_listings/categories_aggregation/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({
    "categories": [
      "pizza_restaurant"
    ],
    "description": "pizza",
    "title": "pizza",
    "is_claimed": true,
    "location_coordinate": "53.476225,-2.243572,10",
    "initial_dataset_filters": [
      [
        "rating.value",
        ">",
        3
      ]
    ],
    "limit": 3
  });

const axios = require('axios');

axios({
  method: 'post',
  url: 'https://api.dataforseo.com/v3/business_data/business_listings/categories_aggregation/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(
    categories=[
        "pizza_restaurant"
    ],
    description="pizza",
    title="pizza",
    is_claimed=True,
    location_coordinate="53.476225,-2.243572,10",
    initial_dataset_filters=[
        ["rating.value",">",3]
    ],
    internal_list_limit=10,
    limit=3
)
# POST /v3/business_data/business_listings/categories_aggregation/live
response = client.post("/v3/business_data/business_listings/categories_aggregation/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 business_data_business_listings_categories_aggregation_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>();
            // You can set only one task at a time
            postData.Add(new
            {
                categories = new[]
                {
                    "pizza_restaurant"
                },
                description = "pizza",
                title = "pizza",
                is_claimed = true,
                location_coordinate = "53.476225,-2.243572,10",
                initial_dataset_filters = new object[]
                {
                    new object[] { "rating.value", ">", 3 }
                },
                limit = 3
            });
            // POST /v3/business_data/business_listings/categories_aggregation/live
            // the full list of possible parameters is available in documentation
            var taskPostResponse = await httpClient.PostAsync("/v3/business_data/business_listings/categories_aggregation/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.20221214",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.3505 sec.",
  "cost": 0.0109,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "04301510-1535-0545-0000-92269c6091b9",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.2798 sec.",
      "cost": 0.0109,
      "result_count": 1,
      "path": [
        "v3",
        "business_data",
        "business_listings",
        "categories_aggregation",
        "live"
      ],
      "data": {
        "api": "business_data",
        "function": "categories_aggregation",
        "categories": [
          "pizza_restaurant"
        ],
        "description": "pizza",
        "title": "pizza",
        "is_claimed": true,
        "location_coordinate": "53.476225,-2.243572,10",
        "initial_dataset_filters": [
          [
            "rating.value",
            ">",
            3
          ]
        ],
        "limit": 3
      },
      "result": [
        {
          "total_count": 26,
          "count": 3,
          "offset": null,
          "offset_token": null,
          "items": [
            {
              "type": "business_category",
              "categoiries": [
                "pizza_restaurant"
              ],
              "aggregation": {
                "top_categories": {
                  "pizza_restaurant": 32,
                  "pizzatakeaway": 14,
                  "restaurant": 12,
                  "pizza_delivery_service": 11,
                  "delivery_service": 7,
                  "italian_restaurant": 7,
                  "neapolitan_restaurant": 6,
                  "fast_food_restaurant": 4,
                  "meal_takeaway": 3,
                  "vegan_restaurant": 3
                },
                "top_countries": {
                  "GB": 32
                },
                "websites_count": 18,
                "count": 32,
                "top_attributes": {
                  "has_delivery": 32,
                  "has_takeout": 32,
                  "feels_casual": 28,
                  "pay_debit_card": 26,
                  "pay_mobile_nfc": 23,
                  "has_no_contact_delivery": 20,
                  "serves_dessert": 20,
                  "serves_dinner": 18,
                  "accepts_reservations": 17,
                  "has_wheelchair_accessible_entrance": 17
                },
                "top_place_topics": {
                  "price": 9,
                  "order": 8,
                  "money": 7,
                  "atmosphere": 6,
                  "dominos": 6,
                  "vegan": 6,
                  "cold": 5,
                  "kids": 5,
                  "phone": 5,
                  "dough": 4
                }
              }
            },
            {
              "type": "business_category",
              "categoiries": [
                "pizzatakeaway"
              ],
              "aggregation": {
                "top_categories": {
                  "pizza_restaurant": 14,
                  "pizzatakeaway": 14,
                  "pizza_delivery_service": 8,
                  "restaurant": 8,
                  "fast_food_restaurant": 3,
                  "family_restaurant": 2,
                  "italian_restaurant": 2,
                  "meal_takeaway": 2,
                  "vegan_restaurant": 2,
                  "buffet_restaurant": 1
                },
                "top_countries": {
                  "GB": 14
                },
                "websites_count": 7,
                "count": 14,
                "top_attributes": {
                  "has_delivery": 14,
                  "has_takeout": 14,
                  "feels_casual": 13,
                  "pay_debit_card": 12,
                  "pay_mobile_nfc": 12,
                  "has_no_contact_delivery": 10,
                  "accepts_reservations": 9,
                  "is_transgender_safespace": 9,
                  "serves_dessert": 9,
                  "serves_late_night_food": 8
                },
                "top_place_topics": {
                  "price": 5,
                  "order": 4,
                  "buffet": 3,
                  "ice cream": 3,
                  "kids": 3,
                  "money": 3,
                  "pay": 3,
                  "the pizza": 3,
                  "app": 2,
                  "call": 2
                }
              }
            },
            {
              "type": "business_category",
              "categoiries": [
                "restaurant"
              ],
              "aggregation": {
                "top_categories": {
                  "pizza_restaurant": 12,
                  "restaurant": 12,
                  "pizzatakeaway": 8,
                  "pizza_delivery_service": 5,
                  "italian_restaurant": 3,
                  "neapolitan_restaurant": 3,
                  "family_restaurant": 2,
                  "vegan_restaurant": 2,
                  "buffet_restaurant": 1,
                  "delivery_service": 1
                },
                "top_countries": {
                  "GB": 12
                },
                "websites_count": 3,
                "count": 12,
                "top_attributes": {
                  "has_delivery": 12,
                  "has_takeout": 12,
                  "accepts_reservations": 11,
                  "feels_casual": 11,
                  "is_transgender_safespace": 11,
                  "pay_debit_card": 11,
                  "pay_mobile_nfc": 11,
                  "serves_dessert": 10,
                  "has_no_contact_delivery": 8,
                  "has_wheelchair_accessible_entrance": 8
                },
                "top_place_topics": {
                  "the pizza": 4,
                  "buffet": 3,
                  "ice cream": 3,
                  "incredible pizza": 3,
                  "kids": 3,
                  "order": 3,
                  "pay": 3,
                  "vegan": 3,
                  "app": 2,
                  "atmosphere": 2
                }
              }
            }
          ]
        }
      ]
    }
  ]
}