Lifecycle Hooks
Reorder hooks within a stage
Sets the run order for one stage. ids must list that stage’s hooks in the order you want them to run.
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.POST
/
agents
/
{agentId}
/
lifecycle-hooks
/
reorder
Reorder hooks within a stage
curl --request POST \
--url https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stage": "PRE_CALL",
"ids": [
"lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912",
"lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223"
]
}
'import requests
url = "https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder"
payload = {
"stage": "PRE_CALL",
"ids": ["lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912", "lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
stage: 'PRE_CALL',
ids: [
'lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912',
'lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223'
]
})
};
fetch('https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder', 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/reorder",
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([
'stage' => 'PRE_CALL',
'ids' => [
'lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912',
'lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223'
]
]),
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/reorder"
payload := strings.NewReader("{\n \"stage\": \"PRE_CALL\",\n \"ids\": [\n \"lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912\",\n \"lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223\"\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stage\": \"PRE_CALL\",\n \"ids\": [\n \"lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912\",\n \"lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"stage\": \"PRE_CALL\",\n \"ids\": [\n \"lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912\",\n \"lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"hooks": [
{
"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": 3000,
"enabled": true,
"createdAt": "2026-08-05T11:20:00.000Z",
"updatedAt": "2026-08-05T11:20:00.000Z"
}
]
}{
"error": "ids must be an array of strings"
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}{
"error": "Agent 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.
Path Parameters
Agent ID.
Body
application/json
Response
The stage's hooks in their new order.
Show child attributes
Show child attributes
⌘I
Reorder hooks within a stage
curl --request POST \
--url https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stage": "PRE_CALL",
"ids": [
"lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912",
"lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223"
]
}
'import requests
url = "https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder"
payload = {
"stage": "PRE_CALL",
"ids": ["lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912", "lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
stage: 'PRE_CALL',
ids: [
'lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912',
'lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223'
]
})
};
fetch('https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder', 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/reorder",
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([
'stage' => 'PRE_CALL',
'ids' => [
'lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912',
'lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223'
]
]),
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/reorder"
payload := strings.NewReader("{\n \"stage\": \"PRE_CALL\",\n \"ids\": [\n \"lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912\",\n \"lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223\"\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stage\": \"PRE_CALL\",\n \"ids\": [\n \"lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912\",\n \"lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vocobase.com/api/v2/agents/{agentId}/lifecycle-hooks/reorder")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"stage\": \"PRE_CALL\",\n \"ids\": [\n \"lh_2b3c4d5e-6f70-8192-a3b4-c5d6e7f80912\",\n \"lh_3c4d5e6f-7081-92a3-b4c5-d6e7f8091223\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"hooks": [
{
"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": 3000,
"enabled": true,
"createdAt": "2026-08-05T11:20:00.000Z",
"updatedAt": "2026-08-05T11:20:00.000Z"
}
]
}{
"error": "ids must be an array of strings"
}{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}{
"error": "Agent 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"
}
}