> For the complete documentation index, see [llms.txt](https://docs.panther.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.panther.com/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/ci-cd/deployment-workflows/pat/install-configure-and-authenticate-with-pat.md).

# Install, Configure, and Authenticate with the Panther Analysis Tool

Get up and running with PAT

## Overview

Before using the Panther Analysis Tool (PAT) to manage your Panther assets (on your command line or in a CI/CD pipeline, for example), you'll need to [install it](#installing-pat), [provide configuration values](#configuring-pat), and [generate an API token to authenticate](#authenticating-with-an-api-token). Once you've completed these steps, start running [PAT Commands](/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/ci-cd/deployment-workflows/pat/pat-commands.md).

When new versions of PAT are released, you can [update PAT](#updating-pat).

## Installing PAT

### Prerequisites

To install PAT, your environment must have the following already installed:

* Python 3.9
  * To install Python 3.9 using [Homebrew](https://brew.sh/), run `brew install python3.9`.
* [Pipenv](https://pipenv.pypa.io/en/latest/)
  * To install Pipenv, run `pip install --user pipenv`.&#x20;

### Installing with pip

To install PAT, run this command:

```bash
pip3 install panther_analysis_tool
```

### Building from source

If you'd prefer instead to run from source for development reasons, first set up your environment:

```
$ make install
$ pipenv run -- pip3 install -e .
```

### Using PAT outside of the virtual environment

If you would rather use PAT outside of the virtual environment, install it directly:

```
$ make deps
$ pip3 install -e .
```

### PAT CLI aliases

PAT will be installed under the following aliases—either can be used with PAT commands:

* `panther_analysis_tool`
* `pat`

Examples

```
$ pipenv run panther_analysis_tool test
...
$ pipenv run pat upload
...
```

## Updating PAT

If you are using `pipenv` to manage dependencies, follow the below steps to update PAT:

1. Update PAT to the latest version in your `Pipfile`.
2. Run `pipenv install --dev`.

Alternatively, you can update PAT by running the following command:

```
$ pip3 install panther_analysis_tool --upgrade
```

## Configuring PAT

PAT can read configuration values from the command line, environment variables, or a configuration file.

### Configuration value precedence

The precedence for flag value sources is as follows (highest to lowest):

1. Values passed with the command
2. [Environment variables](#environment-variables)
3. [Configuration file](#pat-configuration-file)

### Environment variables

All options can be passed in through environment variables by prepending the variable name with `PANTHER_.`

For example, the `AWS_TOKEN` argument can be passed in through an environment variable named `PANTHER_AWS_TOKEN`.

### PAT configuration file

PAT will read options from a configuration file called `.panther_settings.yml` located in your working directory. An example configuration file is included in this repo: [example\_panther\_config.yml](https://github.com/panther-labs/panther_analysis_tool/blob/master/example_panther_config.yml). It contains example syntax for supported options.

## Authenticating with an API token

PAT requires an API token to authenticate against your Panther instance. Follow [these instructions](/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/api.md#step-2-create-an-api-token) to generate an API token, taking note of the [required permissions per PAT command](/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/ci-cd/deployment-workflows/pat/pat-commands.md#permissions-required-per-command).

When running PAT commands that require an API token, such as `upload` and `delete`, you will pass it with the `--api-token` option, in addition to the `--api-host` option with the [GraphQL host](/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/api.md#prerequisites).

Using an API token to authenticate with PAT means your PAT actions will be captured as [Panther Audit Logs](/~/changes/Dd8nx2iqd1Pp2OzWJaWk/system-configuration/panther-audit-logs.md).

### Rotating the API token

The token does not expire. As a security best practice, we recommend regularly rotating your API token. For instructions, see [Rotating API tokens](/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/api.md#rotating-api-tokens).

### Managing your API token as a secret

If you are using PAT in CI/CD jobs, be sure to follow your CI/CD provider's instructions on how to manage your API token as a secret—as described on [Managing Panther Content via GitHub Actions](/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/ci-cd/deployment-workflows/github-actions.md#prerequisites) and [Managing Panther Content via CircleCI](/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/ci-cd/deployment-workflows/circle-ci.md#automate-upload-in-circleci-workflow).&#x20;


---

# 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://docs.panther.com/~/changes/Dd8nx2iqd1Pp2OzWJaWk/panther-developer-workflows/ci-cd/deployment-workflows/pat/install-configure-and-authenticate-with-pat.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.
