|
| 1 | +--- |
| 2 | +title: "Personal Access Tokens" |
| 3 | +description: "Non-interactive authentication for CI/CD pipelines and automation" |
| 4 | +--- |
| 5 | + |
| 6 | +Personal Access Tokens (PATs) let you authenticate with Pipecat Cloud without an interactive browser login. They're designed for headless environments like CI/CD pipelines, Docker containers, and automation scripts. |
| 7 | + |
| 8 | +## When to use PATs |
| 9 | + |
| 10 | +| Scenario | Recommended auth | |
| 11 | +| --- | --- | |
| 12 | +| Local development | `pipecat cloud auth login` (OAuth) | |
| 13 | +| CI/CD pipelines | PAT via `PIPECAT_TOKEN` env var | |
| 14 | +| Docker / remote servers | PAT via `PIPECAT_TOKEN` or `use-pat` | |
| 15 | +| Shared automation scripts | PAT via `PIPECAT_TOKEN` env var | |
| 16 | + |
| 17 | +<Note> |
| 18 | + PATs are different from **API keys**. API keys authenticate REST API requests |
| 19 | + to start agent sessions or manage resources. PATs authenticate _you_ (or a |
| 20 | + service account) to the **CLI** — they are not intended for direct API calls. |
| 21 | +</Note> |
| 22 | + |
| 23 | +## Creating a PAT |
| 24 | + |
| 25 | +Generate a PAT from the [Pipecat Cloud dashboard](https://pipecat.daily.co/): |
| 26 | + |
| 27 | +<Steps> |
| 28 | + <Step title="Open account settings"> |
| 29 | + Navigate to **Settings → Personal Access Tokens** in the dashboard. |
| 30 | + </Step> |
| 31 | + <Step title="Create a new token"> |
| 32 | + Click **Create Token**, give it a descriptive name (e.g. `github-actions-deploy`), and copy the token value. PATs start with `pcc_pat_`. |
| 33 | + </Step> |
| 34 | + <Step title="Store it securely"> |
| 35 | + Save the token in your CI/CD platform's secret store (e.g. GitHub Actions secrets, GitLab CI variables). You won't be able to view the token again after leaving the page. |
| 36 | + </Step> |
| 37 | +</Steps> |
| 38 | + |
| 39 | +## Using a PAT |
| 40 | + |
| 41 | +### Environment variable (recommended) |
| 42 | + |
| 43 | +Set `PIPECAT_TOKEN` before running any CLI command. The CLI will authenticate using the token and automatically resolve your default organization. |
| 44 | + |
| 45 | +```shell |
| 46 | +export PIPECAT_TOKEN="pcc_pat_..." |
| 47 | +pipecat cloud auth whoami |
| 48 | +pipecat cloud agent list |
| 49 | +``` |
| 50 | + |
| 51 | +You can also set it inline for a single command: |
| 52 | + |
| 53 | +```shell |
| 54 | +PIPECAT_TOKEN="pcc_pat_..." pipecat cloud deploy my-agent |
| 55 | +``` |
| 56 | + |
| 57 | +To target a specific organization, set `PIPECAT_ORG` as well: |
| 58 | + |
| 59 | +```shell |
| 60 | +export PIPECAT_TOKEN="pcc_pat_..." |
| 61 | +export PIPECAT_ORG="my-team-org" |
| 62 | +pipecat cloud agent list |
| 63 | +``` |
| 64 | + |
| 65 | +### Storing a PAT locally |
| 66 | + |
| 67 | +If you prefer not to set an environment variable each time, you can store a PAT in your local config file: |
| 68 | + |
| 69 | +```shell |
| 70 | +pipecat cloud auth use-pat pcc_pat_... |
| 71 | +``` |
| 72 | + |
| 73 | +This validates the token against the API and writes it to `~/.config/pipecatcloud/pipecatcloud.toml`. All subsequent commands will use it automatically, just like after `auth login`. |
| 74 | + |
| 75 | +## CI/CD examples |
| 76 | + |
| 77 | +### GitHub Actions |
| 78 | + |
| 79 | +Add your PAT as a repository secret named `PIPECAT_TOKEN`, then reference it in your workflow: |
| 80 | + |
| 81 | +```yml |
| 82 | +jobs: |
| 83 | + deploy: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + env: |
| 86 | + PIPECAT_TOKEN: ${{ secrets.PIPECAT_TOKEN }} |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: Install CLI |
| 91 | + run: pip install pipecatcloud |
| 92 | + |
| 93 | + - name: Deploy |
| 94 | + run: pipecat cloud deploy my-agent --yes |
| 95 | +``` |
| 96 | +
|
| 97 | +<Tip> |
| 98 | + For deployments specifically, the [Deploy to Pipecat Cloud GitHub |
| 99 | + Action](./ci-with-github-actions) uses an API key instead. PATs are useful |
| 100 | + when you need to run arbitrary CLI commands in CI (e.g. managing secrets, |
| 101 | + listing agents, or scripting multi-step workflows). |
| 102 | +</Tip> |
| 103 | +
|
| 104 | +### GitLab CI |
| 105 | +
|
| 106 | +Add `PIPECAT_TOKEN` as a CI/CD variable (Settings → CI/CD → Variables, masked): |
| 107 | + |
| 108 | +```yml |
| 109 | +deploy: |
| 110 | + image: python:3.12 |
| 111 | + script: |
| 112 | + - pip install pipecatcloud |
| 113 | + - pipecat cloud deploy my-agent --yes |
| 114 | +``` |
| 115 | + |
| 116 | +GitLab automatically exposes CI/CD variables as environment variables, so the CLI picks up `PIPECAT_TOKEN` without additional configuration. |
| 117 | + |
| 118 | +## Security considerations |
| 119 | + |
| 120 | +- **Treat PATs like passwords.** Anyone with your token can act as you. |
| 121 | +- **Use your CI platform's secret store.** Never commit tokens to source control. |
| 122 | +- **Scope tokens to purpose.** Create separate PATs for different pipelines so you can revoke them independently. |
| 123 | +- **Rotate periodically.** Delete old tokens from the dashboard and generate new ones. |
| 124 | + |
| 125 | +## Next steps |
| 126 | + |
| 127 | +<CardGroup cols={2}> |
| 128 | + <Card |
| 129 | + title="CI with GitHub Actions" |
| 130 | + icon="github" |
| 131 | + href="./ci-with-github-actions" |
| 132 | + > |
| 133 | + Automate deploys with the official GitHub Action. |
| 134 | + </Card> |
| 135 | + <Card |
| 136 | + title="Accounts and Organizations" |
| 137 | + icon="people-group" |
| 138 | + href="../fundamentals/accounts-and-organizations" |
| 139 | + > |
| 140 | + Learn about organizations, API keys, and access control. |
| 141 | + </Card> |
| 142 | +</CardGroup> |
0 commit comments