> For the complete documentation index, see [llms.txt](https://developerdocs.instructure.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-reference/dap-cli-reference-env-vars.md).

# dap env vars

Configure Environment Variables for DAP CLI Authentication

To simplify configuration and improve security, the DAP CLI reads authentication and connection settings from environment variables. Using them is recommended for automation and scripting on macOS, Linux, and Windows, and it keeps credentials out of your shell history and process list.

## Available Environment Variables

```sh
export DAP_API_URL='https://<region>.api-gateway.instructure.com'
export DAP_CLIENT_ID='your_canvas_data_client_id'
export DAP_CLIENT_SECRET='your_canvas_data_secret'
export DAP_CONNECTION_STRING='your_database_connection_string'
export DAP_TRACKING='your_tracking_preference'
export DAP_CONSOLE_THEME='dark'
```

### Variable Descriptions

* **`DAP_API_URL`** The base URL of your [regional API Gateway](https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-security.md#regional-api-base-url). There is no default — every command that calls the DAP API needs it. [Instructure Identity](https://identity.instructure.com) shows the correct regional URL for your key when you generate it. The region should match the Canvas instance's region.
* **`DAP_CLIENT_ID`** Your client ID from [Instructure Identity](https://identity.instructure.com).
* **`DAP_CLIENT_SECRET`** Your client secret from [Instructure Identity](https://identity.instructure.com).
* **`DAP_CONNECTION_STRING`** *(optional)* The connection string to your target database. Supported formats:

  ```
  postgresql://user:password@host:5432/database
  mysql://user:password@host:3306/database
  mssql://user:password@host:1433/database
  ```
* **`DAP_TRACKING`**\
  Controls whether CLI usage tracking is enabled. Tracking is enabled by default. To opt out, use one of the values listed below.

  Valid values for enabling/disabling tracking:

  | Enabled Values           | Disabled Values           |
  | ------------------------ | ------------------------- |
  | `true`, `1`, `yes`, `on` | `false`, `0`, `no`, `off` |
* **`DAP_CONSOLE_THEME`** *(optional)* Color theme for interactive console output. Valid values are `dark` (the default, suited to the usual dark terminal background) and `light`.

## Precedence

A command-line flag always wins over the matching environment variable:

| Environment variable    | Equivalent flag       |
| ----------------------- | --------------------- |
| `DAP_API_URL`           | `--base-url`          |
| `DAP_CLIENT_ID`         | `--client-id`         |
| `DAP_CLIENT_SECRET`     | `--client-secret`     |
| `DAP_CONNECTION_STRING` | `--connection-string` |
| `DAP_TRACKING`          | `--no-tracking`       |
| `DAP_CONSOLE_THEME`     | `--console-theme`     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-reference/dap-cli-reference-env-vars.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
