# Personal Access Tokens

> Source: https://agilitycms.com/docs/developers/personal-access-tokens

Personal Access Tokens (PATs) let you authenticate with the Management API without a browser sign-in. They're meant for scripts, CI/CD pipelines and other automation, including the [Agility CLI](/docs/developers/cli). Each PAT acts as the user who created it, with that user's permissions on every Agility instance they can reach. A token expires on the date you set, at most two years after you create it, and each user can have up to 10 active tokens. A token is tied to the user who created it: when that user is suspended or removed, their tokens stop working.

## Creating and Managing PATs

Create and manage your tokens in Agility: select your avatar in the top-right corner, then **Personal Access Tokens**. You need the Develop or Manage permission on the instance you have open to see it. Step by step: [Manage Personal Access Tokens in Agility](/docs/developers/manage-personal-access-tokens).

To do it from a terminal instead, see [Create a Personal Access Token with the API](/docs/developers/create-personal-access-token). The endpoints are also listed under *Personal Access Tokens* in the [Management API reference](https://mgmt.aglty.io/index.html).

## Using a PAT

Send the token in the `Authorization` header as `Bearer <your token>`. The Agility CLI takes it as `--token` or the `AGILITY_TOKEN` environment variable, and the Management SDKs take it as the access token. Store it as a secret: anyone who has it can act as you.

## PAT Usage Rules and Limitations

### Token Creation

- Personal Access Tokens can only be created by users authenticated via OAuth.
- A Personal Access Token cannot be used to create additional personal access tokens.
- The token secret is displayed **only once** during creation and cannot be retrieved afterward.
- Token names and expiration dates remain viewable after creation.

### Token Scope and Permissions

- Each token operates on behalf of the user who created it.
- Tokens inherit the same permissions as the creating user.
- Personal Access Tokens do not have separate role-based access controls.
- If the user's permissions change, the token's access changes accordingly.

### Restricted Operations

- Personal Access Tokens cannot be used to create or update users.

### Token Lifecycle

- Maximum token lifetime is 2 years from creation date.
- Each user can have up to 10 active tokens.
- Tokens automatically expire after their expiration date.
- You can disable or delete your own tokens at any time. See [Manage Personal Access Tokens in Agility](/docs/developers/manage-personal-access-tokens).
- Expired or revoked tokens cannot be restored or renewed.

### Security Considerations

- Token secrets are sensitive credentials and should be stored securely.
- Use environment variables or secure secret management systems to store PATs.
- Never commit tokens to version control.
- Regularly rotate tokens for enhanced security.
- Revoke unused or unnecessary tokens.

## Best Practices

- Create separate tokens for different applications or purposes.
- Use descriptive names that indicate the token's purpose.
- Set appropriate expiration dates based on your use case.
- Monitor token usage and revoke any tokens showing suspicious activity

---

## Related pages

- [Content Fetch API](https://agilitycms.com/docs/developers/content-fetch-api.md)
- [Content Sync API](https://agilitycms.com/docs/developers/content-sync-api.md)
- [Content Management API](https://agilitycms.com/docs/developers/content-management-api.md)
- [GraphQL API](https://agilitycms.com/docs/developers/graphql-api.md)
- [CLI - CI/CD Integration Guide](https://agilitycms.com/docs/developers/cli-ci-cd-integration-guide.md)
- [Testing on Swagger](https://agilitycms.com/docs/developers/testing-on-swagger.md)
- [GraphQL & Rest API Filtering](https://agilitycms.com/docs/developers/graphql-operators.md)
- [AgilityCLI (Command Line Interface)](https://agilitycms.com/docs/developers/cli.md)
- [Content Delivery & CDN Architecture](https://agilitycms.com/docs/developers/content-delivery-and-cdn-architecture.md)
- [Typed GraphQL with TypeScript and Next.js](https://agilitycms.com/docs/developers/typed-graphql-typescript-nextjs.md)
- [Image Transformation Reference](https://agilitycms.com/docs/developers/image-transformation-reference.md)
- [Fetch API Status Codes and Caching](https://agilitycms.com/docs/developers/fetch-api-status-codes-and-caching.md)
- [Field Types and What the APIs Return](https://agilitycms.com/docs/developers/field-types-api-reference.md)
- [Content Sync Explained](https://agilitycms.com/docs/developers/content-sync-explained.md)
- [Agility CLI Command Reference](https://agilitycms.com/docs/developers/cli-reference.md)
- [CLI Reference: agility pull](https://agilitycms.com/docs/developers/cli-pull.md)
- [CLI Reference: agility sync and push](https://agilitycms.com/docs/developers/cli-sync.md)
- [CLI Reference: agility reverse-sync](https://agilitycms.com/docs/developers/cli-reverse-sync.md)
- [CLI Reference: agility workflows](https://agilitycms.com/docs/developers/cli-workflows.md)
- [CLI Reference: agility login and logout](https://agilitycms.com/docs/developers/cli-login-logout.md)
- [Test Your Agility Integration in CI](https://agilitycms.com/docs/developers/test-agility-integration-in-ci.md)
- [CLI Reference: agility verify](https://agilitycms.com/docs/developers/cli-verify.md)
- [Create a Personal Access Token with the API](https://agilitycms.com/docs/developers/create-personal-access-token.md)
- [Manage Personal Access Tokens in Agility](https://agilitycms.com/docs/developers/manage-personal-access-tokens.md)

Index of every docs page: https://agilitycms.com/docs/llms.txt
