Skip to main content

A client to assist in connecting with the Conductor Searchlight API

Project description


Latest Version

The Searchlight API Client is a Python package that makes it easy to authenticate with and retrieve data from the Conductor Searchlight API.

Getting Started


The latest released version can be installed through the Python package index.

pip install searchlight-api



The Searchlight API Client needs to know your API Key and API Secret to authenticate with Searchlight. It can find these in one of two ways:

  • Add the credentials to your environmental variables (preferred)
  • Pass the credentials when instantiating the API Client from searchlight_api.client import AccountService account_service = AccountService(api_key=xxxxx, secret=xxxxx)

If you don't have an API Key and Secret, request one from You should receive an email within a week containing your credentials.

Using searchlight_api

The Searchlight API Package has two main functionalities: client and analysis

  • client provides an SDK around the Searchlight REST API, making it easy to request the data that you need from your accounts.
  • analysis includes functions for aggregating data (Rank and Search Volume) using the Searchlight API.



The SearchlightService client provides wrappers for getting Searchlight and profile configuration data

from searchlight_api import client

# instantiate Searchlight client
ss = client.SearchlightService()
# Retrieve all Searchlight accounts you have access to.
# You can use this to retrieve Account IDs to instantiate the AccountService client

my_accounts = ss.get_accounts()
[{'accountId': 'XXXX',
  'isActive': False,
  'name': 'Account 1',
  'webProperties': ''},
 {'accountId': 'YYYY',
  'isActive': True,
  'name': 'Account 2',
  'webProperties': ''}]

# Account IDs can also be found in Searchlight URLs:

In Searchlight, keywords can be tracked across different Rank Sources (or Search Engines), Locations and Devices. You can retrieve what's supported with the following:

rank_sources = ss.get_rank_sources()
locations = ss.get_locations()
devices = ss.get_devices()

The AccountService client provides functionality for retrieving reporting data from Searchlight accounts, while retaining all the functionality found in the SearchlightService client. A Searchlight account id is required upon instantiation.

from searchlight_api import client
# instantiate the AccountService client
account_service = client.AccountService(YYYY)
# retrieve all web properties tracked in the account
web_properties = account_service.get_web_properties()

web_property_id = web_properties[0]['webPropertyId']

# the web_property_id can be used to get the name of the corresponding domain
domain_name = account_service.get_domain_name(web_property_id)

# use the web_property_id to get all tracked searches in the account
tracked_searches = account_service.get_tracked_searches(web_property_id)

# get a rank_source_id that the web_property is tracked against
rank_source_id = web_properties[0]['rankSourceInfo'][0]['rankSourceId']

# retrieve rank data for searches tracked against a web property and rank source for a given date within a reporting interval.
# by default the current date is used.
ranks = account_service.get_ranks(web_property_id, rank_source_id, date='2019-01-12')

# retrieve search volume data for searches tracked against a web property and rank source for a given date within a reporting interval.
# by default the current date is used.
search_volume = account_service.get_volume(web_property_id, rank_source_id, date='2019-01-12')

Analysis allows you to use the AccountService client to aggregate reporting data across an entire account for a given date.

from searchlight_api.client import AccountService
from searchlight_api import analysis

account_service = AccountService(YYYY)

rank_data = analysis.rank_data(account_service, date='2019-01-12')
search_volume = analysis.search_volume(account_service)

To request additional aggregation methods, reach out to or

Using Pandas with Searchlight API Client
from searchlight_api import client, analysis
import pandas as pd

# instantiate AccountService object
account_service = client.AccountService(YYYY)

# get rank sources, locations and devices and turn to dfs
rank_source_df = pd.DataFrame(account_service.get_rank_sources())
location_df = pd.DataFrame(account_service.get_locations())
device_df = pd.DataFrame(account_service.get_devices())

# get the tracked searches and turn into a df
tracked_search_df = pd.DataFrame(analysis.all_tracked_searches(account_service))

# turn search_volume and rank_data to Data Frames
search_volume_df = pd.DataFrame(analysis.search_volume(account_service))
rank_data_df = pd.DataFrame(analysis.rank_data(account_service))

report = pd.merge(rank_data_df, search_volume_df, on=['trackedSearchId', 'rankSourceId', 'webPropertyId'])
report = report.merge(rank_source_df, on='rankSourceId', how='left')
       itemType rankSourceId  standardRank target           targetDomainName  \
0    ANSWER_BOX            1           3.0              
1  IMAGE_RESULT            1           NaN              
2  LOCAL_RESULT            1           NaN
3  LOCAL_RESULT            1           NaN
4  LOCAL_RESULT            1           NaN
                                           targetUrl  targetWebPropetyId  \
0             43162.0
1             43162.0
2                 NaN
3                 NaN
4                 NaN
   trackedSearchId  trueRank webPropertyId  averageVolume  \
0          7188291         6         43162         135000
1          7188291        62         43162         135000
2          7188291         4         43162         135000
3          7188291         2         43162         135000
4          7188291         3         43162         135000
                                         volumeItems  baseDomain  \
0  [{'volume': 165000, 'month': 11, 'year': 2018}...
1  [{'volume': 165000, 'month': 11, 'year': 2018}...
2  [{'volume': 165000, 'month': 11, 'year': 2018}...
3  [{'volume': 165000, 'month': 11, 'year': 2018}...
4  [{'volume': 165000, 'month': 11, 'year': 2018}...
             description          name deviceId  isActive locationId  \
0  Google (US / English)  GOOGLE_EN_US        1      True          1
1  Google (US / English)  GOOGLE_EN_US        1      True          1
2  Google (US / English)  GOOGLE_EN_US        1      True          1
3  Google (US / English)  GOOGLE_EN_US        1      True          1
4  Google (US / English)  GOOGLE_EN_US        1      True          1
             preferredUrl queryPhrase
0     example phrase
1     example phrase
2     example phrase
3     example phrase
4     example phrase

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for searchlight-api, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size searchlight_api-1.0.0.tar.gz (11.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page