Authenticating with Hashboard

Hashquery requires connecting to Hashboard to find and query your data connections, as well as import and export your content.

You will need access to a Hashboard project where:

  • you have OWNER or EDITOR permissions

  • it has at least one data connection

Tip

Hashquery will automatically use the same credentials as the Hashboard CLI. If you are already set up with the CLI and want to use that same project for the Hashquery, you can move on to the next step.

Creating an access key

Instead of logging in with your username/password or SSO credentials, Hashquery uses an access key to authenticate you with Hashboard.

This is a secret value that authorizes you within a single project. Like a password, access keys should never be shared, and Hashboard employees will never ask for your access key.

If you have the CLI installed (pip install hashboard-cli) then you can run:

hb token

This will take you through a web-based authentication flow and download a new access key for you. The access key will be stored at the default filepath: ~/.hashboard/hb_access_key.json.

Navigate to the project you want to create an API token for, and go to Settings. Under Access Keys, create a new access key, naming it something descriptive (like “Hashquery”) then choose API Token. Save this value somewhere secure.

Before running a Hashquery program, specify this token as an environment variable:

export HASHBOARD_API_TOKEN=yourapitoken

Verifying

Verify everything is hooked up correctly by copy-pasting the following into a new Python file, quickstart.py:

from hashquery import *
print(project)

Run the file. If all went smoothly, you should see an index of your project’s contents.

$ python quickstart.py
Project: c-AlwxJ0wk123ab on https://hashboard.com
Models:
Metrics:
Connections: uploads