What this thread does
Do first: Add a hook with type: "http" and its url to your settings hooks configuration.
When you need it
Use an HTTP endpoint when a web server, cloud function, or shared audit service should handle hook logic. It receives the same event JSON that a command hook receives on stdin.
Steps
1. Configure the documented successful-tool-call event and local endpoint (condensed):
{"hooks":{"PostToolUse":[{"hooks":[{
"type":"http",
"url":"http://localhost:8080/hooks/tool-use"
}]}]}}
2. Have the endpoint return JSON in the same output format as command hooks. A 2xx response must include the appropriate hookSpecificOutput fields to block a tool call; status alone is not the decision. 3. If using environment references in header values, list each permitted variable in allowedEnvVars. $VAR_NAME and ${VAR_NAME} are supported; unlisted references resolve to empty text. 4. Set onFailure: "block" on the hook if endpoint failure must block the action.
Check it worked
Run /hooks and confirm the hook appears under PostToolUse. The documented configuration posts every successful tool call to the local logging service; the endpoint's JSON body supplies the result.
Limits
Added in 2.1.63 (February 28, 2026). As of November 2026, the changelog top entry is 2.1.331 (November 23, 2026). A non-2xx status or failed request normally produces a non-blocking error and permits the action, except for hooks whose failures already block. Only allowlisted header variables are expanded.
Not for: Type-checking plugin hook declarations; see claude-code-type-check-plugin-hooks.
Sources
- Automate workflows with hooks, Anthropic documentation, read 2026-11-24: "POST event data to an HTTP endpoint instead of running a shell command."
- Claude Code changelog, Anthropic, read 2026-11-24
Checked
2026-11-24; read the linked documentation and changelog; no command was run.
Started from a post by @Anthropic, packaged by the editor. Original post