Update a policy
curl --request PATCH \
--url https://api.tryhamsa.com/v2/voice-agents/policies/{policyId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"severity": "CRITICAL",
"notes": null
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-agents/policies/{policyId}"
payload = {
"severity": "CRITICAL",
"notes": None
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({severity: 'CRITICAL', notes: null})
};
fetch('https://api.tryhamsa.com/v2/voice-agents/policies/{policyId}', 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.tryhamsa.com/v2/voice-agents/policies/{policyId}",
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([
'severity' => 'CRITICAL',
'notes' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.tryhamsa.com/v2/voice-agents/policies/{policyId}"
payload := strings.NewReader("{\n \"severity\": \"CRITICAL\",\n \"notes\": null\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.tryhamsa.com/v2/voice-agents/policies/{policyId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"severity\": \"CRITICAL\",\n \"notes\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-agents/policies/{policyId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"severity\": \"CRITICAL\",\n \"notes\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "success",
"data": {
"id": "a3f1c2d4-5b6e-4f70-8a91-b2c3d4e5f601",
"projectId": "fbb9e8b2-2dbb-40f9-a051-9404624e3247",
"userId": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"createdBy": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"name": "Refund policy",
"appliesIn": "PER_USER_RESPONSE",
"conditionsMatch": "ALL",
"conditions": [
{
"variable": "customer_tier",
"condition": "equals",
"value": "gold"
}
],
"matchingExamples": "I want my money back. Can I get a refund?",
"instructions": "Refunds are offered only within 14 days of purchase. Never promise a refund outside that window.",
"notes": "Reviewed by legal",
"severity": "HIGH",
"status": "PROCESSED",
"failureReason": null,
"createdAt": "2026-10-20T09:15:00.000Z",
"updatedAt": "2026-10-20T09:15:00.000Z"
}
}{
"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"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Policies
Update Policy
Changes the fields you send. The change applies to every agent using the policy.
PATCH
/
v2
/
voice-agents
/
policies
/
{policyId}
Update a policy
curl --request PATCH \
--url https://api.tryhamsa.com/v2/voice-agents/policies/{policyId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"severity": "CRITICAL",
"notes": null
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-agents/policies/{policyId}"
payload = {
"severity": "CRITICAL",
"notes": None
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({severity: 'CRITICAL', notes: null})
};
fetch('https://api.tryhamsa.com/v2/voice-agents/policies/{policyId}', 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.tryhamsa.com/v2/voice-agents/policies/{policyId}",
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([
'severity' => 'CRITICAL',
'notes' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.tryhamsa.com/v2/voice-agents/policies/{policyId}"
payload := strings.NewReader("{\n \"severity\": \"CRITICAL\",\n \"notes\": null\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.tryhamsa.com/v2/voice-agents/policies/{policyId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"severity\": \"CRITICAL\",\n \"notes\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-agents/policies/{policyId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"severity\": \"CRITICAL\",\n \"notes\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "success",
"data": {
"id": "a3f1c2d4-5b6e-4f70-8a91-b2c3d4e5f601",
"projectId": "fbb9e8b2-2dbb-40f9-a051-9404624e3247",
"userId": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"createdBy": "b7d9e979-4a16-437b-8571-4ed92a94faa8",
"name": "Refund policy",
"appliesIn": "PER_USER_RESPONSE",
"conditionsMatch": "ALL",
"conditions": [
{
"variable": "customer_tier",
"condition": "equals",
"value": "gold"
}
],
"matchingExamples": "I want my money back. Can I get a refund?",
"instructions": "Refunds are offered only within 14 days of purchase. Never promise a refund outside that window.",
"notes": "Reviewed by legal",
"severity": "HIGH",
"status": "PROCESSED",
"failureReason": null,
"createdAt": "2026-10-20T09:15:00.000Z",
"updatedAt": "2026-10-20T09:15:00.000Z"
}
}{
"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"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Path Parameters
Body
application/json
Send at least one field. Fields you leave out keep their value.
EVERY_TURN: applies on every turn of the call. PER_USER_RESPONSE: applies only when what the caller says matches the rule, found by meaning (the name, instructions and matchingExamples are searched), so the exact words don't matter.
Available options:
EVERY_TURN, PER_USER_RESPONSE Was this page helpful?