curl --request PATCH \
--url https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/functions-macros/{functionMacroId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"isActive": false
}
'{
"success": true,
"message": "success",
"data": [
{
"id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
"projectId": "fbb9e8b2-2dbb-40f9-a051-9404624e3247",
"userId": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"createdBy": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"updatedBy": null,
"name": "has_card_number",
"notes": "Matches 13 to 19 digits in a row",
"type": "JAVASCRIPT_FUNCTION",
"usedAs": "CHECK",
"code": "return /\\d{13,19}/.test(text.replace(/[\\s-]/g, ''));",
"params": null,
"requiredParams": [
"name"
],
"createdAt": "2026-10-20T09:15:00.000Z",
"updatedAt": "2026-10-20T09:15:00.000Z",
"isActive": true
}
]
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Functions & Macros
Toggle Agent Function or Macro
Turns one assigned function or macro on or off for this agent, without removing it. The change is saved in your own draft, like Update Voice Agent: a test call of the draft uses it, and callers get it when the draft is published. Only active ones reach calls. Editing a function or macro itself still applies to every agent right away.
PATCH
/
v2
/
voice-agents
/
{voiceAgentId}
/
functions-macros
/
{functionMacroId}
curl --request PATCH \
--url https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/functions-macros/{functionMacroId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"isActive": false
}
'{
"success": true,
"message": "success",
"data": [
{
"id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
"projectId": "fbb9e8b2-2dbb-40f9-a051-9404624e3247",
"userId": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"createdBy": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"updatedBy": null,
"name": "has_card_number",
"notes": "Matches 13 to 19 digits in a row",
"type": "JAVASCRIPT_FUNCTION",
"usedAs": "CHECK",
"code": "return /\\d{13,19}/.test(text.replace(/[\\s-]/g, ''));",
"params": null,
"requiredParams": [
"name"
],
"createdAt": "2026-10-20T09:15:00.000Z",
"updatedAt": "2026-10-20T09:15:00.000Z",
"isActive": true
}
]
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Path Parameters
Was this page helpful?