Keywords Everywhere API with Python

“Is there a keyword research API I can use to integrate with our tools?”
“How can I use Python in SEO?”

Developer or SEO Specialist

Integrate Keywords Everywhere API to your tools and improve your keyword research process. You spend hours searching for the right keywords. A keyword research API helps you solve this problem since it provides data. And this helps SEO analysts and content writers create content faster.

What is Keywords Everywhere?

Keywords Everywhere is a paid browser add-on for keyword research. It’s installed on Chrome or Firefox and it lists monthly search volume, cost per click, competition, and trend data on your browser in real-time. This keyword tool supports data from Google Search, Google Trends, Amazon, and YouTube.

keywords everywhere2

A major benefit is it lessens the countless exporting and importing of spreadsheets. The data are listed on the browser in real-time without switching between SEO tools. No more jumping from software to software to get a holistic view of the data.

How Do I Use Keywords Everywhere?

Turn on the extension on your browser after installing them from Chrome or Firefox.

Get keyword data from your chosen platform. If you search a keyword on Google Search, the keyword tool adds the keyword data on the results page in real-time. This includes keyword data on people also search for, related searches, and trend data.

keywords everywhere api

Data also populates when you search in Amazon or YouTube. It lets the keyword research process faster and easier to manage.

Where Do I See The Keywords Everywhere API Key?

Upon purchase of Keywords Everywhere, they issue you an API key through email. But if you’re a user already, you find it in the settings from the browser add-on on the upper right. Keywords Everywhere also has an API documentation page for you to start learning the paid tool.

ke api 2
ke api 3

Get Keyword Data with Python

The API documentation contains different methods on how to call data from Keywords Everywhere. These are Bash, PHP, Java, NodeJS, and others. For the example below, we’ll use Python.

Search Volume and CPC
The documentation provides a Python example that gives all the data. But this article focuses on getting the specific keyword metrics–Search Volume and CPC (cost per click). Click run on your Python interpreter and you receive a spreadsheet containing the data.

Entire Python Code:

import requests
import csv

keywords = []

with open("<YOUR .TXT FILE>", "r") as file:
    for element in file:
        keywords.append(element.strip())

my_data = {
    'country': 'us',
    'currency': 'usd',
    'dataSource': 'gkp',
    'kw[]': keywords
}
my_headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer <YOUR API KEY>'
}
response = requests.post(
    'https://api.keywordseverywhere.com/v1/get_keyword_data', data=my_data, headers=my_headers)

keywords_data = response.json()['data']

vol = []
cpc = []
for element in keywords_data:
    vol.append(element["vol"])
    cpc.append(element["cpc"]["value"])

rows = zip(keywords, vol, cpc)

with open("<YOUR .CSV FILE>", "w", newline="") as file:
    columns = ["Keywords", "Search Volume", "CPC"]
    writer = csv.writer(file)
    writer.writerow(columns)
    for row in rows:
        writer.writerow(row)

Here’s the breakdown of each section…

Import The Libraries

import requests
import csv

Import the libraries to your code. In this case, import requests and csv libraries. The requests library lets us request the information across the Internet. And the csv library lets us export the data into a spreadsheet.

Run pip install request and pip install python-csv to install the libraries in your terminal and to your device.

List Your Keywords

keywords = []
with open("<YOUR .TXT FILE>", "r") as file:
    for element in file:
        keywords.append(element.strip())

Next is importing a text file the contains the list of keywords. The list of keywords is imported to your code as a reusable Python list. Note that the code example above is for a .txt file. Don’t forget to change <YOUR .TXT FILE> to yours and its location folder.

You may use a CSV file but don’t forget to import the csv library and adjust the code a little bit.

Collect The Data

my_data = {
    'country': 'us',
    'currency': 'usd',
    'dataSource': 'gkp',
    'kw[]': keywords
}
my_headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer <YOUR API KEY>'
}
response = requests.post(
    'https://api.keywordseverywhere.com/v1/get_keyword_data', data=my_data, headers=my_headers)

keywords_data = response.json()['data']

This is from the Keywords Everywhere API documentation. The end of the code block houses the entire data for the keywords. Then the code changes the data to JSON format so that it can be used and manipulated in Python.

At this point in the code, you may change the country and the currency. You may change the country to uk if you want data from Google UK. You may also change the currency to gbp if you want data in the British pound.

Another very important thing to note you change <YOUR API KEY> to your API key. You can find your API key in the settings from the web browser extension.

Select The Data

vol = []
cpc = []
for element in keywords_data:
    vol.append(element["vol"])
    cpc.append(element["cpc"]["value"])

rows = zip(keywords, vol, cpc)

We want Search Volume and CPC data only. This code block is taking the keyword data from the API and turning them into lists. The end part is the zip function where the returned data is an iterator of tuples. The lists that contained “Search Volume” and “CPC” are now mutated to a tuple to turn them into a spreadsheet.

Export To A Spreadsheet

with open("<YOUR .CSV FILE>", "w", newline="") as file:
    columns = ["Keywords", "Search Volume", "CPC"]
    writer = csv.writer(file)
    writer.writerow(columns)
    for row in rows:
        writer.writerow(row)

This is the final piece of the puzzle, which is exporting the data to a CSV file. Create a CSV file in the same directory that houses the code and the keywords file. Don’t forget to change <YOUR .CSV FILE> to your CSV file and its location folder.

The end goal is three columns, which are “Keywords”, “Search Volume”, “CPC”. And have the listed data as rows. In the end, the data looks like this in the spreadsheet:

ke api 4

How Do I Purchase Keywords Everywhere Credits?

Keywords Everywhere uses credits every time you call an API request. But the credits are based on the number of keywords you want to get data from. This means that if you request data for 17 keywords, you use 17 credits.

Keywords Everywhere uses a unique credit-based payment but they are affordable. You go to their pricing page, choose a price tier, and add your credit card details. They start at 10 US dollars for 100,000 credits. That’s enough to experiment for hobby projects or to serve clients.

The API documentation states that you can only query up to a maximum of 100 keywords at a time. This means if you try to get specific keyword data from 100+ keywords, the API calls only for the first 100 keywords.

Conclusion: Build Tools with Keywords Everywhere

You’re tired of researching keywords. It’s tedious and takes hours to organize your data. Keywords Everywhere API does all the data collection for you. Spend less time researching and more time doing data analysis. It’s tough to track the keywords of a site, Keyword Everywhere API can research all your keywords in one place.


About The Author

Francis Angelo Reyes

Francis is the owner and runs Lupage Digital. With 5 years of experience, Francis writes everything he knows about digital marketing. There’s a large knowledge gap between developers and digital marketers. Francis is the middleman between where the non-technical and technical meet.