1 ---
2 title: npm-token
3 section: 1
4 description: Manage your authentication tokens
5 github_repo: npm/cli
6 github_branch: release/v7
7 github_path: docs/content/commands/npm-token.md
8 redirect_from:
9 - /cli-documentation/v7/cli-commands/npm-token
10 - /cli-documentation/v7/cli-commands/token
11 - /cli-documentation/v7/commands/npm-token
12 - /cli-documentation/v7/commands/token
13 - /cli-documentation/v7/npm-token
14 - /cli-documentation/v7/token
15 - /cli/v7/cli-commands/npm-token
16 - /cli/v7/cli-commands/token
17 - /cli/v7/commands/token
18 - /cli/v7/npm-token
19 - /cli/v7/token
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm token list [--json|--parseable]
26 npm token create [--read-only] [--cidr=1.1.1.1/24,2.2.2.2/16]
27 npm token revoke <id|token>
28 ```
29
30 Note: This command is unaware of workspaces.
31
32 ### Description
33
34 This lets you list, create and revoke authentication tokens.
35
36 - `npm token list`: Shows a table of all active authentication tokens. You can request this as JSON with `--json` or tab-separated values with `--parseable`.
37
38 ```bash
39 +--------+---------+------------+----------+----------------+
40 | id | token | created | read-only | CIDR whitelist |
41 +--------+---------+------------+----------+----------------+
42 | 7f3134 | 1fa9ba… | 2017-10-02 | yes | |
43 +--------+---------+------------+----------+----------------+
44 | c03241 | af7aef… | 2017-10-02 | no | 192.168.0.1/24 |
45 +--------+---------+------------+----------+----------------+
46 | e0cf92 | 3a436a… | 2017-10-02 | no | |
47 +--------+---------+------------+----------+----------------+
48 | 63eb9d | 74ef35… | 2017-09-28 | no | |
49 +--------+---------+------------+----------+----------------+
50 | 2daaa8 | cbad5f… | 2017-09-26 | no | |
51 +--------+---------+------------+----------+----------------+
52 | 68c2fe | 127e51… | 2017-09-23 | no | |
53 +--------+---------+------------+----------+----------------+
54 | 6334e1 | 1dadd1… | 2017-09-23 | no | |
55 +--------+---------+------------+----------+----------------+
56 ```
57
58 - `npm token create [--read-only] [--cidr=<cidr-ranges>]`: Create a new authentication token. It can be `--read-only`, or accept a list of [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) ranges with which to limit use of this token. This will prompt you for your password, and, if you have two-factor authentication enabled, an otp.
59
60 Currently, the cli can not generate automation tokens. Please refer to the [docs website](https://docs.npmjs.com/creating-and-viewing-access-tokens) for more information on generating automation tokens.
61
62 ```bash
63 +----------------+--------------------------------------+
64 | token | a73c9572-f1b9-8983-983d-ba3ac3cc913d |
65 +----------------+--------------------------------------+
66 | cidr_whitelist | |
67 +----------------+--------------------------------------+
68 | readonly | false |
69 +----------------+--------------------------------------+
70 | created | 2017-10-02T07:52:24.838Z |
71 +----------------+--------------------------------------+
72 ```
73
74 - `npm token revoke <token|id>`: Immediately removes an authentication token from the registry. You will no longer be able to use it. This can accept both complete tokens (such as those you get back from `npm token create`, and those found in your `.npmrc`), and ids as seen in the parseable or json output of `npm token list`. This will NOT accept the truncated token found in the normal `npm token list` output.
75
76 ### Configuration
77
78 #### `read-only`
79
80 - Default: false
81 - Type: Boolean
82
83 This is used to mark a token as unable to publish when configuring limited access tokens with the `npm token create` command.
84
85 #### `cidr`
86
87 - Default: null
88 - Type: null or String (can be set multiple times)
89
90 This is a list of CIDR address to be used when configuring limited access tokens with the `npm token create` command.
91
92 #### `registry`
93
94 - Default: "https://registry.npmjs.org/"
95 - Type: URL
96
97 The base URL of the npm registry.
98
99 #### `otp`
100
101 - Default: null
102 - Type: null or String
103
104 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with `npm access`.
105
106 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.
107
108 ### See Also
109
110 - [npm adduser](/cli/v7/commands/npm-adduser)
111 - [npm registry](/cli/v7/using-npm/registry)
112 - [npm config](/cli/v7/commands/npm-config)
113 - [npmrc](/cli/v7/configuring-npm/npmrc)
114 - [npm owner](/cli/v7/commands/npm-owner)
115 - [npm whoami](/cli/v7/commands/npm-whoami)
116 - [npm profile](/cli/v7/commands/npm-profile)