curl --request PUT \
--url https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/policies \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"policyIds": [
"a3f1c2d4-5b6e-4f70-8a91-b2c3d4e5f601",
"c4d5e6f7-0819-4a2b-8c3d-4e5f60718293"
]
}
'
{
"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",
"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"
}
}Policies
Set Agent Policies
Replaces the agent’s policies with this list. New ones start active, ones already assigned keep their switch, ones left out are removed. An empty list removes all. 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 policy itself still applies to every agent right away.
PUT
/
v2
/
voice-agents
/
{voiceAgentId}
/
policies
curl --request PUT \
--url https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/policies \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"policyIds": [
"a3f1c2d4-5b6e-4f70-8a91-b2c3d4e5f601",
"c4d5e6f7-0819-4a2b-8c3d-4e5f60718293"
]
}
'
{
"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",
"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
Body
application/json
Was this page helpful?