Update Persona
Modify an existing persona's properties and behavior.
Only the fields provided in the request will be updated. All other fields remain unchanged.
Request
curl -X PUT "https://api.chanl.ai/api/v1/workspaces/ws_123/personas/persona_456" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Very Frustrated Customer",
"prompt": "You are an extremely frustrated customer who has been having issues with your service for weeks. You are very impatient and want immediate resolution. You have already called multiple times without success.",
"difficulty": "very_hard",
"tags": ["frustrated", "impatient", "support", "repeat_caller"]
}'const response = await fetch(`https://api.chanl.ai/api/v1/workspaces/${workspaceId}/personas/${personaId}`, {
method: 'PUT',
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Very Frustrated Customer',
prompt: 'You are an extremely frustrated customer who has been having issues with your service for weeks. You are very impatient and want immediate resolution. You have already called multiple times without success.',
difficulty: 'very_hard',
tags: ['frustrated', 'impatient', 'support', 'repeat_caller']
})
});
const { data } = await response.json();
console.log('Updated persona:', data.persona);import requests
response = requests.put(
f'https://api.chanl.ai/api/v1/workspaces/{workspace_id}/personas/{persona_id}',
headers={'Authorization': f'Bearer {access_token}'},
json={
'name': 'Very Frustrated Customer',
'prompt': 'You are an extremely frustrated customer who has been having issues with your service for weeks. You are very impatient and want immediate resolution. You have already called multiple times without success.',
'difficulty': 'very_hard',
'tags': ['frustrated', 'impatient', 'support', 'repeat_caller']
}
)
persona = response.json()['data']['persona']Response
{
"success": true,
"data": {
"persona": {
"id": "persona_456",
"name": "Very Frustrated Customer",
"language": "en",
"prompt": "You are an extremely frustrated customer who has been having issues with your service for weeks. You are very impatient and want immediate resolution. You have already called multiple times without success.",
"emotion": "frustrated",
"difficulty": "very_hard",
"backgroundNoise": "office",
"tags": ["frustrated", "impatient", "support", "repeat_caller"],
"updated_at": "2024-01-15T10:45:00Z"
}
}
}{
"success": false,
"error": {
"code": "NAME_ALREADY_EXISTS",
"message": "A persona with this name already exists in the workspace"
}
}