# HTTP Hook

> A hook that sends the event to a web server.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** type: http, allowedEnvVars

## Think of it like

It is like you post a letter. Then you wait for the reply.

## Definition

An HTTP hook is a hook whose type is http, so it sends the event's JSON as a POST request to a web address. The server answers in its body, with the same JSON a command hook prints. An empty 2xx reply means go ahead. A failed request or a non-2xx reply does not block, unless onFailure is set to block. Headers can use only the variables you list.

## Example

Emma's team has one server that holds its rules. Each laptop sends its events there. So one list of rules covers the whole team.

## Example code

```json
{
  "type": "http",
  "url": "https://hooks.example.com/check",
  "headers": { "Authorization": "Bearer $MY_TOKEN" },
  "allowedEnvVars": ["MY_TOKEN"]
}
```

Send each event to a team server.

## Why it matters

It moves hook logic to one shared place instead of a script on every machine.

## Common mistake

Putting $TOKEN in a header but not in allowedEnvVars. Then it is swapped for an empty string.

## Three principles

- **POST to a web address.** JSON body.
- **Same answer shape.** As a command.
- **Failures do not block.** Unless set to.

## Related terms

- [Command Hook](https://learn.benibix.com/term/ai/command-hook)
- [Webhook](https://learn.benibix.com/term/development/webhook)
- [Hook JSON Output](https://learn.benibix.com/term/ai/hook-json-output)

---

Source: https://learn.benibix.com/term/ai/http-hook
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
