Links
Comment on page

Authenticating

All PredictHQ API endpoints require authentication. You can authenticate your request by sending a token in the Authorization header of your request. If you try to use an API endpoint without a token or that token has insufficient permissions, you will receive a 403 Forbidden response.
curl
python
curl -X GET https://api.predicthq.com/v1/events/ \
-H "Authorization: Bearer $ACCESS_TOKEN"
import requests
access_token = "ACCESS_TOKEN"
response = requests.get(
url="https://api.predicthq.com/v1/events/",
headers={
"Authorization": f"Bearer {access_token}"
}
)
print(response.json())

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 Token in the Authorization header of your API requests.