Skip to content

HookConfigHttp

Base classes

Name Children Inherits
ClaudeCodeBaseModel
clawd_code_sdk.models.base
Base model for all Claude Code Pydantic models.

⋔ Inheritance diagram

graph TD
  2938572470["settings.HookConfigHttp"]
  2604142835["base.ClaudeCodeBaseModel"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  2604142835 --> 2938572470
  3879467795 --> 2604142835
  2751680898 --> 3879467795

🛈 DocStrings

Bases: ClaudeCodeBaseModel

HTTP webhook hook. POST JSON to a URL and receive JSON response. See https://code.claude.com/docs/en/hooks#http-hook-fields.

Source code in src/clawd_code_sdk/models/settings.py
class HookConfigHttp(ClaudeCodeBaseModel):
    """HTTP webhook hook. POST JSON to a URL and receive JSON response. See https://code.claude.com/docs/en/hooks#http-hook-fields."""

    model_config = ConfigDict(
        extra="forbid",
    )
    type: Literal["http"] = "http"
    """
    Hook type
    """
    url: str = Field(..., min_length=1)
    """
    URL to POST hook input JSON to. Endpoint must accept POST requests and return JSON.
    """
    headers: dict[str, str] | None = None
    """
    Custom HTTP headers (e.g., Authorization: Bearer token). Values support $VAR_NAME or ${VAR_NAME} interpolation.
    """
    allowed_env_vars: list[AllowedEnvVar] | None = Field(None, alias="allowedEnvVars")
    """
    List of environment variable names permitted for interpolation in headers. If not set, no env var interpolation is allowed.
    """
    timeout: float | None = Field(None, gt=0.0)
    """
    Optional timeout in seconds (default: 600; lowered to 30 on UserPromptSubmit and 10 on MessageDisplay)
    """
    on_failure: Literal["continue", "block"] | None = Field(None, alias="onFailure")
    """
    Whether the action that triggered the hook goes ahead when the hook fails: the connection fails, the response status isn't 2xx, it times out, or the response body is invalid. "block" does what exit code 2 does on that event, and denies the request on PermissionRequest. No effect on Stop, SubagentStop, TaskCompleted, and TeammateIdle hooks. Requires Claude Code v2.1.295 or later. See https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails
    """
    if_: str | None = Field(None, alias="if")
    """
    Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with `if` set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers
    """
    status_message: str | None = Field(None, alias="statusMessage")
    """
    Custom spinner message displayed while the hook runs
    """

allowed_env_vars class-attribute instance-attribute

allowed_env_vars: list[AllowedEnvVar] | None = Field(None, alias='allowedEnvVars')

List of environment variable names permitted for interpolation in headers. If not set, no env var interpolation is allowed.

headers class-attribute instance-attribute

headers: dict[str, str] | None = None

Custom HTTP headers (e.g., Authorization: Bearer token). Values support $VAR_NAME or ${VAR_NAME} interpolation.

if_ class-attribute instance-attribute

if_: str | None = Field(None, alias='if')

Optional permission-rule-syntax filter. Evaluated only on tool-related events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied); on other events a hook with if set never runs. See https://code.claude.com/docs/en/hooks-guide#filter-hooks-with-matchers

on_failure class-attribute instance-attribute

on_failure: Literal['continue', 'block'] | None = Field(None, alias='onFailure')

Whether the action that triggered the hook goes ahead when the hook fails: the connection fails, the response status isn't 2xx, it times out, or the response body is invalid. "block" does what exit code 2 does on that event, and denies the request on PermissionRequest. No effect on Stop, SubagentStop, TaskCompleted, and TeammateIdle hooks. Requires Claude Code v2.1.295 or later. See https://code.claude.com/docs/en/hooks#block-the-action-when-a-hook-fails

status_message class-attribute instance-attribute

status_message: str | None = Field(None, alias='statusMessage')

Custom spinner message displayed while the hook runs

timeout class-attribute instance-attribute

timeout: float | None = Field(None, gt=0.0)

Optional timeout in seconds (default: 600; lowered to 30 on UserPromptSubmit and 10 on MessageDisplay)

type class-attribute instance-attribute

type: Literal['http'] = 'http'

Hook type

url class-attribute instance-attribute

url: str = Field(..., min_length=1)

URL to POST hook input JSON to. Endpoint must accept POST requests and return JSON.

:fa-brands-github: Show source on GitHub