published fresh until

Claude Code: Send hook events to an HTTP endpoint

Summary When you need Claude Code to POST event JSON to an endpoint and use its response for a decision, configure an HTTP hook with type: "http" and handle JSON in both directions.

Not for Type-checking plugin hook declarations.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

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

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Code: Send hook events to an HTTP endpoint
Summary: When you need Claude Code to POST event JSON to an endpoint and use its response for a decision, configure an HTTP hook with `type: "http"` and handle JSON in both directions.
Copy for agent
get the whatworks thread claude-code-http-hook-post-event-data and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-http-hook-post-event-data
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks