curl --request PUT \
--url https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/phone-numbers/{phoneNumberId}/environment \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"environmentId": "5b9d1e7f-2c3a-4f8b-8d16-7e9f0a1b2c3d"
}
'{
"success": true,
"message": "success",
"data": {
"phoneNumberId": "c7e5a3b1-9d8f-4e6c-a2b4-1f3e5d7c9a0b",
"number": "+14155550100",
"label": "Support line",
"agentId": "d949f13f-40d2-4e48-ac86-b66633070603",
"environmentId": "5b9d1e7f-2c3a-4f8b-8d16-7e9f0a1b2c3d",
"environment": "staging"
}
}{
"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": 8409,
"message": "This environment or the A/B split changed since you last looked. Review the current state and try again.",
"messageKey": "ReleaseStale",
"params": {
"reason": "STALE"
}
}{
"code": 8409,
"message": "This environment or the A/B split changed since you last looked. Review the current state and try again.",
"messageKey": "ReleaseStale",
"params": {
"reason": "STALE"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Agent Environments
Move Phone Number to Environment
Sets which environment one of the agent’s phone numbers answers from. dev and staging need deployments on for the agent. If the environment already has a number, the request is refused (409) rather than taking that line off the agent. To assign a number to an agent in the first place, use the phone number assign endpoint, which also takes environmentId.
PUT
/
v2
/
voice-agents
/
{voiceAgentId}
/
phone-numbers
/
{phoneNumberId}
/
environment
curl --request PUT \
--url https://api.tryhamsa.com/v2/voice-agents/{voiceAgentId}/phone-numbers/{phoneNumberId}/environment \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"environmentId": "5b9d1e7f-2c3a-4f8b-8d16-7e9f0a1b2c3d"
}
'{
"success": true,
"message": "success",
"data": {
"phoneNumberId": "c7e5a3b1-9d8f-4e6c-a2b4-1f3e5d7c9a0b",
"number": "+14155550100",
"label": "Support line",
"agentId": "d949f13f-40d2-4e48-ac86-b66633070603",
"environmentId": "5b9d1e7f-2c3a-4f8b-8d16-7e9f0a1b2c3d",
"environment": "staging"
}
}{
"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": 8409,
"message": "This environment or the A/B split changed since you last looked. Review the current state and try again.",
"messageKey": "ReleaseStale",
"params": {
"reason": "STALE"
}
}{
"code": 8409,
"message": "This environment or the A/B split changed since you last looked. Review the current state and try again.",
"messageKey": "ReleaseStale",
"params": {
"reason": "STALE"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Path Parameters
Body
application/json
Was this page helpful?