How to create an API token

Instructions on how to create an API token

How to create an API Token

Creating an API Client

The first step to interacting with the PredictHQ API is to create an API Client. You can do this from the API Clients section in Control Center.

Under API Clients, select "New Client" or the "+" button. Give the API Client a title, and a description, select which scopes the token will have access to, and save. If unsure leave the default scopes enabled. Your API Client will be created, and credentials will be generated for it.

alt

Remember: You MUST save the secret somewhere, as you won't be able to see it again.

After creating the client it shows in your list of clients.

alt

Creating an API Token

Now that you have an API Client, you can generate a token for it. When viewing the Client, select "Create an access token" or click the plus button next to "Access tokens" as shown below.

alt
Shows the option to create a token highlighted

Now, give the token a description and select which scopes the token will have access to. If unsure leave all scopes enabled. To use the events API, your token will need to have the "Events" scope, but the others are optional.

alt
Showing the access token

After entering the client secret you saved earlier, select "Create new token" and save the generated token somewhere - as, with the client secret, you won't be able to see it again within Control Center.

Remember: You MUST save the token somewhere such as in a password manager, as you won't be able to see it again.

alt

Now that you have an API token, you can call the API. See PredictHQ Technical documentation for more details.

In the guides where you "see Authorization: Bearer $ACCESS_TOKEN" replace $ACCESS_TOKEN with your token. For example, see our API quick start guide.

You can also use the API Explorer feature of Control Center to explore the capabilities of the API.