Skip to main content
Statista does not allow for crawling systematically across our data. If you attempt to do so; we will disable your API key.
In the case where you want to show Statista content to your users based on a search query in a federated search system or intranet; this guide is for you. This guide will use the Discovery Advanced API and requires an API Key. Using Python, you’ll learn how to:
  1. Configure variables needed for HTTP client
  2. Execute an API query
  3. Render information returned back by the Statista API

1. Configure variables needed for HTTP client

You’ll connect to the API using a request header: x-api-key. In order to fetch content, you’ll need to decide which endpoint you want to request from; /statistics, /marketInsights, /studies or /infographics. See API Reference. For this example we’ll fetch content from /statistics with two parameters.
This is the basic setup you’ll need to get this example running on your machine - we don’t recommend using this code in production.

2. Execute an API query

Next, we can execute a request and get a response from the API.

3. Render information returned back by the Statista API

While you can do this in a multitude of ways; we’ll show an example for putting the received data into a pandas data frame - and show you what that looks like:
Which yields a structured table: (See API Reference for more info on what data is available)