Canvas Guides (English)Canvas GuidesCanvas Admin GuideCanvas Data 2How do I use the Canvas Data 2 Command Line Interface (CLI) Tool?

How do I use the Canvas Data 2 Command Line Interface (CLI) Tool?

A small Command Line Interface (CLI) tool for syncing data from the Canvas Data API.

All of this needs to be done through your terminal (OSX/Linux), command prompt (Windows) or through the Bash terminal in the Windows Linux Sub system.

Download the Canvas Data 2 Command Line Interface (CLI) Tool

You can download the Python package from Python Package Manager and run: pip3 install instructure-dap-client. You can find the available commands in the Project description of the package manager.

To run Canvas Data 2, users must have Python 3.8, 3.9, 3.10 and the PIP package manager installed.

Update the Canvas Data 2 Command Line Interface (CLI) Tool

To update your Canvas Data 2 CLI to the latest available version, run the following command: pip3 install instructure-dap-client --upgrade --upgrade-strategy=eager

Store Client Credentials in Environment Variables

You can store the client credentials (Client ID and Client Secret), and the API base URL as permanent environmental variables (more secure) on your machine, thus the CLI tool will automatically invoke those when using it.

To do so, open any command-line interface (terminal), navigate to your root folder and configure the environment variables:


  1. You need to edit the file containing the environment variables, which might be different depending on the shell type you are using.
  2. For example, in case you use bash shell, in a terminal tab type open ~/.bash_profile. This will open the .bash_profile with your default text editor.
  3. Add the environment variables to the file opened. In a new row, type:: export DAP_API_URL=
  4. In a new row, type: export DAP_CLIENT_ID='your_canvas_data_key'
  5. In a new row, type: export DAP_CLIENT_SECRET='your_canvas_data_secret'
  6. Some computers may require single or double quotes around the key and secret
  7. Save the file
  8. Restart your terminal
  9. Type printenv and press enter to check all your environment variables.



  1. Guide to setting environment variables
  3. Key will be the associated Canvas Data 2 Key and Secret values to those paths.

Other Resources