Lifecycle Hooks
Update a lifecycle hook
Every field is optional; only what you send changes. stage cannot be changed — delete the hook and create it on the other stage instead.
These endpoints return a bare object (
{ "hook": … }, { "hooks": [ … ] }) and a bare { "error": … } on failure, rather than the success/data envelope used elsewhere in this API. Validation failures return 422 with an issues array.PATCH
/
agents
/
{agentId}
/
lifecycle-hooks
/
{hookId}
Update a lifecycle hook
curl --request PATCH \
--url https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": false,
"timeoutMs": 5000
}
'import requests
url = "https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}"
payload = {
"enabled": False,
"timeoutMs": 5000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: false, timeoutMs: 5000})
};
fetch('https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => false,
'timeoutMs' => 5000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}"
payload := strings.NewReader("{\n \"enabled\": false,\n \"timeoutMs\": 5000\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": false,\n \"timeoutMs\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": false,\n \"timeoutMs\": 5000\n}"
response = http.request(request)
puts response.read_body{
"hook": {
"id": "lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912",
"agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"stage": "PRE_CALL",
"position": 0,
"toolSlug": "leadsquared",
"toolFn": "lookup_lead",
"functionId": null,
"name": "Look up lead",
"input": {
"phone": "{{to_number}}"
},
"exposeAs": "lead",
"required": false,
"timeoutMs": 5000,
"enabled": false,
"createdAt": "2026-08-05T11:20:00.000Z",
"updatedAt": "2026-08-05T11:20:00.000Z"
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}{
"error": "Hook not found"
}{
"error": "VALIDATION_FAILED",
"issues": [
{
"field": "exposeAs",
"code": "DUPLICATE",
"message": "exposeAs 'lead' is already used in PRE_CALL"
}
]
}{
"success": false,
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Retry after 60 seconds."
}
}{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}
}Authorizations
API key in format: rg_live_xxxx. Pass as a Bearer token in the Authorization header.
Body
application/json
Response
Success.
Show child attributes
Show child attributes
⌘I
Update a lifecycle hook
curl --request PATCH \
--url https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": false,
"timeoutMs": 5000
}
'import requests
url = "https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}"
payload = {
"enabled": False,
"timeoutMs": 5000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: false, timeoutMs: 5000})
};
fetch('https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => false,
'timeoutMs' => 5000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}"
payload := strings.NewReader("{\n \"enabled\": false,\n \"timeoutMs\": 5000\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": false,\n \"timeoutMs\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/{hookId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": false,\n \"timeoutMs\": 5000\n}"
response = http.request(request)
puts response.read_body{
"hook": {
"id": "lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912",
"agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"stage": "PRE_CALL",
"position": 0,
"toolSlug": "leadsquared",
"toolFn": "lookup_lead",
"functionId": null,
"name": "Look up lead",
"input": {
"phone": "{{to_number}}"
},
"exposeAs": "lead",
"required": false,
"timeoutMs": 5000,
"enabled": false,
"createdAt": "2026-08-05T11:20:00.000Z",
"updatedAt": "2026-08-05T11:20:00.000Z"
}
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}{
"error": "Hook not found"
}{
"error": "VALIDATION_FAILED",
"issues": [
{
"field": "exposeAs",
"code": "DUPLICATE",
"message": "exposeAs 'lead' is already used in PRE_CALL"
}
]
}{
"success": false,
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Retry after 60 seconds."
}
}{
"success": false,
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}
}