> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Tokens

Control who can access packages in a channel by associating the channel with a [group](https://anaconda.com/docs/anaconda-org/admin-guide/groups.md). This allows you to set separate permissions per package.

You can further control access to your packages within organizations and groups with tokens (An access control token is a random alphanumeric string that is inserted into a package or channel URL. Tokens can be used with Anaconda.org, the Anaconda Premium Repository, or the AE4 Repository. The token allows you to download a package or add a channel that are restricted.). Tokens control access to private repositories, collections, or packages on Anaconda.org. Additionally, the degree of access a token grants is completely configurable at the time of generation. You can generate multiple tokens to control which groups of users have access to certain features if they have the appropriate token.

> [!NOTE]
>
> Individual paid plans with private packages are a legacy offering from Anaconda.org that are no longer available. However, anyone who had private packages in the past still has the ability to have those hosted privately. [Private channels](https://anaconda.com/docs/anaconda-org/private-channels.md) offer a newer approach to private distribution using collaborator-based sharing instead of tokens.

## Generating tokens

Tokens provide varying degrees of access to content within a specified channel (A location (URL or file path) in a repository where conda looks for packages.) depending on the scope assignment. If you need to separate permission levels by package, you can create an [organization](https://anaconda.com/docs/anaconda-org/admin-guide/organizations.md) and [groups](https://anaconda.com/docs/anaconda-org/admin-guide/groups.md) within that organization.

> [!NOTE]
>
> By default, tokens expire after one year.

> [tab] CLI
>
> 1. Open Anaconda Prompt (A command-line application included with Windows installations of Anaconda Distribution and Miniconda. Find it by searching 'Anaconda Prompt' in the Windows Start menu.) (Terminal on macOS/Linux) and run the following command:
>
>    ```sh theme={null}
>    anaconda auth --create --name <YOUR_TOKEN_NAME> --scopes '<SCOPE1> <SCOPE2>'
>    ```
>
>    Comments
>
>    Replace \<YOUR\_TOKEN\_NAME> with a name of your choosing.\\
>
>    Replace \<SCOPE> with a scope(s) from the Scopes dropdown below.
>
>    This command generates a random alphanumeric string. That string is your token! You can distribute your token to other Anaconda.org users to provide them with a specific, limited set of permissions to interact with your Anaconda.org assets.
>
> 2. Add the token to your channel path in your .condarc file by running the following command:
>
>    ```sh theme={null}
>    conda config --add channels https://conda.anaconda.org/t/<TOKEN>/<CHANNEL>
>    ```
>
>    Comments
>
>    Replace \<TOKEN> with your token string.\\
>
>    Replace \<CHANNEL> with the channel name.
>
>    Or, add a channel with a token and a label (Part of the URLs on Anaconda.org where conda looks for packages. Labels are searched only if you specify a label.):
>
>    ```sh theme={null}
>    conda config --add channels https://conda.anaconda.org/t/<TOKEN>/<CHANNEL>/label/<YOUR_TOKEN_NAME>
>    ```
>
>    Comments
>
>    Replace \<TOKEN> with your token string.\\
>
>    Replace \<CHANNEL> with the channel name.\\
>
>    Replace \<YOUR\_TOKEN\_NAME> with the label name used in the previous step.
>
> > [accordion] Scopes
> >
> > Assign scopes to tokens to set permission levels for token holders. Scopes are provided as a space-separated, quoted list.
> >
> > Available scopes:
> >
> > | Scope | Permission |
> > | :- | :- |
> > | `all` | Allow all operations |
> > | `repos` | Allow access to all package repositories |
> > | `pypi` | Allow all operations on Standard Python repositories |
> > | `pypi:upload` | Provides upload permissions to Standard Python repositories |
> > | `pypi:download` | Provides download permissions for private packages in Standard Python repositories |
> > | `conda` | Allow all operations on conda repositories |
> > | `conda:download` | Provides download permissions for private packages in conda repositories |
> > | `api` | Allow all API operations |
> > | `api:write` | Provides write permissions to actions performed via API |
> > | `api:read` | Provides read permissions to actions performed via API |
> > | `api:modify-group` | Provides manage permissions to groups via the API |

> [tab] Anaconda.org
>
> 1. Log in to Anaconda.org.
>
> 2. From your profile in the top-right corner, select **Settings**.
>
> 3. Select **Access** in the left-hand menu.
>
> 4. Fill out the Create access token form:
>
>    1. Provide a unique token name.
>    2. Set your token strength to `strong (longer token)`. This generates a strong, completely unique token that is difficult to guess with brute force methods.
>    3. Set the required scopes for your use case.
>    4. Set the expiration date.
>
>    A notification appears containing your token.
>
>    > [!TIP]
>    >
>    > You can view the token at any time at the bottom of the **Access** page.
>
> 5. Click **Create**.

> [!NOTE]
>
> If your token expires, [revoke the token](#revoking-tokens) and create a new one.

## Revoking tokens

You can revoke tokens directly on Anaconda.org or from the command line interface (CLI).

> [tab] CLI
>
> 1. Open Anaconda Prompt (A command-line application included with Windows installations of Anaconda Distribution and Miniconda. Find it by searching 'Anaconda Prompt' in the Windows Start menu.) (Terminal on macOS/Linux) and run the following command:
>
>    ```sh theme={null}
>    anaconda auth --remove <YOUR_TOKEN_NAME>
>    ```
>
>    Comments
>
>    Replace \<YOUR\_TOKEN\_NAME> with the name of the token you want to revoke.

> [tab] Anaconda.org
>
> 1. Log in to Anaconda.org.
> 2. From your profile in the top-right corner, select **Settings**.
> 3. Select **Access** in the left-hand menu.
> 4. At the bottom of the page, click the name of the token you want to revoke.
> 5. Click **Revoke Token**.
