Create hooks

Delivers one event to the org's automation triggers and answers {matched:n} — how many enabled flows had a webhook trigger on this (source, event) key and were started by it.

POST /v1/auto/hooks/{source}/{event}

Addresshttps://api.hanzo.ai/v1/auto/hooks/{source}/{event}
MethodPOST
Operationpost_auto_hooks_by_source_by_event
AuthAuthorization: Bearer $HANZO_API_KEY

Delivers one event to the org's automation triggers and answers {matched:n} — how many enabled flows had a webhook trigger on this (source, event) key and were started by it. A zero match is a success, not an error: nothing was subscribed.

The path is the trigger key and the JSON object body is the event payload, threaded into each started run as {{trigger.*}} with all of its keys intact — which is why this is not a typed op, since a declared input struct would silently DISCARD every payload key it had no field for. Re-delivery is a no-op: an X-Idempotency-Key header dedupes, and with none the body is content-hashed instead, so a hammer of identical posts collapses to ONE run rather than minting a fresh one per post. An in-platform producer may propagate X-Causation-Depth so a firing that a flow caused is bounded against a loop; an absent or invalid header reads as depth 0, an external origin.

Authenticated and org-scoped, unlike a provider's public webhook URL: a validated principal is required (401 without one) and the org is that principal's, never the body's, so a producer can only fire into its own tenant's flows. Both path segments are required (400) and a payload over the size limit is a 413.

Request

2 fields.

FieldInTypeRequiredDescription
sourcepathstringyes
eventpathstringyes

Response

The document declares no response body for this operation. It answers 200 on success and the platform error shape on failure — see Errors.

Examples

hanzo auto hooks source add <source> <event>
import { Configuration, AutoApi } from 'hanzoai';

const api = new AutoApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postAutoHooksBySourceByEvent({ source: 'source', event: 'event' });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AutoApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AutoApi(client).post_auto_hooks_by_source_by_event(source='source', event='event')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AutoAPI.PostAutoHooksBySourceByEvent(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, auto_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = auto_api::post_auto_hooks_by_source_by_event(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AutoApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AutoApi(client).postAutoHooksBySourceByEvent();
curl -X POST https://api.hanzo.ai/v1/auto/hooks/<source>/<event> \
  -H "Authorization: Bearer $HANZO_API_KEY"

MCP reaches auto through the auto tool, which names its 14 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_auto_flows"
         }
       }
     }'

Auto API · All Hanzo APIs · Interactive reference

Was this page useful?