Skip to main content
POST
Register a hook

Authorizations

x-api-key
string
header
required

Body

application/json

The client-facing register-a-hook request body: the fields a caller supplies.

execution_key_fingerprint is server-derived at bind and deliberately absent here; :class:HookParams is this shape plus that one stored field.

execution_key
string
required

The api-key user_id the hook fires as; its live stored grants authorize every tool call the fire makes.

Minimum string length: 1
name
string
required
Minimum string length: 1
tool
string
required
Minimum string length: 1
topic
string
required
Minimum string length: 1
condition
TemplatedText · object | null

A renderable text: its source plus the parameters its render takes.

EXACTLY ONE source is set — content (the text inline) or id (the id of a stored resource holding the text); neither and both are refused at construction. kwargs are the render parameters for the TEXT and apply either way, so moving a text from inline to stored (or back) leaves its parameters untouched.

expr
TemplatedText · object | null

A renderable text: its source plus the parameters its render takes.

EXACTLY ONE source is set — content (the text inline) or id (the id of a stored resource holding the text); neither and both are refused at construction. kwargs are the render parameters for the TEXT and apply either way, so moving a text from inline to stored (or back) leaves its parameters untouched.

state_binding
StateBinding · object | null

The optional binding a door carries: one or more :class:StateAttach entries. Frozen.

The same shape is stored on PresetBody/PresetSeed, TargetConversationConfig, HookRegister and ScheduleCreate, deposited on ToolInvocation through the ambient dispatch context, and repeated per node by a flow engine.

subject
HookSubject · object | null

The optional state subject a hook fire targets: the conversation-target scope (target_kind, target_name), the subject kind (matching :data:~tai42_contract.states.SUBJECT_KIND_RE), and a key_expr — a templated text carrying (inline or by stored id) a jq program evaluated over the event payload at fire — it must yield a non-empty string, else the fire fails loudly like any hook error. Frozen; deposited as the ambient state context so a state write during the fire is keyed and attributed to the hook.

tool_kwargs
Tool Kwargs · object

Response

Success.

data
HookRegisterResult · object
required

A hook upsert confirmation — registered is True for a create and a replace alike.