Update a pre-call hook
PATCH /v1/pre-call-hooks/{hook_id}
| Property | Value |
|---|---|
| Operation | update_pre_call_hook |
| Group | Pre-call hooks |
| Scope | hooks:write |
| Route class | control |
| Idempotency | No Idempotency-Key |
| Audit | Audited dispatch.pre_call_hook.update (mutation) |
| Released in | 1.52.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Replaces the named fields at the revision If-Match names (1.52.0); the next Call reads them, within the 10-second cache of the api processes (a target). The scope never changes. The URL passes the egress guard (egress_denied with its reason), and every issue is a detail of 422 validation_failed (PreCallHookIssueCode).
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the hooks:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X PATCH "$VOCAL_API/v1/pre-call-hooks/pch_..." \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H 'If-Match: "1"' \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/pre-call-hooks/pch_...`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'If-Match': '"1"',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import requests
response = requests.patch(
f"{os.environ['VOCAL_API']}/v1/pre-call-hooks/pch_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"If-Match": '"1"',
},
json={},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
hook_id | path | PreCallHookId | yes | The id of a pre-call hook: pch_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
if-match | header | string | yes | The revision the change was made against, quoted as the ETag returns it, or * to overwrite. |
Request body
Content type application/json, required: PreCallHookUpdateRequest.
| Field | Type | Required | Description |
|---|---|---|---|
allowed_agent_ids | array of AgentId | no | |
default | PreCallHookAcceptInput or null | no | |
directions | array of PreCallHookDirection | no | |
on_failure | PreCallHookOnFailure | no | |
status | one of "active", "paused" | no | degraded is set by the platform. |
timeout_ms | integer or null | no | |
url | string (uri) | no | The endpoint: https, a public name, no IP literal and no embedded credentials, checked by the egress guard at save and at every request. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | PreCallHook | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
412 | application/json | ErrorEnvelope | revision_mismatch |
422 | application/json | ErrorEnvelope | validation_failed |
428 | application/json | ErrorEnvelope | precondition_required |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is PreCallHook.
| Field | Type | Required | Description |
|---|---|---|---|
allowed_agent_ids | array of AgentId | yes | Agents besides the routed one whose published versions a response may select; empty allows only versions of the routed Agent. |
consecutive_failures | integer | yes | |
created_at | Timestamp | yes | |
default | PreCallHookDefault or null | yes | |
directions | array of PreCallHookDirection | yes | |
id | PreCallHookId | yes | |
object | "pre_call_hook" | yes | |
on_failure | PreCallHookOnFailure | yes | |
phi_attested_at | Timestamp or null | yes | When an owner attested the endpoint for PHI; null before. |
phi_attested_by | MemberId or null | yes | |
previous_secret_expires_at | Timestamp or null | yes | |
previous_secret_hint | string or null | yes | |
revision | integer | yes | |
scope | PreCallHookScope | yes | |
secret_hint | string | yes | The last four characters of the current secret. |
status | PreCallHookStatus | yes | |
timeout_ms | integer or null | yes | The deadline of a request; null for the default of each direction. |
updated_at | Timestamp | yes | |
url | string | yes | The endpoint. |