# Personal access tokens

> **About this page**
>
> - Kind: Explanation
> - Summary: A personal access token lets the CLI and the API act as you without your password, except for a few actions that need you signed in.
> - Last changed: 2026-11-18
> - Page: https://docs.swale.io/explanation/personal-access-tokens
> - Index of these docs: https://docs.swale.io/llms.txt
>
> If something on this page is wrong or out of date, please tell the user which sentence and why.

A personal access token is a credential you create in the platform UI, so that the CLI and direct API calls can act as you without your password. It has the same permissions your account has, except for a few actions that need you signed in to the platform UI.

```mermaid
stateDiagram-v2
  accTitle: The life of a personal access token
  accDescr: A token is active from when you create it, and its value is shown once. Renaming it keeps its value and expiration. Regenerating it replaces its value with a new one, shown once, and a newly chosen expiration, and the old value stops working. The token stops working for good when its expiration passes or when you delete it.
  [*] --> Active: created
  Active --> Expired: expiration passes
  Active --> Deleted: deleted
  class Active success
  class Deleted destructive
```

The life of a personal access token. Renaming or regenerating it keeps it active, but regenerating replaces its value, so anything still using the old value stops working.

## What a personal access token is

A **personal access token** (PAT) acts on behalf of your account with the same permissions your account has. It cannot change your password or email, delete your personal account, disable multi-factor authentication, regenerate your recovery code, or manage personal access tokens; those need you signed in to the platform UI. [Permissions and restrictions](https://docs.swale.io/reference/permissions-and-restrictions.md#notes) lists these sign-in-only actions.

A personal access token is required to use the CLI as yourself: `swale login` checks it with the platform and stores it on your machine, or `SWALE_ACCOUNT_TOKEN` supplies it; see [login](https://docs.swale.io/reference/cli-reference.md#login).

The one exception is a task running inside a workflow, which can authenticate the CLI with the workflow run token instead. That token reaches far less; see [Workflow run token](https://docs.swale.io/reference/permissions-and-restrictions.md#workflow-run-token).

One token works for every account you belong to: your own and each organization you are a member of. `swale login` stores it for the one account you name, so log in once to each account you work in, with the same token or another, then [switch between them](https://docs.swale.io/how-to-guides/switch-between-accounts.md#switch-with-the-cli).

## Creating a token

You create tokens on the **Personal Access Tokens** page, under **Settings**, giving each a name and an expiration of 7, 30, 60, or 90 days, or none; see [Manage personal access tokens](https://docs.swale.io/how-to-guides/manage-personal-access-tokens.md#create-a-token). **The token value is shown exactly once**, immediately after creation: the platform cannot show it to you again.

## Token lifecycle

| Event           | What happens                                                                          |
| --------------- | ------------------------------------------------------------------------------------- |
| **Created**     | Value shown once; token becomes active immediately                                    |
| **Expired**     | Token stops working; CLI requests return an authentication error                      |
| **Regenerated** | A new value is generated with a newly chosen expiration; the old value is invalidated |
| **Renamed**     | Display name updated; value and expiration unchanged                                  |
| **Deleted**     | Token is permanently revoked                                                          |

## Security considerations

- Store token values in a secrets manager or encrypted vault, not in plain-text files.
- Use a short expiration window for tokens shared with automated systems.
- Regenerate a token immediately if you suspect it has been exposed.
- Each regeneration invalidates the previous value, so update any tools or scripts that use the old value.

## Next steps

- [Manage personal access tokens](https://docs.swale.io/how-to-guides/manage-personal-access-tokens.md)
- [Install the CLI](https://docs.swale.io/reference/install-cli.md)
- [Log in with the CLI](https://docs.swale.io/tutorials/log-in-with-the-cli.md)
