Introduction
The BrightLocal API provides programmatic access to BrightLocal’s Local SEO Tools. The API provides a “REST” style interface and returns all data as a JSON encoded strings.
API Types
We have two types of API methods:
- Methods which retrieve raw data offering you complete flexibility to create your own solutions (marked with Batch)
- Methods which allow you to manipulate clients and reports stored within your BrightLocal control panel (marked with Account)
The first type requires you to submit your requests as part of a batch - a container which makes it easy to bundle up multiple requests and poll for all results. You can read more about batches below.
API URL
The base API URL is: https://tools.brightlocal.com/seo-tools/api
Authentication
All methods require a valid trial or production API key.
Authentication Errors
If there’s a problem with your API key one of the following errors will be returned:
Invalid API Key
Error responses:
{
"errors": {
"INVALID_API_KEY": "Invalid API key specified"
}
}
If you see this error it means that your API key only has partial access to our API. You’ll need to contact us to get the API method you’re trying to call associated with your API key.
No Trial Requests Left
{
"errors": {
"INVALID_API_KEY": "No trial requests left"
}
}
Your trial key has used its allocation of free credits and you’re trying to call a batch API method that needs credits. Methods that manipulate your account don’t need credits or a production key.
# General Error Handling
```json
{
"errors": {
"INVALID_COMPANY_NAME": "Company name not specified",
"INVALID_COMPANY_URL": "Company URL not specified",
"INVALID_COUNTRY": "Country ISO 3 code not specified",
"INVALID_BUSINESS_CATEGORY_ID": "Business category ID not specified"
}
}
When an error occurs the data returned contains an error section with a list of relevant errors. Errors are returned when incorrect parameters are passed to an API method and in a few other distinct cases.
Generally the response will contain a top level node errors {} when an error has occurred and response {} when a successful result is returned.
API Wrapper
If you work with PHP or C# we have API wrappers which simplify authentication against our API and provide simple methods for making requests.
The PHP and C# examples in this documentation use these wrappers.
- PHP - https://github.com/BrightLocal/apiclient-php or via Composer at https://packagist.org/packages/brightlocal/apiclient-php
- C# - https://github.com/BrightLocal/apiclient-csharp or via NuGet at https://www.nuget.org/packages/Brigthlocal.apiclient-csharp/2.0.0.15.
Batches
A batch acts like a container for API requests. It allows you to group requests for several types of data together and poll for results via a single consolidated call. All bar one of our raw data APIs need to be used within the context of a batch. The basic steps for using a batch are outlined below:
- Request a new batch ID
- Add one or more requests for data to the batch
- Commit the batch
- Poll for results
Create
Batch Method
Creating a batch
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
// Step: Create a new batch
$batch = $api->createBatch();
printf('Created batch ID %d%s', $batch->getId(), PHP_EOL);
curl -X POST \
-d 'api-key=<INSERT_API_KEY>' \
https://tools.brightlocal.com/seo-tools/api/v4/batch
Api api = new Api("<INSERT_API_KEY>");
Batch batch = api.CreateBatch();
Console.WriteLine("Created batch ID '{0}'", batch.GetId());
Success - status code 201 Created
{
"success": true,
"batch-id": "17"
}
Failure
{
"success": false
}
Creates a new batch. You can add jobs to the batch to enable you to fetch different kinds of data.
A batch can have one of 5 states:
- Created - jobs can be added to the batch
- Committed - batch closed for further jobs, no jobs being processed yet
- Running - one or more jobs are being processed
- Stopped - one or more jobs in the batch failed
- Finished
Jobs within a batch can also have one of 5 states:
- Pending - added to batch but not queued for processing
- Queued - added to batch and queued for processing
- Processing - currently being processed by a worker
- Failed - processing failed
- Completed - processing completed successfully and job results are available
- Authentication for this method is via API key only.
Whilst you can technically add as many jobs as you want to a batch we recommend you submit jobs in batches of a few hundred at a time. This will allow you to start receiving results sooner.
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v4/batch
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
stop-on-job-error | 1 or 0. default 0. If errors are found in one job the batch will be stopped and no further jobs will be processed. |
callback | Callback URL. When a batch fails or completes the batch results will be posted to this callback URL |
callback_request_format | Request format for callback URL. Available values: form , json . Default: form |
Commit Batch
Batch Method
Committing a batch
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$batchId = 1;
$api = new Api('<YOUR_API_KEY>');
$batch = $api->getBatch($batchId);
$batch->commit();
printf('Committed batch successfully.%s', PHP_EOL);
curl -X PUT \
-d 'api-key=<INSERT_API_KEY>' \
-d 'batch-id=<INSERT_BATCH_ID>' \
https://tools.brightlocal.com/seo-tools/api/v4/batch
int batchId = 1;
Api api = new Api("<INSERT_API_KEY>");
Batch batch = api.GetBatch(batchId);
batch.Commit();
Console.WriteLine("Batch committed successfully");
Success - status code 200 OK
{
"success":true
}
Failure - status code 400 Bad Request
{
"success": false,
"errors" : { "INVALID_JOBS_COUNT":"Batch can't be committed with no jobs" }
}
{
"success": false,
"errors" : { "BATCH_ALREADY_COMMITTED":"This batch has been committed already" }
}
Committing a batch signals that you’ve finished adding jobs. At this point our systems will start processing the jobs that you’ve added. Once you commit a batch no further jobs can be added to it.
Authentication for this method is via API key only.
HTTP Request
PUT https://tools.brightlocal.com/seo-tools/api/v4/batch
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
batch-id | Required |
Get Results
Batch Method
Getting batch results
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$batchId = 1;
$api = new Api('<YOUR_API_KEY>');
$batch = $api->getBatch($batchId);
print_r($batch->getResults());
curl 'https://tools.brightlocal.com/seo-tools/api/v4/batch?api-key=<INSERT_API_KEY>&batch-id=<INSERT_BATCH_ID>'
int batchId = 1;
Api api = new Api("<INSERT_API_KEY>");
Batch batch = api.GetBatch(batchId);
Console.WriteLine(batch.GetResults());
Success - status code 200 OK
{
"success": true,
"status": "Finished",
"results": {
"LdFetchProfileUrl": [
{
"results": [
{
"url": "https://plus.google.com/117512971192208385977/about?hl=en&rfmt=s"
}
],
"status": "Completed",
"job-id": 318
}
],
"LdFetchProfileDetails": [
{
"results": [
{
"business_name": "Hub Plumbing & Mechanical",
"street_address": null,
"postcode": null,
"region": null,
"locality": null,
"address": "Greenwich Village New York, NY",
"contact_telephone": "+1 917-634-8888",
"description_present": true,
"num_photos": 2,
"star_rating": "4.7",
"num_reviews": 10,
"claimed": true,
"website_url": "http://www.hubplumbingnyc.com/",
"cid": "117512971192208385977",
"categories": "Plumber",
"check_in": null
}
],
"status": "Completed",
"job-id": 318
}
]
},
"statuses": {
"Completed": 2
}
}
This retrieves the results of all jobs added to the batch. Results are added as they’re returned so you can keep polling this endpoint to retrieve results progressively. Once results for all jobs have been returned the batch will be marked as “Finished”.
Authentication for this method is via API key only.
HTTP Request
GET https://tools.brightlocal.com/seo-tools/api/v4/batch
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
batch-id | Required |
Delete
Batch Method
Delete a batch
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$batchId = 1;
$api = new Api('<YOUR_API_KEY>');
$batch = $api->getBatch($batchId);
$batch->delete();
printf('Successfully deleted batch %d%s', $batchId, PHP_EOL);
curl -X DELETE 'https://tools.brightlocal.com/seo-tools/api/v4/batch?api-key=<INSERT_API_KEY>&batch-id=<INSERT_BATCH_ID>'
int batchId = 1;
Api api = new Api("<INSERT_API_KEY>");
Batch batch = api.GetBatch(batchId);
batch.Delete();
Console.WriteLine("Batch deleted successfully");
Success - status code 200 Ok
{
"success": true
}
Failure - status code 404 Not Found
{
"success": false,
"errors" : { "INVALID_BATCH_ID": "Batch ID not found" }
}
Delete a batch. This also deletes all data retrieved for jobs added to the batch.
Authentication for this method is via API key only.
HTTP Request
DELETE https://tools.brightlocal.com/seo-tools/api/v4/batch
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
batch-id | Required |
Stop Batch
Batch Method
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$batchId = 1;
$api = new Api('<YOUR_API_KEY>');
$batch = $api->getBatch($batchId);
$batch->stop();
echo 'Successfully stopped batch' . PHP_EOL;
curl -X PUT
-d 'api-key=<INSERT_API_KEY>' \
-d 'batch-id=<INSERT_BATCH_ID>' \
https://tools.brightlocal.com/seo-tools/api/v4/batch/stop
int batchId = 1;
Api api = new Api("<INSERT_API_KEY>");
Batch batch = api.GetBatch(batchId);
batch.Stop();
Console.WriteLine("Batch stoped successfully");
Success - status code 200 Ok
{
"success": true
}
Failure - status code 404 Not Found
{
"success": false,
"errors" : { "INVALID_BATCH_ID": "Batch ID not found" }
}
Cancels a batch midway through processing. Any jobs in the batch that haven’t already been processed will also be cancelled.
HTTP Request
PUT https://tools.brightlocal.com/seo-tools/api/v4/batch/stop
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
batch-id | Required |
Rankings
Local Directories
Reviews
Fetch Reviews (by profile URL)
Batch Method
Fetch reviews for Google+, Yahoo, and Yelp profile URLs
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
use BrightLocal\Exceptions\BatchAddJobException;
$directories = [
'https://local.google.com/place?id=2145618977980482902&use=srp&hl=en',
'https://local.yahoo.com/info-27778787-le-bernardin-new-york',
'https://www.yelp.com/biz/le-bernardin-new-york'
];
// setup API wrapper
$api = new Api('<YOUR_API_KEY>');
// Step 1: Create a new batch
$batch = $api->createBatch();
printf('Created batch ID %d%s', $batch->getId(), PHP_EOL);
// Step 2: Add directory jobs to batch
foreach ($directories as $directory) {
try {
$response = $batch->addJob('/v4/ld/fetch-reviews', [
'profile-url' => $directory,
'country' => 'USA'
]);
printf('Added job with ID %d%s', $response->getResult()['job-id'], PHP_EOL);
} catch (BatchAddJobException $exception) {
printf('Error, job for directory "%s" not added. Message: %s%s', $directory, $exception->getMessage(), PHP_EOL);
}
}
// Commit batch (to indicate that all jobs have been added and that processing should start)
$batch->commit();
printf('Batch committed successfully, awaiting results.%s', PHP_EOL);
do {
sleep(5);
$response = $batch->getResults();
} while (!in_array($response->getResult()['status'], ['Stopped', 'Finished'], true));
print_r($response->getResult());
List<string> profileUrls = new List<string>
{
"https://local.google.com/place?id=2145618977980482902&use=srp&hl=en",
"https://local.yahoo.com/info-27778787-le-bernardin-new-york",
"https://www.yelp.com/biz/le-bernardin-new-york"
};
Api api = new Api("<INSERT_API_KEY>");
Batch batch = api.CreateBatch();
Console.WriteLine("Created batch ID {0}", batch.GetId());
foreach (string profileUrl in profileUrls)
{
Parameters parameters = new Parameters
{
{ "country", "USA" },
{ "profile-url", profileUrl }
};
try
{
// Add jobs to batch
dynamic jobResponse = batch.AddJob("/v4/ld/fetch-reviews", parameters);
Console.WriteLine("Added job with ID {0}", jobResponse["job-id"]);
}
catch (GeneralException exception)
{
Console.WriteLine(exception.Message);
}
}
batch.Commit();
Console.WriteLine("Batch committed successfully, awaiting results.");
dynamic response;
do
{
Thread.Sleep(5000);
response = batch.GetResults();
} while (!(new List<string> { "Stopped", "Finished" }).Contains((string)response.status));
Console.WriteLine(response);
Success (201 Created)
{
"success": true,
"job-id": 318
}
Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_COUNTRY": "Invalid country specified",
"INVALID_PROFILE_URL": "Profile Url is not valid",
"INVALID_DATE_FROM": "Invalid Date From. Date Format: Y-m-d or Y-m-d H:i:s",
"INVALID_REVIEWS_LIMIT": "Reviews Limit should be positive number or 'all'"
}
}
Failure (405 Method Not Allowed)
{
"success": false,
"errors": {
"INVALID_METHOD": "Invalid method specified. Only POST method is available"
}
}
Authentication for this method is via API key only.
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v4/ld/fetch-reviews
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
batch-id | Required |
profile-url | Required For requests to fetch Google profile data please use our Google Link & ID Generator tool to generate your Google My Business Knowledge Panel URL. |
country | Required |
sort | ‘rating’ or 'date’. By default 'date’. |
reviews-limit | Positive number or 'all’. By default 100. |
date-from | Date Format: Y-m-d or Y-m-d H:i:s. By default not specified. |
start-page | See paging table below for details. |
Fetch Reviews (by business data)
Batch Method
Fetch reviews for a business using business data
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
use BrightLocal\Exceptions\BatchAddJobException;
$directories = ['google', 'yahoo'];
// setup API wrapper
$api = new Api('<YOUR_API_KEY>');
// Step 1: Create a new batch
$batch = $api->createBatch();
printf('Created batch ID %d%s', $batch->getId(), PHP_EOL);
// Step 2: Add directory jobs to batch
foreach ($directories as $directory) {
try {
$response = $batch->addJob('/v4/ld/fetch-reviews-by-business-data', [
'local-directory' => $directory,
'business-names' => 'Le Bernardin',
'country' => 'USA',
'street-address' => '155 W 51st St',
'city' => 'New York',
'postcode' => '10019',
'telephone' => '(212) 554-1515'
]);
printf('Added job with ID %d%s', $response->getResult()['job-id'], PHP_EOL);
} catch (BatchAddJobException $exception) {
printf('Error, job for directory "%s" not added. Message: %s%s', $directory, $exception->getMessage(), PHP_EOL);
}
}
// Commit batch (to indicate that all jobs have been added and that processing should start)
$batch->commit();
printf('Batch committed successfully, awaiting results.%s', PHP_EOL);
do {
sleep(5);
$response = $batch->getResults();
} while (!in_array($response->getResult()['status'], ['Stopped', 'Finished'], true));
print_r($response->getResult());
List<string> localDirectories = new List<string>
{
"google",
"yahoo",
};
Api api = new Api("<INSERT_API_KEY>");
Batch batch = api.CreateBatch();
Console.WriteLine("Created batch ID {0}", batch.GetId());
foreach (string directory in localDirectories)
{
Parameters parameters = new Parameters
{
{ "business-names", "Le Bernardin" },
{ "country", "USA" },
{ "street-address", "155 W 51st St" },
{ "city", "New York" },
{ "postcode", "10019" },
{ "telephone", "(212) 554-1515" },
{ "local-directory", directory }
};
try
{
// Add jobs to batch
dynamic jobResponse = batch.AddJob("/v4/ld/fetch-reviews-by-business-data", parameters);
Console.WriteLine("Added job with ID {0}", jobResponse["job-id"]);
}
catch (GeneralException exception)
{
Console.WriteLine(exception.Message);
}
}
batch.Commit();
Console.WriteLine("Batch committed successfully, awaiting results.");
dynamic response;
do
{
Thread.Sleep(5000);
response = batch.GetResults();
} while (!(new List<string> { "Stopped", "Finished" }).Contains((string)response.status));
Console.WriteLine(response);
Success (201 Created)
{
"success": true,
"job-id": 318
}
Success (200 Ok)
{
"success": true,
"results": {
"LdFetchProfileUrl": [
{
"results": [
{
"url": "https://www.google.com/search?q=%22%5B%22Pick+A+Bagel%22%5D%22+%2210021%22&gws_rd=cr&gl=us"
}
],
"payload": {
"business-names": "[\"Pick A Bagel\"]",
"country": "USA",
"city": "Manhattan",
"postcode": "10021",
"telephone": "(212) 717-4668",
"directory": "google",
"street-address": "1475 2nd Avenue",
"api-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"dependent-job": {
"name": "LdFetchReviews",
"payload": {
"profile-url": null,
"country": "USA",
"date-from": null,
"reviews-limit": 250,
"sort-type": "date",
"api-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
},
"status": "Completed",
"job-id": 549612293
},
{
"results": [
{
"url": "http://www.yelp.com/biz/pick-a-bagel-new-york-5"
}
],
"payload": {
"business-names": "[\"Pick A Bagel\"]",
"country": "USA",
"city": "Manhattan",
"postcode": "10021",
"telephone": "(212) 717-4668",
"directory": "yelp",
"street-address": "1475 2nd Avenue",
"api-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"dependent-job": {
"name": "LdFetchReviews",
"payload": {
"profile-url": null,
"country": "USA",
"date-from": null,
"reviews-limit": 250,
"sort-type": "date",
"api-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
},
"status": "Completed",
"job-id": 549612304
}
],
"LdFetchReviews": [
{
"results": [
{
"recommendations": [
{
"grade": "positive",
"author": "Jeremy Dayan",
"timestamp": "2016-07-30",
"text": "Nice place to have breakfast in. Relatively good prices and fast service.",
"id": "0c64b06e4c8ddaa0c6be4ba88df17f7e13cd95a0"
}
],
"reviews": [
{
"rating": 4,
"author": "Jeremy Dayan",
"timestamp": "2016-07-30",
"text": "Nice place to have breakfast in. Relatively good prices and fast service.",
"id": "0c64b06e4c8ddaa0c6be4ba88df17f7e13cd95a0"
},
{
"rating": 4,
"author": "Alain Schmid",
"timestamp": "2016-05-30",
"text": "Choose your Bagle and cream cheese from a broad range of different sets and ingredients.",
"id": "92d26048a7e297ef8911c21e35479fd2cd267d83"
},
{
"rating": 4,
"author": "David van der Loo",
"timestamp": "2016-05-30",
"text": "Okay for morning breakfast take-away.",
"id": "1d5abf2447d6d78b467fae216b630c4eef7b3eb5"
},
{
"rating": 4,
"author": "Riley Sherer",
"timestamp": "2015-09-30",
"text": "You want a bagel? Okay, pick a bagel. Come on, I don't got all day. Yeah yeah the coffee's alright.",
"id": "c88db1e509fbc2e9731f7946b84fdbfc4eb2f607"
}
],
"reviews-count":4,
"star-rating": 4
}
],
"payload": {
"profile-url": "https://www.google.com/search?q=%22%5B%22Pick+A+Bagel%22%5D%22+%2210021%22&gws_rd=cr&gl=us",
"country": "USA",
"date-from": null,
"reviews-limit": 250,
"sort-type": "date",
"api-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"parent-id": 549612293
},
"status": "Completed",
"job-id": 549612293
},
{
"results": [
{
"reviews": [
{
"rating": 1,
"author": "Krista C.",
"timestamp": "2008-05-27",
"text": "One of the worst bagels NYC has to offer.Now I don't consider myself a bagel snob but i'm used to having a Ess-A-Bagel and a Hot Jumbo Bagel around the corner.But now after moving I needed to find my new bagel place, I thought I'd give Pick-A-Bagel a try.",
"link": "http://www.yelp.com/biz/pick-a-bagel-new-york-5?hrid=6ijWFhvccHDdiSj5MnX3yQ",
"id": "c0f1160d92b4d60bb6609b7b9d4e7be31013781e"
},
{
"rating": 1,
"author": "Jeffrey C.",
"timestamp": "2008-03-04",
"text": "I don't know about others in the store but I tried from their \"make your own pasta\" menu and had the pesto sauce for the pasta. It was the worst pesto sauce I had in my life.",
"link": "http://www.yelp.com/biz/pick-a-bagel-new-york-5?hrid=1ZIo0LYcFqmK7IJTMmw_bg",
"id": "b0223bea06d6fd8e907f41ec73cc792db538b0f9"
}
],
"reviews-count": 2,
"star-rating": "1.0"
}
],
"payload": {
"profile-url": "http://www.yelp.com/biz/pick-a-bagel-new-york-5",
"country": "USA",
"date-from": null,
"reviews-limit": 250,
"sort-type": "date",
"api-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"parent-id": 549612304
},
"status": "Completed",
"job-id": 549612304
}
]
},
"statuses": {
"Completed": 6,
"Failed": 0
},
"status": "Finished"
}
Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_BUSINESS_NAMES": "Invalid Business names specified",
"INVALID_COUNTRY": "Invalid country specified",
"INVALID_CITY": "Invalid city specified",
"INVALID_POSTCODE": "Invalid postcode specified",
"INVALID_LOCAL_DIRECTORY": "Invalid local directory specified",
"INVALID_DATE_FROM": "Invalid Date From. Date Format: Y-m-d or Y-m-d H:i:s",
"INVALID_REVIEWS_LIMIT": "Reviews Limit should be positive number or 'all'"
}
}
Failure (405 Method Not Allowed)
{
"success": false,
"errors": {
"INVALID_METHOD": "Invalid method specified. Only POST method is available"
}
}
This method finds profile url then fetches reviews using this URL.
Authentication for this method is via API key only.
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v4/ld/fetch-reviews-by-business-data
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
batch-id | Required |
business-names | Required A newline (\n) separated list of possible business names to search for. For example: The Rose Pub Rose Pub The Rose. |
city | Required |
postcode | Required |
local-directory | Required See appendix below for possible options. |
street-address | |
country | Required Only USA. |
telephone | A valid telephone number. Providing this will improve the quality of results returned. |
sort | 'rating’ or 'date’. By default 'date’. |
reviews-limit | Positive number or 'all’. By default 100. |
date-from | Date Format: Y-m-d or Y-m-d H:i:s. By default not specified. |
start-page | See paging table below for details. |
Paging
We support up to 500 reviews per request to a given directory. If you need to retrieve more than 500 reviews you can use the start-page parameter and submit multiple requests to pick up older reviews. For example with Google to fetch 1000 reviews you’d need to make two requests:
- Without start-page (or with start-page=1) to fetch reviews 1 - 500. In response, you will receive reviews and the 'next-start-page’ parameter. It can be integer page number or string token. Use it on your next request.
- With start-page='Token from previous request’ to fetch reviews next reviews.
Supported Directories
Directory | Number Reviews Per Page or Token |
---|---|
token | |
trustpilot | 20 |
dentist1800 | 20 |
expedia | 500 |
token | |
grubhub | 35 |
healthgrades | |
insiderpages | 50 |
opentable | 40 |
realself | 10 |
selfstorage | 3 |
tripadvisor | 5 or 10 |
yellowpages | 20 |
Offsite SEO
Offsite SEO
Batch Method
Fetch offsite SEO information for a website address
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
use BrightLocal\Exceptions\BatchAddJobException;
$directories = [
'http://www.gramercytavern.com/',
'https://bodegawinebar.com/'
];
// setup API wrapper
$api = new Api('<YOUR_API_KEY>');
// Step 1: Create a new batch
$batch = $api->createBatch();
printf('Created batch ID %d%s', $batch->getId(), PHP_EOL);
// Step 2: Add directory jobs to batch
foreach ($directories as $directory) {
try {
$response = $batch->addJob('/v4/seo/offsite', [
'website-url' => $directory,
]);
printf('Added job with ID %d%s', $response->getResult()['job-id'], PHP_EOL);
} catch (BatchAddJobException $exception) {
printf('Error, job for directory "%s" not added. Message: %s%s', $directory, $exception->getMessage(), PHP_EOL);
}
}
// Commit batch (to indicate that all jobs have been added and that processing should start)
$batch->commit();
printf('Batch committed successfully, awaiting results.%s', PHP_EOL);
do {
sleep(5);
$response = $batch->getResults();
} while (!in_array($response->getResult()['status'], ['Stopped', 'Finished'], true));
print_r($response->getResult());
List<string> directories = new List<string>
{
"http://www.gramercytavern.com/",
"https://bodegawinebar.com/"
};
Api api = new Api("<INSERT_API_KEY>");
Batch batch = api.CreateBatch();
Console.WriteLine("Created batch ID {0}", batch.GetId());
foreach (string directory in directories)
{
Parameters parameters = new Parameters
{
{ "website-url", directory }
};
try
{
// Add jobs to batch
dynamic jobResponse = batch.AddJob("/v4/seo/offsite", parameters);
Console.WriteLine("Added job with ID {0}", jobResponse["job-id"]);
}
catch (GeneralException exception)
{
Console.WriteLine(exception.Message);
}
}
batch.Commit();
Console.WriteLine("Batch committed successfully, awaiting results.");
dynamic response;
do
{
Thread.Sleep(5000);
response = batch.GetResults();
} while (!(new List<string> { "Stopped", "Finished" }).Contains((string)response.status));
Console.WriteLine(response);
Success (201 Created)
{
"success": true,
"job-id": 318
}
Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_BATCH_ID": "Batch ID not found",
"INVALID_WEBSITE_URL": "Website URL missing"
}
}
Failure (405 Method Not Allowed)
{
"success": false,
"errors": {
"INVALID_METHOD": "Invalid method specified. Only POST method is available"
}
}
This API method returns offsite SEO information domain age, hosting location, number of pages indexed and authority. Authentication for this method is via API key only.
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v4/seo/offsite
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
batch-id | Required |
website-url | Required URL of the business web site. Can be specified with or without http(s). |
Clients
Locations
Rank Checker
Citation Tracker
Add Report
Account Method
Add Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->post('/v2/ct/add', [
'location-id' => 1,
'business-type' => 'Restaurant',
'primary-location' => '10020'
]);
print_r($response->getResult());
curl -X POST \
-d 'api-key=<INSERT_API_KEY>' \
-d 'location-id=1' \
-d 'business-type=Restaurant' \
-d 'primary-location=10020' \
https://tools.brightlocal.com/seo-tools/api/v2/ct/add
Api api = new Api("<INSERT_API_KEY>");
Parameters parameters = new Parameters
{
{ "location-id", 1 },
{ "business-type", "Restaurant" },
{ "primary-location", "10019" },
};
dynamic response = api.Post("v2/ct/add", parameters).GetContent();
Console.WriteLine(response);
Success (200 OK)
{
"response": {
"status": "added",
"report-id": 682
}
}
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v2/ct/add
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
location-id | Required You can specify location ID or unique reference to create report for a location |
report-name | Deprecated, please use Location for updating this field. |
business-name | Deprecated, please use Location for updating this field. |
address-1 | Deprecated, please use Location for updating this field. |
address-2 | Deprecated, please use Location for updating this field. |
business-location | Deprecated, please use Location for updating this field. |
postcode | Deprecated, please use Location for updating this field. |
country | Deprecated, please use Location for updating this field. |
phone | Deprecated, please use Location for updating this field. |
website | Deprecated, please use Location for updating this field. |
business-type | Required Business type (e.g. Hotel) NOT a business category (e.g. Hotels & Guest houses). |
state-code | Deprecated, please use Location for updating this field. |
monthly-run | One of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31. Defaults to 0 (none). |
weekly-run | One of 1, 2, 3, 4, 5, 6, 7. Defaults to 0 (none). |
white-label-profile-id | Deprecated, please use Location for updating this field. |
active-only | Deprecated |
notify | One of yes or no. If set to yes we will send report alerts to all email addresses specified (see field below). If you include customer email addresses when setting up your report we’ll also email them the alerts so please be sure this is what you want before adding their addresses. Default is no. |
email-addresses | Supply one or more (max 5) email addresses for us to send report alerts to. Emails should be passed as a JSON encoded array. This only takes effect if notify is set to yes. |
is-public | Deprecated, please use Location for update this field. |
primary-location | Required We use ‘Location’ to identify your top 10 ‘Google+ Local’ competitors. Please enter your city/town name or zip/postcode. Note: for US businesses we strongly recommend that you use only 5 digit zips (99750, NOT 99750-0077) as using the longer format can make it harder for us to find competitors. |
Update Report
Account Method
Update Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->post('/v2/ct/update', [
'location-id' => 1,
'report-id' => 682,
'business-type' => 'Restaurant',
]);
print_r($response->getResult());
curl -X POST \
-d 'api-key=<INSERT_API_KEY>' \
-d 'location-id'=1,
-d 'report-id'=682,
-d 'business-type=Restaurant' \
https://tools.brightlocal.com/seo-tools/api/v2/ct/update
Api api = new Api("<INSERT_API_KEY>");
Parameters parameters = new Parameters
{
{ "location-id", 1 },
{ "report-id", 682 },
{ "business-type", "Restaurant" },
{ "primary-location", "10019" },
};
dynamic response = api.Post("v2/ct/update", parameters).GetContent();
Console.WriteLine(response);
Success (200 OK)
{
"response": {
"status": "edited"
}
}
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v2/ct/update
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
location-id | Required You can specify location ID or unique reference to create report for a location. |
report-id | Required |
report-name | Deprecated, please use Location for updating this field. |
business-name | Deprecated, please use Location for updating this field. |
address-1 | Deprecated, please use Location for updating this field. |
address-2 | Deprecated, please use Location for updating this field. |
business-location | Deprecated, please use Location for updating this field. |
postcode | Deprecated, please use Location for updating this field. |
country | Deprecated, please use Location for updating this field. |
phone | Deprecated, please use Location for updating this field. |
website | Deprecated, please use Location for updating this field. |
business-type | Business type (e.g. Hotel) NOT a business category (e.g. Hotels & Guest houses). |
location | |
state-code | Deprecated, please use Location for updating this field. |
monthly-run | One of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31. Defaults to 0 (none). |
weekly-run | One of 1, 2, 3, 4, 5, 6, 7. Defaults to 0 (none). |
white-label-profile-id | Deprecated, please use Location for updating this field. |
active-only | Deprecated |
notify | One of yes or no. If set to yes we will send report alerts to all email addresses specified (see field below). If you include customer email addresses when setting up your report we’ll also email them the alerts so please be sure this is what you want before adding their addresses. Default is no. |
email-addresses | Supply one or more (max 5) email addresses for us to send report alerts to. Emails should be passed as a JSON encoded array. This only takes effect if notify is set to yes. |
is-public | Deprecated, please use Location for update this field. |
Get Report
Account Method
Get Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->get('/v2/ct/get', [
'report-id' => 682
]);
print_r($response->getResult());
curl -X GET 'https://tools.brightlocal.com/seo-tools/api/v2/ct/get?api-key=<INSERT_API_KEY>&report-id=682'
int reportId = 682;
Api api = new Api("<INSERT_API_KEY>");
Response report = api.Get("v2/ct/get", new Parameters { { "report-id", reportId } });
Console.WriteLine(report.GetContent());
Success (200 OK)
{
"success": true,
"report": {
"report_id": "255565",
"customer_id": "88",
"location_id": "1",
"weekly_run": "3",
"monthly_run": "0",
"report_name": "The View",
"website_address": "www.ullubatanc.com",
"business_name": "Ullu Bata Inc.",
"business_location": "London",
"postcode": "ABCD1234",
"country": "GBR",
"state_code": null,
"address1": "",
"address2": "",
"telephone": "01273 207 100",
"business_type": "Restaurant",
"primary_location": "Brighton",
"last_run_id": "1185703",
"last_run": "2015-10-28 05:31:59",
"company_name": "Ullu Bata Inc.",
"white_label_profile_id": "7819",
"notify": "0",
"email_addresses": "[\"example@brightlocal.com\"]",
"active_only": "",
"is_public": "Yes",
"public_key": "<REPLACED>",
"created": "2015-10-28 05:00:34",
"status": "complete",
"urls": {
"interactive_url": "https:\/\/tools.brightlocal.com\/seo-tools\/admin\/ct\/reports\/view\/255565",
"pdf_url": "https:\/\/tools.brightlocal.com\/seo-tools\/admin\/ct\/reports\/pdf\/255565",
"csv_url": "https:\/\/tools.brightlocal.com\/seo-tools\/admin\/ct\/reports\/csv\/255565",
"public_interactive_url": "<REPLACED>",
"public_pdf_url": "<REPLACED>",
"public_csv_url": "<REPLACED>"
}
}
}
HTTP Request
GET https://tools.brightlocal.com/seo-tools/api/v2/ct/get
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
report-id | Required |
Run Report
Account Method
Run Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->post('/v2/ct/run', [
'report-id' => 682
]);
print_r($response->getResult());
curl -X POST \
-d 'api-key=<INSERT_API_KEY>' \
-d 'report-id=682' \
https://tools.brightlocal.com/seo-tools/api/v2/ct/run
int reportId = 682;
Api api = new Api("<INSERT_API_KEY>");
Parameters parameters = new Parameters
{
{ "report-id", reportId }
};
Response response = api.Post("v2/ct/run", parameters);
Console.WriteLine(response.GetContent());
Success (200 OK)
{
"response": {
"status": "running"
}
}
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v2/ct/run
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
report-id | Required |
Delete Report
Account Method
Delete Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->post('/v2/ct/delete', [
'report-id' => 682
]);
var_dump($response->getResult());
if ($response->isSuccess()) {
echo 'Successfully deleted report.' . PHP_EOL;
}
curl -X POST \
-d 'api-key=<INSERT_API_KEY>' \
-d 'report-id=682' \
https://tools.brightlocal.com/seo-tools/api/v2/ct/delete
int reportId = 682;
Api api = new Api("<INSERT_API_KEY>");
Response status = api.Post(
"v2/ct/delete",
new Parameters { { "report-id", reportId } });
Console.WriteLine(status.GetContent());
Success (200 OK)
{
"response": {
"status": "deleted"
}
}
Warning: This action cannot be undone.
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v2/ct/delete
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
report-id | Required |
Get All Reports
Account Method
Get All Reports
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->get('/v2/ct/get-all');
print_r($response->getResult());
curl -X GET 'https://tools.brightlocal.com/seo-tools/api/v2/ct/get-all?api-key=<INSERT_API_KEY>'
int locationId = 1;
Api api = new Api("<INSERT_API_KEY>");
Response reports = api.Get("v2/ct/get-all");
Console.WriteLine(reports.GetContent());
Success (200 OK)
{
"response": {
"results": [
{
"report_id": "278",
"customer_id": "35",
"location_id": "5",
"report_run_id": "2457",
"report_name": "Test 1",
"website_address": "http://www.test1.com",
"business_name": "Test 1",
"business_location": "Test location",
"postcode": "TEST TEST",
"country": "GBR",
"state_code": null,
"cancel_run": "0",
"address1": "",
"address2": "",
"telephone": "0123456789",
"business_type": "Pub",
"primary_location": "Fulham",
"currently_running": "No",
"generation_error": "No",
"terminal_fail": "No",
"last_run": "2012-09-07 11:45:56",
"report_status": null,
"your_ct_count": "197",
"your_ct_count_up": "0",
"your_ct_count_down": "0",
"total_ct_sources": "230",
"total_ct_sources_up": "0",
"competitor_ct_count": "76",
"competitor_ct_count_diff": null,
"old_ct_count": "0",
"company_name": null,
"branding_profile_id": null,
"notify": "0",
"email_addresses": "['test@test1.com']",
"your_ct_count_diff": 0,
"competitor_ct_count_up": 0,
"competitor_ct_count_down": 0,
"total_ct_sources_diff": 0,
"successful_runs": "1"
},
{
"report_id": "660",
"customer_id": "35",
"location_id": "0",
"report_run_id": "2756",
"report_name": "Test 2",
"website_address": "",
"business_name": "Test 2",
"postcode": "chicago",
"country": "USA",
"state_code": "IL",
"cancel_run": "0",
"address1": "",
"address2": "",
"telephone": "0123456789",
"business_type": "car hire",
"primary_location": "chicago",
"currently_running": "No",
"generation_error": "No",
"terminal_fail": "No",
"last_run": "2013-05-21 11:18:31",
"report_status": null,
"your_ct_count": "633",
"your_ct_count_up": "129",
"your_ct_count_down": "0",
"total_ct_sources": "356",
"total_ct_sources_up": "100",
"competitor_ct_count": "90",
"competitor_ct_count_diff": "10",
"old_ct_count": "0",
"company_name": null,
"branding_profile_id": null,
"notify": "0",
"email_addresses": "['test@test2.com']",
"your_ct_count_diff": 0,
"competitor_ct_count_up": 0,
"competitor_ct_count_down": 0,
"total_ct_sources_diff": 0,
"successful_runs": "2"
}
]
}
}
HTTP Request
GET https://tools.brightlocal.com/seo-tools/api/v2/ct/get-all
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
location-id |
Get Report Results
Account Method
Get Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->get('/v2/ct/get-results', [
'report-id' => 2457
]);
print_r($response->getResult());
curl -X GET 'https://tools.brightlocal.com/seo-tools/api/v2/ct/get-results?api-key=<INSERT_API_KEY>&report-id=2457'
int reportId = 2457;
Api api = new Api("<INSERT_API_KEY>");
Response response = api.Get("v2/ct/get-results", new Parameters
{
{ "report-id", reportId }
});
Console.WriteLine(response.GetContent());
Success (200 OK)
{
"response": {
"results": {
"active": [
{
"id": "",
"citation_id": 182555,
"customer_id": "35",
"report_id": "2457",
"citation-status": "active",
"source": "carricktoday.co.uk",
"url": "http://www.carricktoday.co.uk/findit?action=showMap&placeid=68739",
"citation-notes": null,
"status": "Got it",
"date-identified-sorting": "2012-09-07T00:00:00+00:00",
"date-identified": "07 Sep 12",
"domain-authority": "38.75",
"citation-value": "Unknown",
"moz-rank": "Unknown",
"site-type": "Local Directory",
"listing-type": "Free Listing",
"seomoz-lookup-complete": "Yes",
"business-name": null,
"postcode": null
}
],
"pending": [
],
"possible": [
],
"activeDomains": {
"facebook.com": true,
"twitter.com": true,
"yelp.com": true,
"yell.com": true,
"thomsonlocal.com": true,
"beerintheevening.com": true,
"hotfrog.co.uk": true,
"cylex-uk.co.uk": true
},
"pendingDomains": {
},
"possibleDomains": {
},
"topDirectories": [
{
"citation_id": 182555,
"customer_id": "35",
"report_id": "2457",
"citation-status": "active",
"source": "carricktoday.co.uk",
"url": "http://www.carricktoday.co.uk/findit?action=showMap&placeid=68739",
"citation-notes": null,
"status": "Got it",
"date-identified-sorting": "2012-09-07T00:00:00+00:00",
"date-identified": "07 Sep 12",
"domain-authority": "38.75",
"citation-value": "Unknown",
"moz-rank": "Unknown",
"site-type": "Local Directory",
"listing-type": "Free Listing",
"seomoz-lookup-complete": "Yes",
"business-name": "John's business",
"address": "Lungomare Zara, 1234 Giulianova",
"postcode": "1234",
"website-url": "http://www.johns-s-business.co.uk/",
"telephone": "03 12345678"
}
],
"flags": {
"customer": {
"new": [],
"disappeared": []
},
"competitor": {
"new": [],
"disappeared": []
}
},
"competitors": {
}
}
}
}
HTTP Request
GET https://tools.brightlocal.com/seo-tools/api/v2/ct/get-results
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
report-id | Required |
Citation Builder
Reputation Manager
Google My Business
Add Report
Account Method
Add Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->post('/v4/gpw/add', [
'location_id' => 1,
'schedule' => 'Adhoc',
'day_of_month' => '2',
'report_type' => 'with',
'google_location' => 'New York, NY',
'search_terms' => '["restaurant manhattan","cafe new york"]'
]);
print_r($response->getResult());
curl -X POST \
-d 'api-key=<INSERT_API_KEY>' \
-d 'location_id=1' \
-d 'schedule=Adhoc' \
-d 'day_of_month=2' \
-d 'report_type=with' \
-d 'search_terms=["restaurant manhattan","cafe new york"]'
https://tools.brightlocal.com/seo-tools/api/v4/gpw/add
Api api = new Api(apiKey);
Parameters parameters = new Parameters
{
{ "location_id", 1 },
{ "schedule", "Adhoc" },
{ "day_of_month", "2" },
{ "report_type", "with" },
{ "google_location", "New York, NY" },
{ "search_terms", new List<string> { "restaurant manhattan", "cafe new york" } },
};
Response response = api.Post("/v4/gpw/add", parameters);
Console.WriteLine(response.GetContent());
Success (201 Created)
{
"success": true,
"report-id": "1"
}
Validation Failure (400 Bad Request)
{
"success": false,
"errors": {
"run": "You don\'t have any credits left",
"report_type": "Report type is not available",
"search_terms": "Please enter at least one search term",
"google_location": "The location was not recognized. Please enter a correct location",
"schedule": "Please select schedule"
}
}
Adds a new Google My Business report to your account.
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v4/gpw/add
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
report_name | Deprecated, please use Location for update this field. |
location_id | Required Associate this report with a location in your account. This ID needs to correspond to a valid location in your account. |
white_label_profile_id | Deprecated, please use Location for update this field. |
business_names | Deprecated, please use Location for update this field. |
schedule | Required One of Adhoc or Monthly |
day_of_month | Required One of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, -1 (last day of month). |
report_type | Required One of with or without. ‘with’ - the business has a Google Local profile. 'without’ - Ignore this business, just display competitor information. Defaults to with. |
address1 | Deprecated, please use Location for update this field. |
address2 | Deprecated, please use Location for update this field. |
city | Deprecated, please use Location for update this field. |
state_code | Deprecated, please use Location for update this field. |
google_location | Required A valid google search location. Please refer to our location check method. |
is_public | Deprecated, please use Location for update this field. |
postcode | Deprecated, please use Location for update this field. |
phone_number | Deprecated, please use Location for update this field. |
country | Deprecated, please use Location for update this field. |
search_terms | Required Supply one or more search terms (max 5) as a JSON string. For example, [“restaurant san francisco”,“cafe san francisco”]. |
notify | One of Yes or No. If set to yes we will send report alerts to all email addresses specified (see field below). If you include customer email addresses when setting up your report we’ll also email them the alerts so please be sure this is what you want before adding their addresses. Default is No. |
email_addresses | Supply one or more (max 5) email addresses for us to send report alerts to. This only takes effect if notify is set to Yes. JSON string. For example, [“email1@test.com”,“email2@test.com”]. |
run | One of Yes or No. Runs the report after adding. Defaults to Yes. |
Update Report
Account Method
Update Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$reportId = 1;
$api = new Api('<YOUR_API_KEY>');
$response = $api->put('/v4/gpw/' . $reportId, [
'location-id' => 1,
'schedule' => 'Adhoc'
]);
print_r($response->getResult());
curl -X PUT \
-d 'api-key=<INSERT_API_KEY>' \
-d 'location_id=1' \
-d 'schedule=Adhoc' \
-d 'day_of_month=2' \
https://tools.brightlocal.com/seo-tools/api/v4/gpw/1
int reportId = 1;
Api api = new Api(apiKey);
Parameters parameters = new Parameters
{
{ "location-id", 1 },
{ "schedule", "Adhoc" },
};
Response response = api.Put("/v4/gpw/"+ reportId, parameters);
Console.WriteLine(response.GetContent());
Success (200 OK)
{
"success": true
}
Validation Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_REPORT_ID": "Report ID invalid"
}
}
HTTP Request
PUT https://tools.brightlocal.com/seo-tools/api/v4/gpw/<reportId>
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
report-ID | Required |
report_name | Deprecated, please use Location for update this field. |
location_id | Required Associate this report with a location in your account. This ID needs to correspond to a valid location in your account. |
white_label_profile_id | Deprecated, please use Location for update this field. |
business_names | Deprecated, please use Location for update this field. |
schedule | One of Adhoc or Monthly |
day_of_month | One of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, -1 (last day of month). |
report_type | One of with or without. 'with’ - the business has a Google Local profile. 'without’ - Ignore this business, just display competitor information. Defaults to with. |
address1 | Deprecated, please use Location for update this field. |
address2 | Deprecated, please use Location for update this field. |
city | Deprecated, please use Location for update this field. |
state_code | Deprecated, please use Location for update this field. |
postcode | Deprecated, please use Location for update this field. |
phone_number | Deprecated, please use Location for update this field. |
country | Deprecated, please use Location for update this field. |
search_terms | Supply one or more search terms (max 5) as a JSON string. For example, [“restaurant san francisco”,“cafe san francisco”]. |
notify | One of Yes or No. If set to yes we will send report alerts to all email addresses specified (see field below). If you include customer email addresses when setting up your report we’ll also email them the alerts so please be sure this is what you want before adding their addresses. Default is No. |
email_addresses | Supply one or more (max 5) email addresses for us to send report alerts to. This only takes effect if notify is set to Yes. JSON string. For example, [“email1@test.com”,“email2@test.com”]. |
google_location | A valid google search location. Please refer to our location check method. |
is_public | Deprecated, please use Location for update this field. |
run | One of Yes or No. Runs the report after adding. Defaults to Yes. |
Get Report
Account Method
Get Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$reportId = 1;
$api = new Api('<YOUR_API_KEY>');
$response = $api->get('/v4/gpw/' . $reportId);
print_r($response->getResult());
curl -X GET 'https://tools.brightlocal.com/seo-tools/api/v4/gpw/1?api-key=<INSERT_API_KEY>'
int reportId = 1;
Api api = new Api(apiKey);
Response response = api.Get("v4/gpw/" + reportId);
Console.WriteLine(response.GetContent());
Success (200 OK)
{
"success": true,
"report": {
"report_id": "1",
"report_name": "Report name",
"customer_id": "1",
"location_id": "1000",
"schedule": "Adhoc",
"day_of_week": "0",
"day_of_month": "0",
"white_label_profile_id": "24",
"report_type": "without",
"business_names": [
"Business name1"
],
"postcode": "90210",
"country": "USA",
"state_code": "IL",
"address1": "email@test.com",
"address2": null,
"city": "Chicago, IL",
"phone_number": null,
"search_terms": [
"search_term1",
"search_term2",
"search_term3"
],
"google_location": "Chicago, IL",
"notify": "Yes",
"email_addresses": [
"email@company.com"
],
"notify_about_changes": true,
"email_addresses_for_changes": [
"email@company.com"
],
"is_public": "Yes",
"public_key": "<hidden>",
"is_running": "No"
}
}
Validation Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_REPORT_ID" : "Report ID invalid"
}
}
HTTP Request
GET https://tools.brightlocal.com/seo-tools/api/v4/gpw/<reportId>
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
Delete Report
Account Method
Delete Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$reportId = 1;
$api = new Api('<YOUR_API_KEY>');
$response = $api->delete('/v4/gpw/' . $reportId);
var_dump($response->getResult());
if ($response->isSuccess()) {
echo 'Successfully deleted report.' . PHP_EOL;
}
curl -X DELETE \
-d 'api-key=<INSERT_API_KEY>' \
https://tools.brightlocal.com/seo-tools/api/v4/gpw/1
int reportId = 1;
Api api = new Api(apiKey);
Response response = api.Delete("/v4/gpw/" + reportId);
if (response.IsSuccess())
{
Console.WriteLine("Successfully deleted report.");
}
else
{
Console.WriteLine(response.GetContent());
}
Success (200 OK)
{
"success": true
}
Validation Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_REPORT_ID": "Report ID invalid"
}
}
HTTP Request
DELETE https://tools.brightlocal.com/seo-tools/api/v4/gpw/<reportId>
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
Get All Reports
Account Method
Get All Reports
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->get('/v4/gpw/');
print_r($response->getResult());
curl -X GET 'https://tools.brightlocal.com/seo-tools/api/v4/gpw?api-key=<INSERT_API_KEY>'
Api api = new Api(apiKey);
Response response = api.Get("/v4/gpw/");
Console.WriteLine(response.GetContent());
Success (200 OK)
{
"response": {
"results": [
{
"report_id": "49",
"report_name": "Test 1",
"schedule": "Weekly",
"is_running": "Yes",
"running_message": "Identifying your top Google Local competitors"
},
{
"report_id": "50",
"report_name": "Test 2",
"schedule": "Monthly",
"is_running": "No",
"running_message": ""
}
]
}
}
Validation Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_LOCATION_ID": "Invalid location ID supplied"
}
}
Returns basic details about all reports associated with your account.
HTTP Request
GET https://tools.brightlocal.com/seo-tools/api/v4/gpw
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
location-id |
Run Report
Account Method
Run Report
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$api = new Api('<YOUR_API_KEY>');
$response = $api->post('/v4/gpw/run', [
'report-id' => 860
]);
print_r($response->getResult());
curl -X PUT \
-d 'api-key=<INSERT_API_KEY>' \
-d 'report-id=860' \
https://tools.brightlocal.com/seo-tools/api/v4/gpw/run
int reportId = 860;
Api api = new Api(apiKey);
Response response = api.Put("/v4/gpw/run", new Parameters { ["report-id"] = reportId });
Console.WriteLine(response.GetContent());
Success (200 OK)
{
"success": true
}
Validation Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_REPORT_ID" : "Report ID missing",
"NO_CREDITS" : "You don't have any credits left"
}
}
Failure when report already running (400 Bad Request)
{
"success": false,
"errors": {
"REPORT_RUNNING": "Report is already running"
}
}
HTTP Request
POST https://tools.brightlocal.com/seo-tools/api/v4/gpw/run
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
report-id | Required The unique ID for the report in your account. |
Get Report Results
Account Method
Get Report Results
<?php
require '../../vendor/autoload.php';
use BrightLocal\Api;
$reportId = 1;
$api = new Api('<YOUR_API_KEY>');
$response = $api->get('/v4/gpw/' . $reportId . '/results');
print_r($response->getResult());
curl -X GET 'https://tools.brightlocal.com/seo-tools/api/v4/gpw/1/results?api-key=<INSERT_API_KEY>'
int reportId =1;
Api api = new Api(apiKey);
Response response = api.Get("/v4/gpw/" + reportId + "/results");
Console.WriteLine(response.GetContent());
Success (200 OK)
{
"success": true,
"results": {
"summary": {
"business_name": "Iron Galaxy Studios LLC",
"address": "300 E Colorado Blvd, Pasadena, CA 91101, United States",
"telephone": "+1 123-456-7890",
"website_address": "http://www.example.com",
"opening_hours": [
"Wednesday 4PM–1AM",
"Thursday 4PM–1AM",
"Friday 4PM–1AM",
"Saturday 4PM–1AM",
"Sunday(Easter) 4PM–1AM Hours might differ",
"Monday 4PM–1AM",
"Tuesday 4PM–1AM"
],
"profile_url": "https://www.google.co.uk/search?q=Iron+Galaxy+Studios+LLC&oq=Iron+Galaxy+Studios+LLC",
"claimed": false,
"citations_count": 74,
"domain_authority": 37.65,
"backlinks": 1395,
"num_reviews": 6,
"star_rating": 4,
"review_content": "The Hotel is very conveniently located and the room nice",
"num_photos": 0,
"categories": [
"Financial Planner"
]
},
"keywords": {
"iron": {
"client_rank": 1,
"top_10": [
{
"business_name": "Iron Galaxy Studios LLC",
"rank": "A",
"client_business": true,
"profile_url": "https://www.google.co.uk/search?q=Iron+Galaxy+Studios+LLC&oq=Iron+Galaxy+Studios+LLC",
"claimed": false,
"citations_count": 74,
"domain_authority": "37/100",
"backlinks": 1395,
"num_reviews": 4,
"star_rating": "5/5",
"num_photos": 0,
"categories": [
"Hotel"
]
},
{
"business_name": "Iron Financial Management Inc",
"rank": "B",
"client_business": false,
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&q=Iron+Financial+Management+Inc",
"claimed": false,
"citations_count": 118,
"domain_authority": "22/100",
"backlinks": 86,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 0,
"categories": [
"Financial Planner"
]
},
{
"business_name": "Chicago Tube and Iron Company",
"rank": "C",
"client_business": false,
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&q=Chicago+Tube+and+Iron+Company+Chicago",
"claimed": false,
"citations_count": 106,
"domain_authority": "30/100",
"backlinks": 190,
"num_reviews": 2,
"star_rating": "1/5",
"num_photos": 0,
"categories": [
"Hotel",
"Hotel",
"Hotel",
"Hotel"
]
},
{
"business_name": "Acorn Wire & Iron Works LLC",
"rank": "D",
"client_business": false,
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&gbv=2&q=Acorn+Wire+%26+Iron+Works+LLC%2C+chicago",
"claimed": false,
"citations_count": 56,
"domain_authority": "29/100",
"backlinks": 80,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 1,
"categories": [
"Fence Supply Store"
]
},
{
"business_name": "Iron & Wire Custom Metal Studio LLC",
"rank": "E",
"client_business": false,
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&gbv=2&q=Iron+%26+Wire+Custom+Metal+Studio+LLC%2C+chicago",
"claimed": true,
"citations_count": 25,
"domain_authority": "18/100",
"backlinks": 18,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 2,
"categories": [
"Metal Fabricator",
"Interior Designer",
"Steel Fabricator"
]
},
{
"business_name": "Adams Street Iron Inc",
"rank": "F",
"client_business": false,
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&biw=1277&bih=573&q=Adams+Street+Iron+Inc%2C+Chicago",
"claimed": false,
"citations_count": 66,
"domain_authority": "10/100",
"backlinks": 7,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 0,
"categories": [
"Hotel",
"General Contractor"
]
},
{
"business_name": "Iron Workers Union",
"rank": "G",
"client_business": false,
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&gbv=2&q=Iron+Workers+Union%2C+chicago+60130",
"claimed": false,
"citations_count": 39,
"domain_authority": "48/100",
"backlinks": 5037,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 0,
"categories": [
"Hotel",
"Non-Profit Organization"
]
},
{
"business_name": "Shaw Environmental/Infrstrctr",
"rank": "H",
"client_business": false,
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&gbv=2&q=Shaw+Environmental%2FInfrstrctr%2C+chicago",
"claimed": false,
"citations_count": 52,
"domain_authority": "60/100",
"backlinks": 8884,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 0,
"categories": [
"Hotel"
]
}
],
"citations_matrix": [
{
"domain": "facebook.com",
"authority": "100/100",
"count": 5,
"businesses": [
{
"business_name": "Iron Galaxy Studios LLC",
"citations_count": "74",
"url": "https://www.facebook.com/103101903089752"
},
{
"business_name": "Iron Financial Management Inc",
"citations_count": "118",
"url": null
},
{
"business_name": "Chicago Tube and Iron Company",
"citations_count": "106",
"url": "https://www.facebook.com/pages/Law-Offices-of-Bernard-D-Ward-PC-708-349-5600-815-834-2000/143994815665091"
},
{
"business_name": "Acorn Wire & Iron Works LLC",
"citations_count": "56",
"url": null
},
{
"business_name": "Iron & Wire Custom Metal Studio LLC",
"citations_count": "25",
"url": "https://www.facebook.com/pages/Iron-Wire/104803202926726?sk=info"
},
{
"business_name": "Adams Street Iron Inc",
"citations_count": "66",
"url": "https://www.facebook.com/pages/Adams-Street-Iron/117016575024837"
},
{
"business_name": "Iron Workers Union",
"citations_count": "39",
"url": null
},
{
"business_name": "Shaw Environmental/Infrstrctr",
"citations_count": "52",
"url": "https://www.facebook.com/pages/International-Technology-Corp/154765177895978"
}
]
},
{
"domain": "linkedin.com",
"authority": "100/100",
"count": 2,
"businesses": [
{
"business_name": "Iron Galaxy Studios LLC",
"citations_count": "74",
"url": "https://www.linkedin.com/in/michaelpickens"
},
{
"business_name": "Iron Financial Management Inc",
"citations_count": "118",
"url": "https://www.linkedin.com/pub/miles-muslin/18/287/950"
},
{
"business_name": "Chicago Tube and Iron Company",
"citations_count": "106",
"url": null
},
{
"business_name": "Acorn Wire & Iron Works LLC",
"citations_count": "56",
"url": null
},
{
"business_name": "Iron & Wire Custom Metal Studio LLC",
"citations_count": "25",
"url": null
},
{
"business_name": "Adams Street Iron Inc",
"citations_count": "66",
"url": null
},
{
"business_name": "Iron Workers Union",
"citations_count": "39",
"url": null
},
{
"business_name": "Shaw Environmental/Infrstrctr",
"citations_count": "52",
"url": null
}
]
}
],
"nap_comparison": [
{
"taken_from": "User supplied",
"business_name": "Example & Co",
"address": "email@example.com Chicago, IL IL",
"postcode": "90210",
"telephone": "4234324234"
},
{
"taken_from": "Google Listing",
"business_name": null,
"address": "",
"postcode": null,
"telephone": null
}
],
"top_categories": {
"Hotel": 8,
"General Contractor": 1,
"Non-Profit Organization": 1,
"Steel Fabricator": 1,
"Metal Fabricator": 1
},
"other_ranking_factors": []
},
"gold": {
"top_10": [
{
"business_name": "Gold Eagle",
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&site=&source=hp&q=gold+eagle+chicago",
"claimed": true,
"citations_count": 62,
"domain_authority": "45/100",
"backlinks": 9918,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 0,
"categories": [
"Shipping Company"
]
},
{
"business_name": "Rickey Gold Associates",
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&q=Rickey+Gold+Associates",
"claimed": false,
"citations_count": 96,
"domain_authority": "26/100",
"backlinks": 57,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 0,
"categories": [
"Marketing Consultant"
]
},
{
"business_name": "Bentley Gold Coast",
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&q=Bentley+Gold+Coast%2C+Chicago&oq=Bentley+Gold+Coast%2C+Chicago",
"claimed": false,
"citations_count": 89,
"domain_authority": "32/100",
"backlinks": 87,
"num_reviews": 58,
"star_rating": "4.2/5",
"num_photos": 5,
"categories": [
"Car Dealer"
]
},
{
"business_name": "Gold Coast Tickets",
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&q=Gold+Coast+Tickets%2C+Chicago",
"claimed": false,
"citations_count": 47,
"domain_authority": "34/100",
"backlinks": 1362,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 0,
"categories": [
"Event Ticket Seller"
]
},
{
"business_name": "Gold Canyon Candles",
"profile_url": "https://www.google.co.uk/search?newwindow=1&safe=active&q=Gold+Canyon+Candles%2C+Schaumburg%2C+IL+60193",
"claimed": true,
"citations_count": 19,
"domain_authority": "n/a",
"backlinks": 0,
"num_reviews": 0,
"star_rating": "0/5",
"num_photos": 0,
"categories": [
"Gift Basket Store",
"Hotel"
]
}
],
"citations_matrix": [
{
"domain": "facebook.com",
"authority": "100/100",
"count": 6,
"businesses": [
{
"business_name": "Iron Galaxy Studios LLC",
"citations_count": "74",
"url": "https://www.facebook.com/103101903089752"
},
{
"business_name": "Iron Financial Management Inc",
"citations_count": "118",
"url": null
},
{
"business_name": "Chicago Tube and Iron Company",
"citations_count": "106",
"url": "https://www.facebook.com/pages/Law-Offices-of-Bernard-D-Ward-PC-708-349-5600-815-834-2000/143994815665091"
},
{
"business_name": "Acorn Wire & Iron Works LLC",
"citations_count": "56",
"url": null
},
{
"business_name": "Iron & Wire Custom Metal Studio LLC",
"citations_count": "25",
"url": "https://www.facebook.com/pages/Iron-Wire/104803202926726?sk=info"
},
{
"business_name": "Adams Street Iron Inc",
"citations_count": "66",
"url": "https://www.facebook.com/pages/Adams-Street-Iron/117016575024837"
},
{
"business_name": "Iron Workers Union",
"citations_count": "39",
"url": null
},
{
"business_name": "Shaw Environmental/Infrstrctr",
"citations_count": "52",
"url": "https://www.facebook.com/pages/International-Technology-Corp/154765177895978"
},
{
"business_name": "Gold Eagle",
"citations_count": "62",
"url": null
},
{
"business_name": "Rickey Gold Associates",
"citations_count": "96",
"url": null
},
{
"business_name": "Bentley Gold Coast",
"citations_count": "89",
"url": "https://www.facebook.com/pages/Bentley-Gold-Coast/135572886504845"
},
{
"business_name": "Gold Coast Tickets",
"citations_count": "47",
"url": null
},
{
"business_name": "Gold Canyon Candles",
"citations_count": "19",
"url": null
}
]
},
{
"domain": "linkedin.com",
"authority": "100/100",
"count": 2,
"businesses": [
{
"business_name": "Iron Galaxy Studios LLC",
"citations_count": "74",
"url": "https://www.linkedin.com/in/michaelpickens"
},
{
"business_name": "Iron Financial Management Inc",
"citations_count": "118",
"url": "https://www.linkedin.com/pub/miles-muslin/18/287/950"
},
{
"business_name": "Chicago Tube and Iron Company",
"citations_count": "106",
"url": null
},
{
"business_name": "Acorn Wire & Iron Works LLC",
"citations_count": "56",
"url": null
},
{
"business_name": "Iron & Wire Custom Metal Studio LLC",
"citations_count": "25",
"url": null
},
{
"business_name": "Adams Street Iron Inc",
"citations_count": "66",
"url": null
},
{
"business_name": "Iron Workers Union",
"citations_count": "39",
"url": null
},
{
"business_name": "Shaw Environmental/Infrstrctr",
"citations_count": "52",
"url": null
},
{
"business_name": "Gold Eagle",
"citations_count": "62",
"url": null
},
{
"business_name": "Rickey Gold Associates",
"citations_count": "96",
"url": null
},
{
"business_name": "Bentley Gold Coast",
"citations_count": "89",
"url": null
},
{
"business_name": "Gold Coast Tickets",
"citations_count": "47",
"url": null
},
{
"business_name": "Gold Canyon Candles",
"citations_count": "19",
"url": null
}
]
}
],
"nap_comparison": [
{
"taken_from": "User supplied",
"business_name": "Example & Co",
"address": "email@example.com Chicago, IL IL",
"postcode": "85300",
"telephone": "4234324234"
},
{
"taken_from": "Google Listing",
"business_name": null,
"address": "",
"postcode": null,
"telephone": null
}
],
"top_categories": {
"Gift Basket Store": 1,
"Hotel": 1,
"Event Ticket Seller": 1,
"Car Dealer": 1,
"Marketing Consultant": 1
},
"other_ranking_factors": []
}
},
"urls": {
"report_url": "https://tools.brightlocal.com/seo-tools/admin/gpw/reports/view/275",
"wl_url": "http://local-marketing-reports.com/google-plus-reports/<hidden>/275"
}
}
}
Validation Failure (400 Bad Request)
{
"success": false,
"errors": {
"INVALID_LOCATION_ID": "Invalid location ID supplied"
}
}
Return report URLs and raw data.
HTTP Request
GET https://tools.brightlocal.com/seo-tools/api/v4/gpw/<reportId>/results
Query Parameters
Parameter | Notes |
---|---|
api-key | Required |
Appendix
Supported Local Directories
Business Category IDs
We no longer list the supported business categories here. We now have an endpoint which enables you to retrieve a list of categories by country.
Supported Countries
The following countries and codes are supported by our system:
Country | Code |
---|---|
Australia | AUS |
Canada | CAN |
Germany | DEU |
Hong Kong | HKG |
Ireland | IRL |
Macau | MAC |
Netherlands | NLD |
New Zealand | NZL |
Philippines | PHL |
Taiwan | TWN |
United Kingdom | GBR |
United States | USA |
Singapore | SGP |
South Africa | ZAF |