Create a new runtime hook
curl --request POST \
--url http://localhost:3000/api/v1/hooks/create \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"action": "<string>",
"agent": "<string>",
"async": true,
"barrier": "<string>",
"cooldown": "<string>",
"dedupeKey": "<string>",
"disabled": true,
"event": "<string>",
"matcher": "<string>",
"message": "<string>",
"role": "<string>",
"scope": "<string>",
"session": "<string>",
"targetSession": "<string>",
"targetTask": "<string>",
"task": "<string>",
"workspace": "<string>"
}
'import requests
url = "http://localhost:3000/api/v1/hooks/create"
payload = {
"name": "<string>",
"action": "<string>",
"agent": "<string>",
"async": True,
"barrier": "<string>",
"cooldown": "<string>",
"dedupeKey": "<string>",
"disabled": True,
"event": "<string>",
"matcher": "<string>",
"message": "<string>",
"role": "<string>",
"scope": "<string>",
"session": "<string>",
"targetSession": "<string>",
"targetTask": "<string>",
"task": "<string>",
"workspace": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
action: '<string>',
agent: '<string>',
async: true,
barrier: '<string>',
cooldown: '<string>',
dedupeKey: '<string>',
disabled: true,
event: '<string>',
matcher: '<string>',
message: '<string>',
role: '<string>',
scope: '<string>',
session: '<string>',
targetSession: '<string>',
targetTask: '<string>',
task: '<string>',
workspace: '<string>'
})
};
fetch('http://localhost:3000/api/v1/hooks/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/v1/hooks/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'action' => '<string>',
'agent' => '<string>',
'async' => true,
'barrier' => '<string>',
'cooldown' => '<string>',
'dedupeKey' => '<string>',
'disabled' => true,
'event' => '<string>',
'matcher' => '<string>',
'message' => '<string>',
'role' => '<string>',
'scope' => '<string>',
'session' => '<string>',
'targetSession' => '<string>',
'targetTask' => '<string>',
'task' => '<string>',
'workspace' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/v1/hooks/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"agent\": \"<string>\",\n \"async\": true,\n \"barrier\": \"<string>\",\n \"cooldown\": \"<string>\",\n \"dedupeKey\": \"<string>\",\n \"disabled\": true,\n \"event\": \"<string>\",\n \"matcher\": \"<string>\",\n \"message\": \"<string>\",\n \"role\": \"<string>\",\n \"scope\": \"<string>\",\n \"session\": \"<string>\",\n \"targetSession\": \"<string>\",\n \"targetTask\": \"<string>\",\n \"task\": \"<string>\",\n \"workspace\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/api/v1/hooks/create")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"agent\": \"<string>\",\n \"async\": true,\n \"barrier\": \"<string>\",\n \"cooldown\": \"<string>\",\n \"dedupeKey\": \"<string>\",\n \"disabled\": true,\n \"event\": \"<string>\",\n \"matcher\": \"<string>\",\n \"message\": \"<string>\",\n \"role\": \"<string>\",\n \"scope\": \"<string>\",\n \"session\": \"<string>\",\n \"targetSession\": \"<string>\",\n \"targetTask\": \"<string>\",\n \"task\": \"<string>\",\n \"workspace\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/hooks/create")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"agent\": \"<string>\",\n \"async\": true,\n \"barrier\": \"<string>\",\n \"cooldown\": \"<string>\",\n \"dedupeKey\": \"<string>\",\n \"disabled\": true,\n \"event\": \"<string>\",\n \"matcher\": \"<string>\",\n \"message\": \"<string>\",\n \"role\": \"<string>\",\n \"scope\": \"<string>\",\n \"session\": \"<string>\",\n \"targetSession\": \"<string>\",\n \"targetTask\": \"<string>\",\n \"task\": \"<string>\",\n \"workspace\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}hooks
Create a new runtime hook
POST
/
api
/
v1
/
hooks
/
create
Create a new runtime hook
curl --request POST \
--url http://localhost:3000/api/v1/hooks/create \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"action": "<string>",
"agent": "<string>",
"async": true,
"barrier": "<string>",
"cooldown": "<string>",
"dedupeKey": "<string>",
"disabled": true,
"event": "<string>",
"matcher": "<string>",
"message": "<string>",
"role": "<string>",
"scope": "<string>",
"session": "<string>",
"targetSession": "<string>",
"targetTask": "<string>",
"task": "<string>",
"workspace": "<string>"
}
'import requests
url = "http://localhost:3000/api/v1/hooks/create"
payload = {
"name": "<string>",
"action": "<string>",
"agent": "<string>",
"async": True,
"barrier": "<string>",
"cooldown": "<string>",
"dedupeKey": "<string>",
"disabled": True,
"event": "<string>",
"matcher": "<string>",
"message": "<string>",
"role": "<string>",
"scope": "<string>",
"session": "<string>",
"targetSession": "<string>",
"targetTask": "<string>",
"task": "<string>",
"workspace": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
action: '<string>',
agent: '<string>',
async: true,
barrier: '<string>',
cooldown: '<string>',
dedupeKey: '<string>',
disabled: true,
event: '<string>',
matcher: '<string>',
message: '<string>',
role: '<string>',
scope: '<string>',
session: '<string>',
targetSession: '<string>',
targetTask: '<string>',
task: '<string>',
workspace: '<string>'
})
};
fetch('http://localhost:3000/api/v1/hooks/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/v1/hooks/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'action' => '<string>',
'agent' => '<string>',
'async' => true,
'barrier' => '<string>',
'cooldown' => '<string>',
'dedupeKey' => '<string>',
'disabled' => true,
'event' => '<string>',
'matcher' => '<string>',
'message' => '<string>',
'role' => '<string>',
'scope' => '<string>',
'session' => '<string>',
'targetSession' => '<string>',
'targetTask' => '<string>',
'task' => '<string>',
'workspace' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/v1/hooks/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"agent\": \"<string>\",\n \"async\": true,\n \"barrier\": \"<string>\",\n \"cooldown\": \"<string>\",\n \"dedupeKey\": \"<string>\",\n \"disabled\": true,\n \"event\": \"<string>\",\n \"matcher\": \"<string>\",\n \"message\": \"<string>\",\n \"role\": \"<string>\",\n \"scope\": \"<string>\",\n \"session\": \"<string>\",\n \"targetSession\": \"<string>\",\n \"targetTask\": \"<string>\",\n \"task\": \"<string>\",\n \"workspace\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/api/v1/hooks/create")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"agent\": \"<string>\",\n \"async\": true,\n \"barrier\": \"<string>\",\n \"cooldown\": \"<string>\",\n \"dedupeKey\": \"<string>\",\n \"disabled\": true,\n \"event\": \"<string>\",\n \"matcher\": \"<string>\",\n \"message\": \"<string>\",\n \"role\": \"<string>\",\n \"scope\": \"<string>\",\n \"session\": \"<string>\",\n \"targetSession\": \"<string>\",\n \"targetTask\": \"<string>\",\n \"task\": \"<string>\",\n \"workspace\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/hooks/create")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"agent\": \"<string>\",\n \"async\": true,\n \"barrier\": \"<string>\",\n \"cooldown\": \"<string>\",\n \"dedupeKey\": \"<string>\",\n \"disabled\": true,\n \"event\": \"<string>\",\n \"matcher\": \"<string>\",\n \"message\": \"<string>\",\n \"role\": \"<string>\",\n \"scope\": \"<string>\",\n \"session\": \"<string>\",\n \"targetSession\": \"<string>\",\n \"targetTask\": \"<string>\",\n \"task\": \"<string>\",\n \"workspace\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}Body
application/json
Hook name
Action: inject_context, send_session_event, append_history, comment_task
Agent scope value
Run hook action asynchronously
Delivery barrier for prompt actions
Cooldown (e.g. 5s, 1m)
Optional dedupe template
Create hook disabled
Event: SessionStart, PreToolUse, PostToolUse, CwdChanged, FileChanged, Stop
Optional matcher (tool name, path, session, etc)
Action message/body template
append_history role: user or assistant
Scope: global, agent, session, workspace, task
Session scope value
Target session for action payload
Target task for comment_task payload
Task scope value
Workspace scope value
Response
Success — no @Returns schema declared; payload shape is loose.
The response is of type object.