API recipes allow developers to run code in a quick and easy way by providing ready-made code samples. Recipes are a simple way to quickly access data for concrete use cases with our API.

You can directly copy and paste our recipes into your favorite code editor (Visual Studio Code or Sublime Text), or into an online code notebook such as Jupyter or Google Colab.

Code samples can be displayed in several programming languages; on AppTweak, they will be mainly in Python or Ruby.

How can I run an API recipe with Python?

To run an AppTweak API recipe with Python, you will need:

  • An AppTweak ASO subscription (Pro or above) with valid API access

  • API credits

  • A Google account

  • 👏 No coding skills required

Below, we'll take you through the steps of running our multi-country volume history recipe which allows you to automatically generate historical keyword volumes for different countries in one single CSV file.


Step 1. Launch Google Colab

Go to Google Colab. If necessary, sign in to your Google account.

Newly created notebook on Google Colab

Newly created notebook on Google Colab

Once that’s done, you'll be directed to a new notebook. A notebook lets you write text & code that you will then be able to execute.

Why Google Colab? Google Colab enables you to write & execute code without having to install any programming languages or code editors on your device. Moreover, it allows you to easily share your work with your colleagues.

Step 2. Rename your notebook

At the top of the page, rename your file to “Volume_history_recipe.ipynb”

Click on your notebook title to modify the name

Step 3. Copy & paste the recipe

Check out this video (or read the text below) to easily implement our recipe.

Open a new tab on your computer and go to the Recipe section of our API documentation.

Open the recipe "Volume History - multi-countries extract." Click the clipboard icon on the right-hand side to copy the entire code sample.

Now return to your Google Colab notebook and paste the code sample. But don't click on the play button yet, as this will run the code and we still have a few more steps left here!

Step 4. Follow the instructions from the recipe

Go back to the recipe documentation and follow the different steps we've prepared for you:

4.1) Insert your personal API token

  • In a new tab, go to your API dashboard through your AppTweak account.

  • Copy your API token by clicking on “Copy to clipboard."

  • Go back to the tab with your Google Colab notebook and replace APPTWEAK-API-KEY with your personal token. Keep the brackets ('') at the beginning and end of your API token.

4.2) Specify the parameters you want to focus your insights on

Make the following changes directly in your Google Colab notebook.

  • Change the keywords in the line starting KEYWORD_LIST with the keywords for which you'd like the historical search volumes. Don't forget to keep the brackets (") around each keyword, and to keep them separated by commas (,).

  • Change the country codes in the line starting COUNTRY_LIST with the ones you're interested in. AppTweak's API uses ISO Alpha-2 country code formats. The list of available countries and their codes can be found here.

  • Specify the START_DATE & END_DATE of the date range you'd like to target in YYYY-MM-DD format.

4.3) Rename the CSV file

  • You can keep the default filename for your output file, which will be volume_history.csv

Step 5. Run the code

Click on the “play” button to run the code.

Click on the play button encircled in green to run the code.

In the sidebar on the left, you'll find a folder icon. Click it to expand the Files menu.

Left pane containing the Files folder

Here, you’ll find the output CSV with the name “volume_history.csv”.

Files folder containing your newly created output file: volume_history.csv

You can download the file by clicking on the three dots next to the filename.

Congratulations, you just ran your first recipe 🎉🎉🎉


⚠️ Bear in mind that using one of our recipes will make API calls and use API credits; you'll want to make sure you don’t use these up unnecessarily. To estimate the number of credits you’ll need for a specific use case, you can refer to the pricing table in our documentation.

Pricing for the different data points available through AppTweak's API

Did this answer your question?