1 ---
2 title: npm-hook
3 section: 1
4 description: Manage registry hooks
5 github_repo: npm/cli
6 github_branch: release/v6
7 github_path: docs/content/commands/npm-hook.md
8 redirect_from:
9 - /cli-documentation/v6/cli-commands/hook
10 - /cli-documentation/v6/cli-commands/npm-hook
11 - /cli-documentation/v6/commands/hook
12 - /cli-documentation/v6/commands/npm-hook
13 - /cli-documentation/v6/hook
14 - /cli-documentation/v6/npm-hook
15 - /cli/v6/cli-commands/hook
16 - /cli/v6/cli-commands/npm-hook
17 - /cli/v6/commands/hook
18 - /cli/v6/hook
19 - /cli/v6/npm-hook
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm hook ls [pkg]
26 npm hook add <entity> <url> <secret>
27 npm hook update <id> <url> [secret]
28 npm hook rm <id>
29 ```
30
31 ### Example
32
33 Add a hook to watch a package for changes:
34
35 ```bash
36 $ npm hook add lodash https://example.com/ my-shared-secret
37 ```
38
39 Add a hook to watch packages belonging to the user `substack`:
40
41 ```bash
42 $ npm hook add ~substack https://example.com/ my-shared-secret
43 ```
44
45 Add a hook to watch packages in the scope `@npm`
46
47 ```bash
48 $ npm hook add @npm https://example.com/ my-shared-secret
49 ```
50
51 List all your active hooks:
52
53 ```bash
54 $ npm hook ls
55 ```
56
57 List your active hooks for the `lodash` package:
58
59 ```bash
60 $ npm hook ls lodash
61 ```
62
63 Update an existing hook's url:
64
65 ```bash
66 $ npm hook update id-deadbeef https://my-new-website.here/
67 ```
68
69 Remove a hook:
70
71 ```bash
72 $ npm hook rm id-deadbeef
73 ```
74
75 ### Description
76
77 Allows you to manage [npm hooks](https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm), including adding, removing, listing, and updating.
78
79 Hooks allow you to configure URL endpoints that will be notified whenever a change happens to any of the supported entity types. Three different types of entities can be watched by hooks: packages, owners, and scopes.
80
81 To create a package hook, simply reference the package name.
82
83 To create an owner hook, prefix the owner name with `~` (as in, `~youruser`).
84
85 To create a scope hook, prefix the scope name with `@` (as in, `@yourscope`).
86
87 The hook `id` used by `update` and `rm` are the IDs listed in `npm hook ls` for that particular hook.
88
89 The shared secret will be sent along to the URL endpoint so you can verify the request came from your own configured hook.
90
91 ### See Also
92
93 - ["Introducing Hooks" blog post](https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm)