Links
Comment on page

API Quickstart

This article describes how to quickly create an access token, view and replicate a Streamlit demo app and explore our APIs.

What you need:

  1. 1.
    A PredictHQ account - sign up for free to get started.
  2. 2.
    An API Access Token.

Create an access token

Read a more in-depth guide to creating a new API Client and Token or follow the basic steps below:
  1. 1.
    Log into Control Center and visit the API Clients page.
  2. 2.
    Select "New Client" and fill in the required information.
  3. 3.
    Make sure to keep a copy of your new Client Secret as this cannot be shown to you again.
  4. 4.
    Use the new Client Secret to create a new Token.
  5. 5.
    Make sure to keep a copy of your new API Token as this cannot be shown to you again.
Now you can use the new API Access Token in the Authorization header of your API requests as in the example below:
import requests
response = requests.get(
url="https://api.predicthq.com/v1/events/",
headers={
"Authorization": "Bearer $ACCESS_TOKEN",
"Accept": "application/json"
},
params={
"q": "taylor swift"
}
)
print(response.json())
How to set up and access PredictHQ APIs

Streamlit Demo Apps

To demonstrate how quick and easy it is to build extremely powerful apps using our APIs, we put together some Streamlit demos. All the code is available on GitHub and we encourage you to take the code, modify it, and use your own locations of interest to demo our APIs internally to your team or to simply better understand our technology.

Explore the API

Below is a guide to point you in the right direction if you're new to the PredictHQ APIs:
Did you know - Control Center uses the same APIs you have access to. One of the easiest ways to learn how to use our APIs is to see it in action in Control Center.