1 ---
2 title: Creating and viewing access tokens
3 redirect_from:
4 - /creating-and-viewing-authentication-tokens
5 ---
6
7 You can [create](#creating-access-tokens) and [view](#viewing-access-tokens) access tokens from the website and command line interface (CLI).
8
9 ## Creating access tokens
10
11 ### Creating granular access tokens on the website
12
13 1. In the upper right corner of the page, click your profile picture, then click **Access Tokens**.
14
15 <Screenshot src="/integrations/integrating-npm-with-external-services/tokens-profile.png" alt="Screenshot of the account menu with the tokens link selected" />
16
17 2. Click **Generate New Token**, then click **Granular Access Token**.
18
19 <Screenshot src="/integrations/integrating-npm-with-external-services/create-token.png" alt="Screenshot of the create new token button" />
20
21 3. In the **Token name** field, enter a name for your token.
22
23 4. (Optional) In the **Description** field, enter a description for your token.
24
25 5. In the **Expiration** field, enter a token expiration period. The date must be at least 1 day in the future.
26
27 6. (Optional) In the **Allowed IP Ranges** field, enter IP address ranges to restrict your access token to. You must use [CIDR][cidr-wiki] notation to enter IP address ranges. To add more than one allowed IP range, click **Add IP Range** and enter an IP range in the new text field.
28
29 <Screenshot src="/integrations/integrating-npm-with-external-services/granular-access-token-ip-range.png" alt="Screenshot of the allowed IP ranges section" />
30
31 7. (Optional) In the **Packages and scopes** section, configure your token's access to packages and scopes.
32 - In the **Permissions** dropdown menu, select **No access**, **Read-only**, or **Read and write**.
33 - Under **Select Packages**, select either:
34 - **All Packages** to grant the token access to all packages the user account has access to.
35 - **Only select packages and scopes** to choose up to 50 specific packages or scopes to give the token access to. Then select specific packages or scopes from the dropdown menu.
36
37 <Screenshot src="/integrations/integrating-npm-with-external-services/granular-access-token-packages-scopes.png" alt="Screenshot of the packages and scopes section" />
38
39 8. (Optional) In the **Organizations** section, configure your token's access to organizations.
40 - In the **Permissions** dropdown menu, select **No access**, **Read-only**, or **Read and write**.
41 - Under **Select organizations**, select the organizations you want to grant your token access to.
42
43 <Screenshot src="/integrations/integrating-npm-with-external-services/granular-access-token-organizations.png" alt="Screenshot of the organizations section" />
44
45 _**Note**: When you give a token access to an organization, the token can only be used for managing organization settings and teams or users associated with the organization. It does not give the token the right to publish packages managed by the organization._
46
47 9. Review the token summary, then click **Generate Token**.
48
49 <Screenshot src="/integrations/integrating-npm-with-external-services/granular-access-token-summary.png" alt="Screenshot of the granular access token summary and the generate token button" />
50
51 10. Copy the token from the top of page.
52
53 ### Creating tokens with the CLI
54
55 <Note>
56
57 **Note:** You cannot create granular access tokens from the CLI. You must use the website to generate these types of tokens. For more information, see "[Creating granular access tokens on the website](#creating-granular-access-tokens-on-the-website)."
58
59 </Note>
60
61 ## Viewing access tokens
62
63 <Note>
64
65 **Note:** Full tokens are never displayed, only the first and last four characters will be shown. You can only view a full token immediately after creation.
66
67 </Note>
68
69 ### Viewing tokens on the website
70
71 To view all tokens associated with your account, in the upper right corner of the page, click your profile picture, then click **Access Tokens**.
72
73 <Screenshot src="/integrations/integrating-npm-with-external-services/tokens-profile.png" alt="Screenshot of the account menu with the tokens link selected" />
74
75 ### Viewing tokens on the CLI
76
77 To view all tokens associated with your account, on the command line, run the following command:
78
79 ```
80 npm token list
81 ```
82
83 #### Token attributes
84
85 - **id:** Use the token ID to refer to the token in commands.
86 - **token:** The first digits of the actual token.
87 - **created:** Date the token was created.
88 - **CIDR whitelist:** Restricts token use by IP address.
89
90 [tfa]: about-two-factor-authentication
91 [cidr-wiki]: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing