cURL
curl --request POST \ --url https://api.tryhamsa.com/v1/voice-agents/assign-number \ --header 'Authorization: <api-key>' \ --header 'Content-Type: application/json' \ --data ' { "voiceAgentId": "d949f13f-40d2-4e48-ac86-b66633070603", "phoneNumber": "+9700000000" } '
{ "success": true, "message": "Success", "data": { "id": "d949f13f-40d2-4e48-ac86-b66633070603", "number": "+9700000000", "label": "My Twilio Number", "type": "TWILIO", "userId": "d949f13f-40d2-4e48-ac86-b66633070603", "sipInboundConfigs": { "originationUri": "sip:sip.eu.tryhamsa.com:5060;transport=tcp" }, "sipOutboundConfigs": { "address": "sip.example.com", "transportType": "TCP", "customHeaders": {} }, "voiceAgentId": "d949f13f-40d2-4e48-ac86-b66633070603", "voiceAgent": { "id": "d949f13f-40d2-4e48-ac86-b66633070603", "name": "My Voice Agent" }, "createdAt": "2023-01-01T12:00:00Z", "updatedAt": "2023-02-01T12:00:00Z" } }
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '
UUID of the voice agent to assign phone number to.
"d949f13f-40d2-4e48-ac86-b66633070603"
Phone number to assign to voice agent, should start with + and the country code.
"+9700000000"
Successful response
true
"Success"
Show child attributes
"My Twilio Number"
TWILIO
SIP
"TWILIO"
sip:sip.eu.tryhamsa.com:5060;transport=tcp
"sip:sip.eu.tryhamsa.com:5060;transport=tcp"
1
"sip.example.com"
TCP
UDP
"TCP"
"My Voice Agent"
"2023-01-01T12:00:00Z"
"2023-02-01T12:00:00Z"