Skip to main content
POST
/
v1
/
voice-agents
/
phone-number
Add a phone number for a user.
curl --request POST \
  --url https://api.tryhamsa.com/v1/voice-agents/phone-number \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "TWILIO",
  "phoneNumber": "<string>",
  "label": "<string>",
  "twilioAccountSid": "<string>",
  "twilioAuthToken": "<string>"
}'
{
  "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"
  }
}

Authorizations

Authorization
string
header
required

Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token <api-key>'

Body

application/json
  • Option 1
  • Option 2
type
enum<string>
required

The type of phone number to add, TWILIO in this case.

Available options:
TWILIO
phoneNumber
string
required

The phone number to add to the Twilio numbers of a user.

Minimum length: 1
label
string
required

A label to identify the phone number.

Minimum length: 1
twilioAccountSid
string
required

The Twilio Account SID associated with the Twilio number.

Minimum length: 1
twilioAuthToken
string
required

The Twilio Auth Token for authenticating API requests.

Minimum length: 1

Response

Successful response

success
boolean
Example:

true

message
string
Example:

"Success"

data
object
I