> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/demisto-sdk-development-guide/demisto-sdk-guide/install-demisto-sdk/environment-variables-setup.md).

# Environment variables setup

Some SDK commands require you to interact with the Cortex XSOAR or Cortex XSIAM tenant. Examples include uploading entities and running commands in the CLI. Cortex XSOAR also supports downloading entities from the tenant.

#### Cortex XSOAR 6.x

For Cortex XSOAR 6.x, you need the URL of your Cortex XSOAR instance as well as an API key.

1. Generate and copy the API key from **Settings** → **Integrations** → **API Keys**.
2. Edit the **`~/.zshrc`** and **`~/.bash_profile`** files to add the following parameters:

   ```programlisting
   export DEMISTO_BASE_URL=<BASE_URL>
   export DEMISTO_API_KEY=<API_KEY>
   ```

   For example:

   ```programlisting
   export DEMISTO_BASE_URL=https://test.server.us.paloaltonetworks.com
   export DEMISTO_API_KEY=XXXXXXXXXXXXXXXXXXXXXX
   ```

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><h3>Note</h3><p>Alternatively, you can use an <code>.env</code> file in the root repository with the above variables. If you use an <code>.env</code> file, this overrides the <code>bash_profile</code> file.</p><pre class="language-programlisting"><code class="lang-programlisting">DEMISTO_BASE_URL=&#x3C;base_url>
   DEMISTO_API_KEY=&#x3C;api_key>
   </code></pre></div>

#### Cortex XSOAR 8 and Cortex XSIAM

For Cortex XSOAR 8 and Cortex XSIAM, you need the base URL, the API key, and the API key ID.

1. Retrieve the base URL from the Cortex XSIAM or Cortex XSOAR instance by clicking on the **Copy URL** button located at the top right corner of the page. Do not copy the browser URL.
2. Verify the API key is set to a **Standard** security level and has the **Instance Administrator** or **Account Admin** role.
3. Note the ID for the API key, as this will be used as the **`XSIAM_AUTH_ID`**.
4. Edit the **`~/.zshrc`** and **`~/.bash_profile`** files to add the following parameters:

   ```programlisting
   export DEMISTO_BASE_URL=<BASE_URL>
   export DEMISTO_API_KEY=<API_KEY>
   export XSIAM_AUTH_ID=<THE_XSIAM_AUTH_ID>
   ```

   For example:

   ```programlisting
   export DEMISTO_BASE_URL=https://api-xsiam-server.us.paloaltonetworks.com
   export DEMISTO_API_KEY=XXXXXXXXXXXXXXXXXXXXXX
   export XSIAM_AUTH_ID=1
   ```

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><h3>Note</h3><p>Alternatively, you can use an <strong><code>.env</code></strong> file in the root repository with the above variables. If you use an <code>.env</code> file, this overrides the <code>bash_profile</code> file.</p><pre class="language-programlisting"><code class="lang-programlisting">DEMISTO_BASE_URL=&#x3C;base_url>
   DEMISTO_API_KEY=&#x3C;api_key>
   XSIAM_AUTH_ID=1
   </code></pre></div>

{% hint style="info" %}

### Note

If the `XSIAM_AUTH_ID` environment variable is set, SDK commands are configured to work with an XSIAM or XSOAR 8 instance. To then use the Demisto SDK with a Cortex XSOAR 6.x instance, you must delete the `XSIAM_AUTH_ID` parameter from your environment with the following command: `unset XSIAM_AUTH_ID`.
{% endhint %}

#### Git-related environment variables

If the primary Git branch is not `master,` or the upstream is not named `origin`, add the following environment variables:

```programlisting
export DEMISTO_DEFAULT_BRANCH = <branch name here>
export DEMISTO_DEFAULT_REMOTE = <upstream name here>
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/demisto-sdk-development-guide/demisto-sdk-guide/install-demisto-sdk/environment-variables-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
