1 ---
2 title: npm-token
3 section: 1
4 description: Manage your authentication tokens
5 github_repo: npm/cli
6 github_branch: latest
7 github_path: docs/lib/content/commands/npm-token.md
8 redirect_from:
9 - /cli-commands/npm-token
10 - /cli-commands/token
11 - /cli-documentation/cli-commands/npm-token
12 - /cli-documentation/cli-commands/token
13 - /cli-documentation/commands/npm-token
14 - /cli-documentation/commands/token
15 - /cli-documentation/npm-token
16 - /cli-documentation/token
17 - /cli-documentation/v11/cli-commands/npm-token
18 - /cli-documentation/v11/cli-commands/token
19 - /cli-documentation/v11/commands/npm-token
20 - /cli-documentation/v11/commands/token
21 - /cli-documentation/v11/npm-token
22 - /cli-documentation/v11/token
23 - /cli/cli-commands/npm-token
24 - /cli/cli-commands/token
25 - /cli/commands/npm-token
26 - /cli/commands/token
27 - /cli/npm-token
28 - /cli/token
29 - /cli/v11/cli-commands/npm-token
30 - /cli/v11/cli-commands/token
31 - /cli/v11/commands/token
32 - /cli/v11/npm-token
33 - /cli/v11/token
34 - /commands/npm-token
35 - /commands/token
36 ---
37
38 ### Synopsis
39
40 ```bash
41 npm token list
42 npm token revoke <id|token>
43 npm token create
44 ```
45
46 Note: This command is unaware of workspaces.
47
48 ### Description
49
50 This lets you list, create and revoke authentication tokens.
51
52 #### Listing tokens
53
54 When listing tokens, an abbreviated token will be displayed. For security purposes the full token is not displayed.
55
56 #### Generating tokens
57
58 When generating tokens, you will be prompted you for your password and, if you have two-factor authentication enabled, an otp.
59
60 Please refer to the [docs website](https://docs.npmjs.com/creating-and-viewing-access-tokens) for more information on generating tokens for CI/CD.
61
62 #### Revoking tokens
63
64 When revoking a token, you can use the full token (e.g. what you get back from `npm token create`, or as can be found in an `.npmrc` file), or a truncated id. If the given truncated id is not distinct enough to differentiate between multiple existing tokens, you will need to use enough of the id to allow npm to distinguish between them. Full token ids can be found on the [npm website](https://www.npmjs.com), or in the `--parseable` or `--json` output of `npm token list`. This command will NOT accept the truncated token found in the normal `npm token list` output.
65
66 A revoked token will immediately be removed from the registry and you will no longer be able to use it.
67
68 ### Configuration
69
70 #### `name`
71
72 - Default: null
73 - Type: null or String
74
75 When creating a Granular Access Token with `npm token create`, this sets the name/description for the token.
76
77 #### `token-description`
78
79 - Default: null
80 - Type: null or String
81
82 Description text for the token when using `npm token create`.
83
84 #### `expires`
85
86 - Default: null
87 - Type: null or Number
88
89 When creating a Granular Access Token with `npm token create`, this sets the expiration in days. If not specified, the server will determine the default expiration.
90
91 #### `packages`
92
93 - Default:
94 - Type: null or String (can be set multiple times)
95
96 When creating a Granular Access Token with `npm token create`, this limits the token access to specific packages.
97
98 #### `packages-all`
99
100 - Default: false
101 - Type: Boolean
102
103 When creating a Granular Access Token with `npm token create`, grants the token access to all packages instead of limiting to specific packages.
104
105 #### `scopes`
106
107 - Default: null
108 - Type: null or String (can be set multiple times)
109
110 When creating a Granular Access Token with `npm token create`, this limits the token access to specific scopes. Provide a scope name (with or without @ prefix).
111
112 #### `orgs`
113
114 - Default: null
115 - Type: null or String (can be set multiple times)
116
117 When creating a Granular Access Token with `npm token create`, this limits the token access to specific organizations.
118
119 #### `packages-and-scopes-permission`
120
121 - Default: null
122 - Type: null, "read-only", "read-write", or "no-access"
123
124 When creating a Granular Access Token with `npm token create`, sets the permission level for packages and scopes. Options are "read-only", "read-write", or "no-access".
125
126 #### `orgs-permission`
127
128 - Default: null
129 - Type: null, "read-only", "read-write", or "no-access"
130
131 When creating a Granular Access Token with `npm token create`, sets the permission level for organizations. Options are "read-only", "read-write", or "no-access".
132
133 #### `cidr`
134
135 - Default: null
136 - Type: null or String (can be set multiple times)
137
138 This is a list of CIDR address to be used when configuring limited access tokens with the `npm token create` command.
139
140 #### `bypass-2fa`
141
142 - Default: false
143 - Type: Boolean
144
145 When creating a Granular Access Token with `npm token create`, setting this to true will allow the token to bypass two-factor authentication. This is useful for automation and CI/CD workflows.
146
147 #### `password`
148
149 - Default: null
150 - Type: null or String
151
152 Password for authentication. Can be provided via command line when creating tokens, though it's generally safer to be prompted for it.
153
154 #### `registry`
155
156 - Default: "https://registry.npmjs.org/"
157 - Type: URL
158
159 The base URL of the npm registry.
160
161 #### `otp`
162
163 - Default: null
164 - Type: null or String
165
166 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with `npm access`.
167
168 If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
169
170 #### `read-only`
171
172 - Default: false
173 - Type: Boolean
174
175 This is used to mark a token as unable to publish when configuring limited access tokens with the `npm token create` command.
176
177 ### See Also
178
179 - [npm adduser](/cli/v11/commands/npm-adduser)
180 - [npm registry](/cli/v11/using-npm/registry)
181 - [npm config](/cli/v11/commands/npm-config)
182 - [npmrc](/cli/v11/configuring-npm/npmrc)
183 - [npm owner](/cli/v11/commands/npm-owner)
184 - [npm whoami](/cli/v11/commands/npm-whoami)
185 - [npm profile](/cli/v11/commands/npm-profile)