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:
A PredictHQ account:
Existing users: log in with your PredictHQ account
New users: Sign up for free to get started.
An API Access Token: We'll guide you through creating one below.
Create an Access Token
Read a more in-depth guide to creating a new API Token or follow the basic steps below:
Log into the WebApp and visit the API Tokens page under API tools.
The first time you create a token - enter the name of the token and click "Create Token". For the second and subsequent times click the "Create New Token" button and enter the name, then click Create Token.
Click "Copy Token" to copy your token to the clipboard. You can now paste the token into another application. Keep a copy of your new API Token, as it will not be shown again.
Use the new API Access Token in the Authorization header of your API requests as shown in the example below
Access Events API
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())
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.
Streamlit Demo AppsExplore the API
Below is a guide to point you in the right direction if you're new to the PredictHQ APIs:
Last updated
Was this helpful?